diff --git "a/oracle_context_cache_v3/JuanBindez__pytubefix.json" "b/oracle_context_cache_v3/JuanBindez__pytubefix.json" new file mode 100644--- /dev/null +++ "b/oracle_context_cache_v3/JuanBindez__pytubefix.json" @@ -0,0 +1 @@ +{"repo": "JuanBindez/pytubefix", "n_pairs": 138, "version": "v3_compressed", "max_tokens": 6000, "contexts": {"tests/contrib/test_playlist.py::224": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Playlist", "mock"], "enclosing_function": "test_trimmed_pagination", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 325, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 325, "compression_ratio": 1.0}, "tests/test_helpers.py::71": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/helpers.py", "pytubefix/exceptions.py"], "used_names": ["mock", "target_directory"], "enclosing_function": "test_target_directory_with_absolute_path", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_streams.py::49": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py"], "used_names": [], "enclosing_function": "test_filesize_approx", "extracted_code": "", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_helpers.py::131": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/helpers.py", "pytubefix/exceptions.py"], "used_names": ["create_mock_html_json", "gzip", "io", "json", "mock", "os"], "enclosing_function": "test_create_mock_html_json", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_captions.py::148": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/captions.py"], "used_names": ["Caption", "mock", "patch"], "enclosing_function": "test_xml_captions", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 974, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 974, "compression_ratio": 1.0}, "tests/contrib/test_channel.py::26": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Channel", "mock"], "enclosing_function": "test_channel_uri", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 286, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 286, "compression_ratio": 1.0}, "tests/test_streams.py::70": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py"], "used_names": [], "enclosing_function": "test_caption_tracks", "extracted_code": "", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_helpers.py::78": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/helpers.py", "pytubefix/exceptions.py"], "used_names": ["mock", "target_directory"], "enclosing_function": "test_target_directory_with_no_path", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_query.py::28": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_filters", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_parser.py::56": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/parser.py"], "used_names": ["json", "parse_for_object", "pytest"], "enclosing_function": "test_parse_object_requiring_ast", "extracted_code": "# Source: pytubefix/parser.py\ndef parse_for_object(html, preceding_regex):\n \"\"\"Parses input html to find the end of a JavaScript object.\n\n :param str html:\n HTML to be parsed for an object.\n :param str preceding_regex:\n Regex to find the string preceding the object.\n :rtype dict:\n :returns:\n A dict created from parsing the object.\n \"\"\"\n regex = re.compile(preceding_regex)\n result = regex.search(html)\n if not result:\n raise HTMLParseError(f'No matches for regex {preceding_regex}')\n\n start_index = result.end()\n return parse_for_object_from_startpoint(html, start_index)", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 634, "extracted_code_full": "# Source: pytubefix/parser.py\ndef parse_for_object(html, preceding_regex):\n \"\"\"Parses input html to find the end of a JavaScript object.\n\n :param str html:\n HTML to be parsed for an object.\n :param str preceding_regex:\n Regex to find the string preceding the object.\n :rtype dict:\n :returns:\n A dict created from parsing the object.\n \"\"\"\n regex = re.compile(preceding_regex)\n result = regex.search(html)\n if not result:\n raise HTMLParseError(f'No matches for regex {preceding_regex}')\n\n start_index = result.end()\n return parse_for_object_from_startpoint(html, start_index)", "n_chars_compressed": 634, "compression_ratio": 1.0}, "tests/test_extract.py::39": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/extract.py", "pytubefix/exceptions.py"], "used_names": ["extract", "re"], "enclosing_function": "test_js_url", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_captions.py::69": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/captions.py"], "used_names": ["Caption", "mock", "mock_open", "os", "patch"], "enclosing_function": "test_download", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 974, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 974, "compression_ratio": 1.0}, "tests/test_query.py::127": {"resolved_imports": [], "used_names": [], "enclosing_function": "test_order_by_non_numerical_ascending", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/contrib/test_channel.py::13": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Channel", "mock"], "enclosing_function": "test_init_with_url", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 286, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 286, "compression_ratio": 1.0}, "tests/test_query.py::170": {"resolved_imports": [], "used_names": [], "enclosing_function": "test_filter_is_dash", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_cipher.py::39": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/cipher.py", "pytubefix/exceptions.py"], "used_names": ["cipher"], "enclosing_function": "test_get_throttling_function_name", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_exceptions.py::14": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/__init__.py", "pytubefix/helpers.py"], "used_names": ["exceptions", "strip_color_codes"], "enclosing_function": "test_video_unavailable", "extracted_code": "# Source: pytubefix/exceptions.py\n\"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 707, "extracted_code_full": "# Source: pytubefix/exceptions.py\n \"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_chars_compressed": 703, "compression_ratio": 0.9943422913719944}, "tests/test_cli.py::168": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/cli.py", "pytubefix/exceptions.py"], "used_names": ["argparse", "cli"], "enclosing_function": "test_parse_args_truthy", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/contrib/test_channel.py::68": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Channel", "mock"], "enclosing_function": "test_channel_video_list", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 286, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 286, "compression_ratio": 1.0}, "tests/contrib/test_playlist.py::296": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Playlist", "mock"], "enclosing_function": "test_playlist_views", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 325, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 325, "compression_ratio": 1.0}, "tests/test_exceptions.py::88": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/__init__.py", "pytubefix/helpers.py"], "used_names": ["YouTube", "exceptions", "mock", "pytest"], "enclosing_function": "test_raises_recording_unavailable", "extracted_code": "# Source: pytubefix/exceptions.py\n\"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/__init__.py\n# noreorder\n\"\"\"\nPytubefix: a very serious Python library for downloading YouTube Videos.\n\"\"\"\n__title__ = \"pytubefix\"\n__author__ = \"Juan Bindez\"\n__license__ = \"MIT License\"\n__js__ = None\n__js_url__ = None\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\n\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer\n\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1530, "extracted_code_full": "# Source: pytubefix/exceptions.py\n \"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/__init__.py\n# noreorder\n\"\"\"\nPytubefix: a very serious Python library for downloading YouTube Videos.\n\"\"\"\n__title__ = \"pytubefix\"\n__author__ = \"Juan Bindez\"\n__license__ = \"MIT License\"\n__js__ = None\n__js_url__ = None\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\n\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer\n\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 1526, "compression_ratio": 0.9973856209150327}, "tests/test_request.py::31": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py", "pytubefix/exceptions.py"], "used_names": ["mock", "os", "request"], "enclosing_function": "test_streaming", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_extract.py::102": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/extract.py", "pytubefix/exceptions.py"], "used_names": ["extract"], "enclosing_function": "test_initial_data", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_helpers.py::91": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/helpers.py", "pytubefix/exceptions.py"], "used_names": ["mock", "setup_logger"], "enclosing_function": "test_setup_logger", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_helpers.py::89": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/helpers.py", "pytubefix/exceptions.py"], "used_names": ["mock", "setup_logger"], "enclosing_function": "test_setup_logger", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_request.py::38": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py", "pytubefix/exceptions.py"], "used_names": ["MaxRetriesExceeded", "URLError", "mock", "pytest", "request", "socket"], "enclosing_function": "test_timeout", "extracted_code": "# Source: pytubefix/exceptions.py\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")", "n_imports_parsed": 7, "n_files_resolved": 3, "n_chars_extracted": 208, "extracted_code_full": "# Source: pytubefix/exceptions.py\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")", "n_chars_compressed": 208, "compression_ratio": 1.0}, "tests/contrib/test_channel.py::50": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Channel", "mock"], "enclosing_function": "test_channel_vanity_url", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 286, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 286, "compression_ratio": 1.0}, "tests/test_cli.py::167": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/cli.py", "pytubefix/exceptions.py"], "used_names": ["argparse", "cli"], "enclosing_function": "test_parse_args_truthy", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_query.py::182": {"resolved_imports": [], "used_names": [], "enclosing_function": "test_sequence", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_streams.py::118": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py"], "used_names": [], "enclosing_function": "test_length", "extracted_code": "", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/contrib/test_playlist.py::162": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Playlist", "mock"], "enclosing_function": "test_trimmed", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 325, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 325, "compression_ratio": 1.0}, "tests/test_exceptions.py::65": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/__init__.py", "pytubefix/helpers.py"], "used_names": ["exceptions", "pytest", "strip_color_codes"], "enclosing_function": "test_region_locked_error", "extracted_code": "# Source: pytubefix/exceptions.py\n\"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 707, "extracted_code_full": "# Source: pytubefix/exceptions.py\n \"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_chars_compressed": 703, "compression_ratio": 0.9943422913719944}, "tests/test_extract.py::64": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/extract.py", "pytubefix/exceptions.py"], "used_names": ["datetime", "extract"], "enclosing_function": "test_publish_date", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/contrib/test_channel.py::76": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Channel", "mock"], "enclosing_function": "test_videos_html", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 286, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 286, "compression_ratio": 1.0}, "tests/contrib/test_channel.py::34": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Channel", "mock"], "enclosing_function": "test_channel_name", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 286, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 286, "compression_ratio": 1.0}, "tests/contrib/test_channel.py::15": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Channel", "mock"], "enclosing_function": "test_init_with_url", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 286, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 286, "compression_ratio": 1.0}, "tests/test_cli.py::37": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/cli.py", "pytubefix/exceptions.py"], "used_names": ["cli", "mock", "patch", "pytest"], "enclosing_function": "test_download_when_itag_not_found", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/contrib/test_playlist.py::177": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Playlist", "mock"], "enclosing_function": "test_playlist_failed_pagination", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 325, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 325, "compression_ratio": 1.0}, "tests/test_cipher.py::42": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/cipher.py", "pytubefix/exceptions.py"], "used_names": ["cipher"], "enclosing_function": "test_get_throttling_function_name", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_streams.py::57": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py"], "used_names": [], "enclosing_function": "test_default_filename", "extracted_code": "", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/contrib/test_playlist.py::149": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Playlist", "mock"], "enclosing_function": "test_proxy", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 325, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 325, "compression_ratio": 1.0}, "tests/test_extract.py::21": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/extract.py", "pytubefix/exceptions.py"], "used_names": ["extract"], "enclosing_function": "test_info_url", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_parser.py::15": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/parser.py"], "used_names": ["parse_for_object"], "enclosing_function": "test_parse_simple_empty_object", "extracted_code": "# Source: pytubefix/parser.py\ndef parse_for_object(html, preceding_regex):\n \"\"\"Parses input html to find the end of a JavaScript object.\n\n :param str html:\n HTML to be parsed for an object.\n :param str preceding_regex:\n Regex to find the string preceding the object.\n :rtype dict:\n :returns:\n A dict created from parsing the object.\n \"\"\"\n regex = re.compile(preceding_regex)\n result = regex.search(html)\n if not result:\n raise HTMLParseError(f'No matches for regex {preceding_regex}')\n\n start_index = result.end()\n return parse_for_object_from_startpoint(html, start_index)", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 634, "extracted_code_full": "# Source: pytubefix/parser.py\ndef parse_for_object(html, preceding_regex):\n \"\"\"Parses input html to find the end of a JavaScript object.\n\n :param str html:\n HTML to be parsed for an object.\n :param str preceding_regex:\n Regex to find the string preceding the object.\n :rtype dict:\n :returns:\n A dict created from parsing the object.\n \"\"\"\n regex = re.compile(preceding_regex)\n result = regex.search(html)\n if not result:\n raise HTMLParseError(f'No matches for regex {preceding_regex}')\n\n start_index = result.end()\n return parse_for_object_from_startpoint(html, start_index)", "n_chars_compressed": 634, "compression_ratio": 1.0}, "tests/test_captions.py::27": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/captions.py"], "used_names": ["Caption", "CaptionQuery", "pytest"], "enclosing_function": "test_caption_query_sequence", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 974, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 974, "compression_ratio": 1.0}, "tests/test_main.py::45": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/exceptions.py"], "used_names": [], "enclosing_function": "test_video_keywords", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_extract.py::81": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/extract.py", "pytubefix/exceptions.py"], "used_names": ["RegexMatchError", "extract", "pytest"], "enclosing_function": "test_mime_type_codec_with_no_match_should_error", "extracted_code": "# Source: pytubefix/exceptions.py\nclass RegexMatchError(ExtractError):\n \"\"\"Regex pattern did not return any matches.\"\"\"\n\n def __init__(self, caller: str, pattern: Union[str, Pattern]):\n \"\"\"\n :param str caller:\n Calling function\n :param str pattern:\n Pattern that failed to match\n \"\"\"\n super().__init__(\n f\"{caller}: could not find match for {pattern}\")\n\n\nself.caller = caller\n self.pattern = pattern", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 488, "extracted_code_full": "# Source: pytubefix/exceptions.py\nclass RegexMatchError(ExtractError):\n \"\"\"Regex pattern did not return any matches.\"\"\"\n\n def __init__(self, caller: str, pattern: Union[str, Pattern]):\n \"\"\"\n :param str caller:\n Calling function\n :param str pattern:\n Pattern that failed to match\n \"\"\"\n super().__init__(\n f\"{caller}: could not find match for {pattern}\")\n\n\n self.caller = caller\n self.pattern = pattern", "n_chars_compressed": 480, "compression_ratio": 0.9836065573770492}, "tests/test_parser.py::9": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/parser.py"], "used_names": ["HTMLParseError", "parse_for_object", "pytest"], "enclosing_function": "test_invalid_start", "extracted_code": "# Source: pytubefix/exceptions.py\nclass HTMLParseError(PytubeFixError):\n \"\"\"HTML could not be parsed\"\"\"\n\n\n# Source: pytubefix/parser.py\ndef parse_for_object(html, preceding_regex):\n \"\"\"Parses input html to find the end of a JavaScript object.\n\n :param str html:\n HTML to be parsed for an object.\n :param str preceding_regex:\n Regex to find the string preceding the object.\n :rtype dict:\n :returns:\n A dict created from parsing the object.\n \"\"\"\n regex = re.compile(preceding_regex)\n result = regex.search(html)\n if not result:\n raise HTMLParseError(f'No matches for regex {preceding_regex}')\n\n start_index = result.end()\n return parse_for_object_from_startpoint(html, start_index)", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 743, "extracted_code_full": "# Source: pytubefix/exceptions.py\nclass HTMLParseError(PytubeFixError):\n \"\"\"HTML could not be parsed\"\"\"\n\n\n# Source: pytubefix/parser.py\ndef parse_for_object(html, preceding_regex):\n \"\"\"Parses input html to find the end of a JavaScript object.\n\n :param str html:\n HTML to be parsed for an object.\n :param str preceding_regex:\n Regex to find the string preceding the object.\n :rtype dict:\n :returns:\n A dict created from parsing the object.\n \"\"\"\n regex = re.compile(preceding_regex)\n result = regex.search(html)\n if not result:\n raise HTMLParseError(f'No matches for regex {preceding_regex}')\n\n start_index = result.end()\n return parse_for_object_from_startpoint(html, start_index)", "n_chars_compressed": 743, "compression_ratio": 1.0}, "tests/test_cli.py::146": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/cli.py", "pytubefix/exceptions.py"], "used_names": ["argparse", "cli"], "enclosing_function": "test_parse_args_falsey", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_query.py::164": {"resolved_imports": [], "used_names": [], "enclosing_function": "test_get_highest_resolution", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_captions.py::13": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/captions.py"], "used_names": ["Caption"], "enclosing_function": "test_float_to_srt_time_format", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 974, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 974, "compression_ratio": 1.0}, "tests/test_extract.py::77": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/extract.py", "pytubefix/exceptions.py"], "used_names": ["extract"], "enclosing_function": "test_mime_type_codec", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/contrib/test_playlist.py::30": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Playlist", "mock"], "enclosing_function": "test_init_with_playlist_url", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 325, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 325, "compression_ratio": 1.0}, "tests/test_query.py::46": {"resolved_imports": [], "used_names": [], "enclosing_function": "test_get_last", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_extract.py::76": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/extract.py", "pytubefix/exceptions.py"], "used_names": ["extract"], "enclosing_function": "test_mime_type_codec", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_captions.py::213": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/captions.py"], "used_names": ["Caption", "mock", "patch"], "enclosing_function": "test_generate_srt_captions", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 974, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 974, "compression_ratio": 1.0}, "tests/test_query.py::99": {"resolved_imports": [], "used_names": [], "enclosing_function": "test_order_by_non_numerical", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_helpers.py::57": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/helpers.py", "pytubefix/exceptions.py"], "used_names": ["cache"], "enclosing_function": "test_cache", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_query.py::174": {"resolved_imports": [], "used_names": [], "enclosing_function": "test_get_audio_only", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_helpers.py::64": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/helpers.py", "pytubefix/exceptions.py"], "used_names": ["mock", "os", "target_directory"], "enclosing_function": "test_target_directory_with_relative_path", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_cli.py::273": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/cli.py", "pytubefix/exceptions.py"], "used_names": ["HTTPError", "MagicMock", "argparse", "cli", "mock", "patch"], "enclosing_function": "test_download_with_playlist", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_cli.py::139": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/cli.py", "pytubefix/exceptions.py"], "used_names": ["MagicMock", "cli", "mock", "patch"], "enclosing_function": "test_on_progress", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_itags.py::6": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/itags.py"], "used_names": ["itags"], "enclosing_function": "test_get_format_profile", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_metadata.py::7": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/extract.py"], "used_names": ["extract"], "enclosing_function": "test_extract_metadata_empty", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/contrib/test_playlist.py::55": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Playlist", "datetime", "mock"], "enclosing_function": "test_last_updated", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 325, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 325, "compression_ratio": 1.0}, "tests/test_captions.py::127": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/captions.py"], "used_names": ["Caption", "mock", "mock_open", "os", "patch"], "enclosing_function": "test_download_xml_and_trim_extension", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 974, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 974, "compression_ratio": 1.0}, "tests/test_itags.py::11": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/itags.py"], "used_names": ["itags"], "enclosing_function": "test_get_format_profile_non_existant", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_metadata.py::16": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/extract.py"], "used_names": ["extract"], "enclosing_function": "test_metadata_from_initial_data", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_captions.py::136": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/captions.py"], "used_names": ["Caption", "CaptionQuery"], "enclosing_function": "test_repr", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 974, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 974, "compression_ratio": 1.0}, "tests/contrib/test_playlist.py::268": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Playlist", "mock"], "enclosing_function": "test_playlist_length", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 325, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 325, "compression_ratio": 1.0}, "tests/test_helpers.py::36": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/helpers.py", "pytubefix/exceptions.py"], "used_names": ["deprecated", "mock"], "enclosing_function": "test_deprecated", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/contrib/test_channel.py::12": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Channel", "mock"], "enclosing_function": "test_init_with_url", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 286, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 286, "compression_ratio": 1.0}, "tests/test_request.py::32": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py", "pytubefix/exceptions.py"], "used_names": ["mock", "os", "request"], "enclosing_function": "test_streaming", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_cli.py::147": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/cli.py", "pytubefix/exceptions.py"], "used_names": ["argparse", "cli"], "enclosing_function": "test_parse_args_falsey", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_request.py::57": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py", "pytubefix/exceptions.py"], "used_names": ["mock", "request"], "enclosing_function": "test_get", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/contrib/test_channel.py::23": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Channel", "mock"], "enclosing_function": "test_channel_uri", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 286, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 286, "compression_ratio": 1.0}, "tests/test_captions.py::25": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/captions.py"], "used_names": ["Caption", "CaptionQuery", "pytest"], "enclosing_function": "test_caption_query_sequence", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 974, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 974, "compression_ratio": 1.0}, "tests/test_parser.py::53": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/parser.py"], "used_names": ["json", "parse_for_object", "pytest"], "enclosing_function": "test_parse_object_requiring_ast", "extracted_code": "# Source: pytubefix/parser.py\ndef parse_for_object(html, preceding_regex):\n \"\"\"Parses input html to find the end of a JavaScript object.\n\n :param str html:\n HTML to be parsed for an object.\n :param str preceding_regex:\n Regex to find the string preceding the object.\n :rtype dict:\n :returns:\n A dict created from parsing the object.\n \"\"\"\n regex = re.compile(preceding_regex)\n result = regex.search(html)\n if not result:\n raise HTMLParseError(f'No matches for regex {preceding_regex}')\n\n start_index = result.end()\n return parse_for_object_from_startpoint(html, start_index)", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 634, "extracted_code_full": "# Source: pytubefix/parser.py\ndef parse_for_object(html, preceding_regex):\n \"\"\"Parses input html to find the end of a JavaScript object.\n\n :param str html:\n HTML to be parsed for an object.\n :param str preceding_regex:\n Regex to find the string preceding the object.\n :rtype dict:\n :returns:\n A dict created from parsing the object.\n \"\"\"\n regex = re.compile(preceding_regex)\n result = regex.search(html)\n if not result:\n raise HTMLParseError(f'No matches for regex {preceding_regex}')\n\n start_index = result.end()\n return parse_for_object_from_startpoint(html, start_index)", "n_chars_compressed": 634, "compression_ratio": 1.0}, "tests/test_captions.py::24": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/captions.py"], "used_names": ["Caption", "CaptionQuery", "pytest"], "enclosing_function": "test_caption_query_sequence", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 974, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 974, "compression_ratio": 1.0}, "tests/test_streams.py::262": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py"], "used_names": [], "enclosing_function": "test_author", "extracted_code": "", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_helpers.py::20": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/helpers.py", "pytubefix/exceptions.py"], "used_names": ["helpers"], "enclosing_function": "test_regex_search", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_exceptions.py::31": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/__init__.py", "pytubefix/helpers.py"], "used_names": ["exceptions", "pytest", "strip_color_codes"], "enclosing_function": "test_live_stream_error", "extracted_code": "# Source: pytubefix/exceptions.py\n\"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 707, "extracted_code_full": "# Source: pytubefix/exceptions.py\n \"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_chars_compressed": 703, "compression_ratio": 0.9943422913719944}, "tests/test_captions.py::88": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/captions.py"], "used_names": ["Caption", "mock", "mock_open", "os", "patch"], "enclosing_function": "test_download_with_prefix", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 974, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 974, "compression_ratio": 1.0}, "tests/test_exceptions.py::43": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/__init__.py", "pytubefix/helpers.py"], "used_names": ["exceptions", "pytest", "strip_color_codes"], "enclosing_function": "test_recording_unavailable_error", "extracted_code": "# Source: pytubefix/exceptions.py\n\"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 707, "extracted_code_full": "# Source: pytubefix/exceptions.py\n \"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_chars_compressed": 703, "compression_ratio": 0.9943422913719944}, "tests/test_exceptions.py::42": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/__init__.py", "pytubefix/helpers.py"], "used_names": ["exceptions", "pytest", "strip_color_codes"], "enclosing_function": "test_recording_unavailable_error", "extracted_code": "# Source: pytubefix/exceptions.py\n\"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 707, "extracted_code_full": "# Source: pytubefix/exceptions.py\n \"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_chars_compressed": 703, "compression_ratio": 0.9943422913719944}, "tests/test_helpers.py::25": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/helpers.py", "pytubefix/exceptions.py"], "used_names": ["helpers"], "enclosing_function": "test_safe_filename", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_extract.py::13": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/extract.py", "pytubefix/exceptions.py"], "used_names": ["extract"], "enclosing_function": "test_extract_video_id", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_captions.py::28": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/captions.py"], "used_names": ["Caption", "CaptionQuery", "pytest"], "enclosing_function": "test_caption_query_sequence", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 974, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 974, "compression_ratio": 1.0}, "tests/test_query.py::191": {"resolved_imports": [], "used_names": [], "enclosing_function": "test_otf", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_helpers.py::166": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/helpers.py", "pytubefix/exceptions.py"], "used_names": ["uniqueify"], "enclosing_function": "test_uniqueify", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_request.py::61": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py", "pytubefix/exceptions.py"], "used_names": ["pytest", "request"], "enclosing_function": "test_get_non_http", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_main.py::60": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/exceptions.py"], "used_names": [], "enclosing_function": "test_channel_url", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_streams.py::122": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py"], "used_names": [], "enclosing_function": "test_views", "extracted_code": "", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_helpers.py::159": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/helpers.py", "pytubefix/exceptions.py"], "used_names": ["create_mock_html_json", "gzip", "io", "json", "mock", "os"], "enclosing_function": "test_create_mock_html_json", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_cli.py::315": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/cli.py", "pytubefix/exceptions.py"], "used_names": ["cli", "mock", "patch"], "enclosing_function": "test_download_by_resolution", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_cipher.py::8": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/cipher.py", "pytubefix/exceptions.py"], "used_names": ["RegexMatchError", "cipher", "pytest"], "enclosing_function": "test_get_initial_function_name_with_no_match_should_error", "extracted_code": "# Source: pytubefix/exceptions.py\nclass RegexMatchError(ExtractError):\n \"\"\"Regex pattern did not return any matches.\"\"\"\n\n def __init__(self, caller: str, pattern: Union[str, Pattern]):\n \"\"\"\n :param str caller:\n Calling function\n :param str pattern:\n Pattern that failed to match\n \"\"\"\n super().__init__(\n f\"{caller}: could not find match for {pattern}\")\n\n\nself.caller = caller\n self.pattern = pattern", "n_imports_parsed": 3, "n_files_resolved": 3, "n_chars_extracted": 488, "extracted_code_full": "# Source: pytubefix/exceptions.py\nclass RegexMatchError(ExtractError):\n \"\"\"Regex pattern did not return any matches.\"\"\"\n\n def __init__(self, caller: str, pattern: Union[str, Pattern]):\n \"\"\"\n :param str caller:\n Calling function\n :param str pattern:\n Pattern that failed to match\n \"\"\"\n super().__init__(\n f\"{caller}: could not find match for {pattern}\")\n\n\n self.caller = caller\n self.pattern = pattern", "n_chars_compressed": 480, "compression_ratio": 0.9836065573770492}, "tests/test_main.py::49": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/exceptions.py"], "used_names": ["pytubefix"], "enclosing_function": "test_js_caching", "extracted_code": "# Source: pytubefix/__init__.py\nPytubefix: a very serious Python library for downloading YouTube Videos.\n\"\"\"\n__title__ = \"pytubefix\"\n__author__ = \"Juan Bindez\"\n__license__ = \"MIT License\"\n__js__ = None\n__js_url__ = None\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\n\n__js_url__ = None\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\n\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 2335, "extracted_code_full": "# Source: pytubefix/__init__.py\nPytubefix: a very serious Python library for downloading YouTube Videos.\n\"\"\"\n__title__ = \"pytubefix\"\n__author__ = \"Juan Bindez\"\n__license__ = \"MIT License\"\n__js__ = None\n__js_url__ = None\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\n\n__js_url__ = None\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\n\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 2335, "compression_ratio": 1.0}, "tests/test_exceptions.py::26": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/__init__.py", "pytubefix/helpers.py"], "used_names": ["exceptions", "pytest", "strip_color_codes"], "enclosing_function": "test_live_stream_error", "extracted_code": "# Source: pytubefix/exceptions.py\n\"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 707, "extracted_code_full": "# Source: pytubefix/exceptions.py\n \"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_chars_compressed": 703, "compression_ratio": 0.9943422913719944}, "tests/test_main.py::51": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/exceptions.py"], "used_names": ["pytubefix"], "enclosing_function": "test_js_caching", "extracted_code": "# Source: pytubefix/__init__.py\nPytubefix: a very serious Python library for downloading YouTube Videos.\n\"\"\"\n__title__ = \"pytubefix\"\n__author__ = \"Juan Bindez\"\n__license__ = \"MIT License\"\n__js__ = None\n__js_url__ = None\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\n\n__js_url__ = None\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\n\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 2335, "extracted_code_full": "# Source: pytubefix/__init__.py\nPytubefix: a very serious Python library for downloading YouTube Videos.\n\"\"\"\n__title__ = \"pytubefix\"\n__author__ = \"Juan Bindez\"\n__license__ = \"MIT License\"\n__js__ = None\n__js_url__ = None\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\n\n__js_url__ = None\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\n\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 2335, "compression_ratio": 1.0}, "tests/contrib/test_playlist.py::117": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Playlist", "mock"], "enclosing_function": "test_sequence", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 325, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 325, "compression_ratio": 1.0}, "tests/test_exceptions.py::13": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/__init__.py", "pytubefix/helpers.py"], "used_names": ["exceptions", "strip_color_codes"], "enclosing_function": "test_video_unavailable", "extracted_code": "# Source: pytubefix/exceptions.py\n\"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 707, "extracted_code_full": "# Source: pytubefix/exceptions.py\n \"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_chars_compressed": 703, "compression_ratio": 0.9943422913719944}, "tests/test_main.py::52": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/exceptions.py"], "used_names": ["pytubefix"], "enclosing_function": "test_js_caching", "extracted_code": "# Source: pytubefix/__init__.py\nPytubefix: a very serious Python library for downloading YouTube Videos.\n\"\"\"\n__title__ = \"pytubefix\"\n__author__ = \"Juan Bindez\"\n__license__ = \"MIT License\"\n__js__ = None\n__js_url__ = None\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\n\n__js_url__ = None\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\n\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 2335, "extracted_code_full": "# Source: pytubefix/__init__.py\nPytubefix: a very serious Python library for downloading YouTube Videos.\n\"\"\"\n__title__ = \"pytubefix\"\n__author__ = \"Juan Bindez\"\n__license__ = \"MIT License\"\n__js__ = None\n__js_url__ = None\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\n\n__js_url__ = None\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\n\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 2335, "compression_ratio": 1.0}, "tests/test_cli.py::131": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/cli.py", "pytubefix/exceptions.py"], "used_names": ["cli"], "enclosing_function": "test_display_progress_bar", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_query.py::70": {"resolved_imports": [], "used_names": [], "enclosing_function": "test_order_by", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/contrib/test_channel.py::11": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Channel", "mock"], "enclosing_function": "test_init_with_url", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 286, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 286, "compression_ratio": 1.0}, "tests/test_captions.py::26": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/captions.py"], "used_names": ["Caption", "CaptionQuery", "pytest"], "enclosing_function": "test_caption_query_sequence", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 974, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 974, "compression_ratio": 1.0}, "tests/test_main.py::24": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/exceptions.py"], "used_names": ["RegexMatchError", "YouTube", "mock", "pytest"], "enclosing_function": "test_video_unavailable", "extracted_code": "# Source: pytubefix/exceptions.py\nclass RegexMatchError(ExtractError):\n \"\"\"Regex pattern did not return any matches.\"\"\"\n\n def __init__(self, caller: str, pattern: Union[str, Pattern]):\n \"\"\"\n :param str caller:\n Calling function\n :param str pattern:\n Pattern that failed to match\n \"\"\"\n super().__init__(\n f\"{caller}: could not find match for {pattern}\")\n\n\nself.caller = caller\n self.pattern = pattern", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 488, "extracted_code_full": "# Source: pytubefix/exceptions.py\nclass RegexMatchError(ExtractError):\n \"\"\"Regex pattern did not return any matches.\"\"\"\n\n def __init__(self, caller: str, pattern: Union[str, Pattern]):\n \"\"\"\n :param str caller:\n Calling function\n :param str pattern:\n Pattern that failed to match\n \"\"\"\n super().__init__(\n f\"{caller}: could not find match for {pattern}\")\n\n\n self.caller = caller\n self.pattern = pattern", "n_chars_compressed": 480, "compression_ratio": 0.9836065573770492}, "tests/test_exceptions.py::76": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/__init__.py", "pytubefix/helpers.py"], "used_names": ["YouTube", "exceptions", "mock", "pytest"], "enclosing_function": "test_raises_video_private", "extracted_code": "# Source: pytubefix/exceptions.py\n\"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/__init__.py\n# noreorder\n\"\"\"\nPytubefix: a very serious Python library for downloading YouTube Videos.\n\"\"\"\n__title__ = \"pytubefix\"\n__author__ = \"Juan Bindez\"\n__license__ = \"MIT License\"\n__js__ = None\n__js_url__ = None\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\n\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer\n\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1530, "extracted_code_full": "# Source: pytubefix/exceptions.py\n \"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/__init__.py\n# noreorder\n\"\"\"\nPytubefix: a very serious Python library for downloading YouTube Videos.\n\"\"\"\n__title__ = \"pytubefix\"\n__author__ = \"Juan Bindez\"\n__license__ = \"MIT License\"\n__js__ = None\n__js_url__ = None\n\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\n\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer\n\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 1526, "compression_ratio": 0.9973856209150327}, "tests/test_streams.py::388": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py"], "used_names": ["HTTPError", "mock", "pytest"], "enclosing_function": "test_segmented_only_catches_404", "extracted_code": "", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_captions.py::110": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/captions.py"], "used_names": ["Caption", "MagicMock", "captions", "mock", "mock_open", "os", "patch"], "enclosing_function": "test_download_with_output_path", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 974, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 974, "compression_ratio": 1.0}, "tests/test_exceptions.py::32": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/__init__.py", "pytubefix/helpers.py"], "used_names": ["exceptions", "pytest", "strip_color_codes"], "enclosing_function": "test_live_stream_error", "extracted_code": "# Source: pytubefix/exceptions.py\n\"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 707, "extracted_code_full": "# Source: pytubefix/exceptions.py\n \"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_chars_compressed": 703, "compression_ratio": 0.9943422913719944}, "tests/contrib/test_channel.py::14": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Channel", "mock"], "enclosing_function": "test_init_with_url", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 286, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 286, "compression_ratio": 1.0}, "tests/test_parser.py::45": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/parser.py"], "used_names": ["parse_for_object"], "enclosing_function": "test_parse_context_closer_in_string_value", "extracted_code": "# Source: pytubefix/parser.py\ndef parse_for_object(html, preceding_regex):\n \"\"\"Parses input html to find the end of a JavaScript object.\n\n :param str html:\n HTML to be parsed for an object.\n :param str preceding_regex:\n Regex to find the string preceding the object.\n :rtype dict:\n :returns:\n A dict created from parsing the object.\n \"\"\"\n regex = re.compile(preceding_regex)\n result = regex.search(html)\n if not result:\n raise HTMLParseError(f'No matches for regex {preceding_regex}')\n\n start_index = result.end()\n return parse_for_object_from_startpoint(html, start_index)", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 634, "extracted_code_full": "# Source: pytubefix/parser.py\ndef parse_for_object(html, preceding_regex):\n \"\"\"Parses input html to find the end of a JavaScript object.\n\n :param str html:\n HTML to be parsed for an object.\n :param str preceding_regex:\n Regex to find the string preceding the object.\n :rtype dict:\n :returns:\n A dict created from parsing the object.\n \"\"\"\n regex = re.compile(preceding_regex)\n result = regex.search(html)\n if not result:\n raise HTMLParseError(f'No matches for regex {preceding_regex}')\n\n start_index = result.end()\n return parse_for_object_from_startpoint(html, start_index)", "n_chars_compressed": 634, "compression_ratio": 1.0}, "tests/test_metadata.py::13": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/extract.py"], "used_names": ["extract"], "enclosing_function": "test_metadata_from_initial_data", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_cipher.py::18": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/cipher.py", "pytubefix/exceptions.py"], "used_names": ["cipher"], "enclosing_function": "test_js_splice", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/contrib/test_playlist.py::304": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Playlist", "mock"], "enclosing_function": "test_playlist_owner", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 325, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 325, "compression_ratio": 1.0}, "tests/test_query.py::53": {"resolved_imports": [], "used_names": [], "enclosing_function": "test_get_first", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_main.py::56": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/exceptions.py"], "used_names": [], "enclosing_function": "test_channel_id", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_exceptions.py::21": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/__init__.py", "pytubefix/helpers.py"], "used_names": ["exceptions", "strip_color_codes"], "enclosing_function": "test_regex_match_error", "extracted_code": "# Source: pytubefix/exceptions.py\n\"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 707, "extracted_code_full": "# Source: pytubefix/exceptions.py\n \"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_chars_compressed": 703, "compression_ratio": 0.9943422913719944}, "tests/test_cli.py::40": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/cli.py", "pytubefix/exceptions.py"], "used_names": ["cli", "mock", "patch", "pytest"], "enclosing_function": "test_download_when_itag_not_found", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_streams.py::380": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py"], "used_names": ["HTTPError", "Mock", "mock"], "enclosing_function": "test_segmented_stream_on_404", "extracted_code": "", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_exceptions.py::54": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/__init__.py", "pytubefix/helpers.py"], "used_names": ["exceptions", "pytest", "strip_color_codes"], "enclosing_function": "test_private_error", "extracted_code": "# Source: pytubefix/exceptions.py\n\"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 707, "extracted_code_full": "# Source: pytubefix/exceptions.py\n \"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_chars_compressed": 703, "compression_ratio": 0.9943422913719944}, "tests/test_captions.py::109": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/captions.py"], "used_names": ["Caption", "MagicMock", "captions", "mock", "mock_open", "os", "patch"], "enclosing_function": "test_download_with_output_path", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 974, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 974, "compression_ratio": 1.0}, "tests/test_cli.py::41": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/cli.py", "pytubefix/exceptions.py"], "used_names": ["cli", "mock", "patch", "pytest"], "enclosing_function": "test_download_when_itag_not_found", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_exceptions.py::64": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/__init__.py", "pytubefix/helpers.py"], "used_names": ["exceptions", "pytest", "strip_color_codes"], "enclosing_function": "test_region_locked_error", "extracted_code": "# Source: pytubefix/exceptions.py\n\"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 707, "extracted_code_full": "# Source: pytubefix/exceptions.py\n \"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_chars_compressed": 703, "compression_ratio": 0.9943422913719944}, "tests/test_streams.py::31": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py"], "used_names": [], "enclosing_function": "test_filesize", "extracted_code": "", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/contrib/test_playlist.py::85": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Playlist", "mock"], "enclosing_function": "test_html", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 325, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 325, "compression_ratio": 1.0}, "tests/test_query.py::148": {"resolved_imports": [], "used_names": [], "enclosing_function": "test_get_by_itag", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_streams.py::27": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py"], "used_names": ["MagicMock", "mock", "os"], "enclosing_function": "test_stream_to_buffer", "extracted_code": "", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/contrib/test_channel.py::42": {"resolved_imports": ["pytubefix/__init__.py"], "used_names": ["Channel", "mock"], "enclosing_function": "test_channel_id", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 286, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 286, "compression_ratio": 1.0}, "tests/test_helpers.py::15": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/helpers.py", "pytubefix/exceptions.py"], "used_names": ["RegexMatchError", "helpers", "pytest"], "enclosing_function": "test_regex_search_no_match", "extracted_code": "# Source: pytubefix/exceptions.py\nclass RegexMatchError(ExtractError):\n \"\"\"Regex pattern did not return any matches.\"\"\"\n\n def __init__(self, caller: str, pattern: Union[str, Pattern]):\n \"\"\"\n :param str caller:\n Calling function\n :param str pattern:\n Pattern that failed to match\n \"\"\"\n super().__init__(\n f\"{caller}: could not find match for {pattern}\")\n\n\nself.caller = caller\n self.pattern = pattern", "n_imports_parsed": 10, "n_files_resolved": 3, "n_chars_extracted": 488, "extracted_code_full": "# Source: pytubefix/exceptions.py\nclass RegexMatchError(ExtractError):\n \"\"\"Regex pattern did not return any matches.\"\"\"\n\n def __init__(self, caller: str, pattern: Union[str, Pattern]):\n \"\"\"\n :param str caller:\n Calling function\n :param str pattern:\n Pattern that failed to match\n \"\"\"\n super().__init__(\n f\"{caller}: could not find match for {pattern}\")\n\n\n self.caller = caller\n self.pattern = pattern", "n_chars_compressed": 480, "compression_ratio": 0.9836065573770492}, "tests/test_query.py::39": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_empty", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_metadata.py::14": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/extract.py"], "used_names": ["extract"], "enclosing_function": "test_metadata_from_initial_data", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_request.py::48": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py", "pytubefix/exceptions.py"], "used_names": ["mock", "request"], "enclosing_function": "test_headers", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_helpers.py::26": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/helpers.py", "pytubefix/exceptions.py"], "used_names": ["helpers"], "enclosing_function": "test_safe_filename", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/test_parser.py::36": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/parser.py"], "used_names": ["parse_for_object"], "enclosing_function": "test_parse_simple_object", "extracted_code": "# Source: pytubefix/parser.py\ndef parse_for_object(html, preceding_regex):\n \"\"\"Parses input html to find the end of a JavaScript object.\n\n :param str html:\n HTML to be parsed for an object.\n :param str preceding_regex:\n Regex to find the string preceding the object.\n :rtype dict:\n :returns:\n A dict created from parsing the object.\n \"\"\"\n regex = re.compile(preceding_regex)\n result = regex.search(html)\n if not result:\n raise HTMLParseError(f'No matches for regex {preceding_regex}')\n\n start_index = result.end()\n return parse_for_object_from_startpoint(html, start_index)", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 634, "extracted_code_full": "# Source: pytubefix/parser.py\ndef parse_for_object(html, preceding_regex):\n \"\"\"Parses input html to find the end of a JavaScript object.\n\n :param str html:\n HTML to be parsed for an object.\n :param str preceding_regex:\n Regex to find the string preceding the object.\n :rtype dict:\n :returns:\n A dict created from parsing the object.\n \"\"\"\n regex = re.compile(preceding_regex)\n result = regex.search(html)\n if not result:\n raise HTMLParseError(f'No matches for regex {preceding_regex}')\n\n start_index = result.end()\n return parse_for_object_from_startpoint(html, start_index)", "n_chars_compressed": 634, "compression_ratio": 1.0}, "tests/test_exceptions.py::53": {"resolved_imports": ["pytubefix/exceptions.py", "pytubefix/__init__.py", "pytubefix/helpers.py"], "used_names": ["exceptions", "pytest", "strip_color_codes"], "enclosing_function": "test_private_error", "extracted_code": "# Source: pytubefix/exceptions.py\n\"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 707, "extracted_code_full": "# Source: pytubefix/exceptions.py\n \"\"\"Base pytubefix exception that all others inherit.\n\n This is done to not pollute the built-in exceptions, which *could* result\n in unintended errors being unexpectedly and incorrectly handled within\n implementers code.\n \"\"\"\n### MISC Errors ###\n\nclass MaxRetriesExceeded(PytubeFixError):\n \"\"\"Maximum number of retries exceeded.\"\"\"\n def __init__(self):\n super().__init__(\"Maximum number of retries exceeded\")\n\n\n# Source: pytubefix/helpers.py\ndef strip_color_codes(input_str):\n \"\"\"Remove ANSI color codes from a colored string\"\"\"\n ansi_escape = re.compile(r'\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')\n return ansi_escape.sub('', input_str)", "n_chars_compressed": 703, "compression_ratio": 0.9943422913719944}, "tests/test_streams.py::114": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/request.py"], "used_names": [], "enclosing_function": "test_rating", "extracted_code": "", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_captions.py::139": {"resolved_imports": ["pytubefix/__init__.py", "pytubefix/captions.py"], "used_names": ["Caption", "CaptionQuery"], "enclosing_function": "test_repr", "extracted_code": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 974, "extracted_code_full": "# Source: pytubefix/__init__.py\nfrom pytubefix.version import __version__\nfrom pytubefix.streams import Stream\nfrom pytubefix.captions import Caption\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\n\nfrom pytubefix.chapters import Chapter\nfrom pytubefix.keymoments import KeyMoment\nfrom pytubefix.query import CaptionQuery, StreamQuery\nfrom pytubefix.__main__ import YouTube\nfrom pytubefix.async_youtube import AsyncYouTube\nfrom pytubefix.contrib.playlist import Playlist\nfrom pytubefix.contrib.channel import Channel\nfrom pytubefix.contrib.search import Search\nfrom pytubefix.info import info\nfrom pytubefix.buffer import Buffer", "n_chars_compressed": 974, "compression_ratio": 1.0}}} \ No newline at end of file