nanigock commited on
Commit
cd15502
·
verified ·
1 Parent(s): c36b9d3

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +5 -0
  2. oracle_context_cache/0xricksanchez__like-dbg.json +0 -0
  3. oracle_context_cache/15r10nk__inline-snapshot.json +0 -0
  4. oracle_context_cache/AlignmentResearch__tuned-lens.json +0 -0
  5. oracle_context_cache/AndrewAnnex__SpiceyPy.json +1 -0
  6. oracle_context_cache/AnonymouX47__term-image.json +0 -0
  7. oracle_context_cache/Azure-Samples__rag-postgres-openai-python.json +1 -0
  8. oracle_context_cache/BayesWitnesses__m2cgen.json +1 -0
  9. oracle_context_cache/BoboTiG__python-mss.json +0 -0
  10. oracle_context_cache/BrainBlend-AI__atomic-agents.json +0 -0
  11. oracle_context_cache/CalebBell__fluids.json +0 -0
  12. oracle_context_cache/Chen-zexi__vllm-cli.json +0 -0
  13. oracle_context_cache/Cloxl__xhshow.json +0 -0
  14. oracle_context_cache/Cranot__roam-code.json +0 -0
  15. oracle_context_cache/CursorTouch__Windows-MCP.json +0 -0
  16. oracle_context_cache/DHI__terracotta.json +0 -0
  17. oracle_context_cache/DLR-RM__stable-baselines3.json +0 -0
  18. oracle_context_cache/DebarghaG__proofofthought.json +0 -0
  19. oracle_context_cache/DeepLcom__deepl-python.json +1 -0
  20. oracle_context_cache/Delgan__loguru.json +0 -0
  21. oracle_context_cache/DenisCarriere__geocoder.json +0 -0
  22. oracle_context_cache/DisnakeDev__disnake.json +0 -0
  23. oracle_context_cache/DonDebonair__slack-machine.json +0 -0
  24. oracle_context_cache/Donkie__Spoolman.json +1 -0
  25. oracle_context_cache/EbodShojaei__bake.json +0 -0
  26. oracle_context_cache/Filimoa__open-parse.json +0 -0
  27. oracle_context_cache/FinanceData__FinanceDataReader.json +1 -0
  28. oracle_context_cache/Forethought-Technologies__AutoChain.json +0 -0
  29. oracle_context_cache/GitGuardian__ggshield.json +0 -0
  30. oracle_context_cache/IDSIA__sacred.json +0 -0
  31. oracle_context_cache/JWock82__Pynite.json +0 -0
  32. oracle_context_cache/JoshuaC215__agent-service-toolkit.json +0 -0
  33. oracle_context_cache/JuanBindez__pytubefix.json +1 -0
  34. oracle_context_cache/Kludex__mangum.json +1 -0
  35. oracle_context_cache/Lancetnik__Propan.json +0 -0
  36. oracle_context_cache/LonamiWebs__Telethon.json +0 -0
  37. oracle_context_cache/LuteOrg__lute-v3.json +0 -0
  38. oracle_context_cache/Lux-Luna__LunaVox.json +0 -0
  39. oracle_context_cache/MarshalX__atproto.json +0 -0
  40. oracle_context_cache/MartenBE__mkslides.json +1 -0
  41. oracle_context_cache/MasoniteFramework__masonite.json +0 -0
  42. oracle_context_cache/MaxHalford__prince.json +1 -0
  43. oracle_context_cache/Mayitzin__ahrs.json +1 -0
  44. oracle_context_cache/MerrimanInd__drawpyo.json +0 -0
  45. oracle_context_cache/MiniMax-AI__Mini-Agent.json +0 -0
  46. oracle_context_cache/MinishLab__model2vec.json +0 -0
  47. oracle_context_cache/MinishLab__semhash.json +1 -0
  48. oracle_context_cache/MolecularAI__aizynthfinder.json +0 -0
  49. oracle_context_cache/MongoEngine__mongoengine.json +0 -0
  50. oracle_context_cache/MrPowers__chispa.json +1 -0
.gitattributes CHANGED
@@ -75,3 +75,8 @@ splits/expanded/cr_val.json filter=lfs diff=lfs merge=lfs -text
75
  splits/expanded/cr_val_structured.json filter=lfs diff=lfs merge=lfs -text
76
  splits/expanded/ir_test.json filter=lfs diff=lfs merge=lfs -text
77
  splits/expanded/ir_val.json filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
75
  splits/expanded/cr_val_structured.json filter=lfs diff=lfs merge=lfs -text
76
  splits/expanded/ir_test.json filter=lfs diff=lfs merge=lfs -text
77
  splits/expanded/ir_val.json filter=lfs diff=lfs merge=lfs -text
78
+ oracle_context_cache/benavlabs__fastcrud.json filter=lfs diff=lfs merge=lfs -text
79
+ oracle_context_cache/dbos-inc__dbos-transact-py.json filter=lfs diff=lfs merge=lfs -text
80
+ oracle_context_cache/hdwallet-io__python-hdwallet.json filter=lfs diff=lfs merge=lfs -text
81
+ oracle_context_cache/oraios__serena.json filter=lfs diff=lfs merge=lfs -text
82
+ oracle_context_cache/sammchardy__python-binance.json filter=lfs diff=lfs merge=lfs -text
oracle_context_cache/0xricksanchez__like-dbg.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/15r10nk__inline-snapshot.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/AlignmentResearch__tuned-lens.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/AndrewAnnex__SpiceyPy.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"repo": "AndrewAnnex/SpiceyPy", "n_pairs": 42, "version": "v2_function_scoped", "contexts": {"src/spiceypy/benchmarks/test_cyice.py::618": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py"], "used_names": ["cyice", "pytest"], "enclosing_function": "test_getelm", "extracted_code": "# Source: src/spiceypy/cyice/__init__.py\n\"\"\"\n\nfrom .cyice import *", "n_imports_parsed": 10, "n_files_resolved": 2, "n_chars_extracted": 66}, "src/spiceypy/tests/gettestkernels.py::202": {"resolved_imports": [], "used_names": ["error", "hashlib", "request", "time", "urllib"], "enclosing_function": "attempt_download", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 0, "n_chars_extracted": 0}, "src/spiceypy/tests/test_context_manager.py::113": {"resolved_imports": ["src/spiceypy/__init__.py"], "used_names": ["CoreKernels", "pytest"], "enclosing_function": "test_unload_if_error", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "src/spiceypy/tests/test_context_manager.py::71": {"resolved_imports": ["src/spiceypy/__init__.py"], "used_names": ["CoreKernels", "pytest"], "enclosing_function": "test_side_effect", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "src/spiceypy/tests/test_spiceerrors.py::150": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py", "src/spiceypy/found_catcher.py"], "used_names": [], "enclosing_function": "test_error_to_str", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 3, "n_chars_extracted": 0}, "src/spiceypy/tests/test_spiceerrors.py::41": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py", "src/spiceypy/found_catcher.py"], "used_names": [], "enclosing_function": "test_geterror", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 3, "n_chars_extracted": 0}, "src/spiceypy/tests/test_wrapper.py::332": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/utils/callbacks.py", "src/spiceypy/utils/support_types.py"], "used_names": ["CoreKernels", "testing"], "enclosing_function": "test_bodvcd", "extracted_code": "", "n_imports_parsed": 11, "n_files_resolved": 3, "n_chars_extracted": 0}, "src/spiceypy/tests/test_context_manager.py::32": {"resolved_imports": ["src/spiceypy/__init__.py"], "used_names": ["CoreKernels", "pytest"], "enclosing_function": "test_input_types", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "src/spiceypy/tests/test_support_types.py::183": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/utils/support_types.py"], "used_names": ["array", "pytest"], "enclosing_function": "test_to_double_matrix", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 2, "n_chars_extracted": 0}, "src/spiceypy/benchmarks/test_cyice.py::398": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py"], "used_names": ["cyice", "pytest", "time"], "enclosing_function": "test_et2lst", "extracted_code": "# Source: src/spiceypy/cyice/__init__.py\n\"\"\"\n\nfrom .cyice import *", "n_imports_parsed": 10, "n_files_resolved": 2, "n_chars_extracted": 66}, "src/spiceypy/benchmarks/test_cyice.py::549": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py"], "used_names": ["cyice", "pytest"], "enclosing_function": "test_fovray_v", "extracted_code": "# Source: src/spiceypy/cyice/__init__.py\n\"\"\"\n\nfrom .cyice import *", "n_imports_parsed": 10, "n_files_resolved": 2, "n_chars_extracted": 66}, "src/spiceypy/tests/test_support_types.py::84": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/utils/support_types.py"], "used_names": [], "enclosing_function": "test_spicecell_len0", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 2, "n_chars_extracted": 0}, "src/spiceypy/tests/test_spiceerrors.py::120": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py", "src/spiceypy/found_catcher.py"], "used_names": ["CoreKernels", "ExtraKernels", "cyice", "pytest", "spiceypy"], "enclosing_function": "test_no_loaded_files_exception", "extracted_code": "# Source: src/spiceypy/__init__.py\n__version__ = \"8.0.2\"\n\nfrom .spiceypy import *\nfrom .utils import support_types\nfrom .utils import exceptions\n\n# Default setting for error reporting so that programs don't just exit out!\nerract(\"set\", 10, \"return\")\nerrdev(\"set\", 10, \"null\")\n\n\n# Source: src/spiceypy/cyice/__init__.py\n\"\"\"\n\nfrom .cyice import *", "n_imports_parsed": 6, "n_files_resolved": 3, "n_chars_extracted": 344}, "src/spiceypy/benchmarks/test_cyice.py::400": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py"], "used_names": ["cyice", "pytest", "time"], "enclosing_function": "test_et2lst", "extracted_code": "# Source: src/spiceypy/cyice/__init__.py\n\"\"\"\n\nfrom .cyice import *", "n_imports_parsed": 10, "n_files_resolved": 2, "n_chars_extracted": 66}, "src/spiceypy/benchmarks/test_cyice.py::981": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py"], "used_names": ["cyice", "pytest"], "enclosing_function": "test_occult", "extracted_code": "# Source: src/spiceypy/cyice/__init__.py\n\"\"\"\n\nfrom .cyice import *", "n_imports_parsed": 10, "n_files_resolved": 2, "n_chars_extracted": 66}, "src/spiceypy/benchmarks/test_cyice.py::901": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py"], "used_names": ["ExtraKernels", "cyice", "pytest"], "enclosing_function": "test_limbpt", "extracted_code": "# Source: src/spiceypy/cyice/__init__.py\n\"\"\"\n\nfrom .cyice import *", "n_imports_parsed": 10, "n_files_resolved": 2, "n_chars_extracted": 66}, "src/spiceypy/tests/test_support_types.py::102": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/utils/support_types.py"], "used_names": [], "enclosing_function": "test_spicecell_equality", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 2, "n_chars_extracted": 0}, "src/spiceypy/tests/test_spiceerrors.py::56": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py", "src/spiceypy/found_catcher.py"], "used_names": ["cwd", "os", "pytest"], "enclosing_function": "test_get_spiceypy_exceptions", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 3, "n_chars_extracted": 0}, "src/spiceypy/tests/test_support_types.py::65": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/utils/support_types.py"], "used_names": ["pytest"], "enclosing_function": "test_SpiceCell", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 2, "n_chars_extracted": 0}, "src/spiceypy/tests/test_context_manager.py::109": {"resolved_imports": ["src/spiceypy/__init__.py"], "used_names": ["CoreKernels", "pytest"], "enclosing_function": "test_unload_if_error", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "src/spiceypy/tests/test_support_types.py::103": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/utils/support_types.py"], "used_names": [], "enclosing_function": "test_spicecell_equality", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 2, "n_chars_extracted": 0}, "src/spiceypy/tests/test_context_manager.py::125": {"resolved_imports": ["src/spiceypy/__init__.py"], "used_names": ["CoreKernels"], "enclosing_function": "test_actually_works", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "src/spiceypy/benchmarks/test_cyice.py::512": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py"], "used_names": ["ExtraKernels", "cyice", "pytest"], "enclosing_function": "test_evsgp4_v", "extracted_code": "# Source: src/spiceypy/cyice/__init__.py\n\"\"\"\n\nfrom .cyice import *", "n_imports_parsed": 10, "n_files_resolved": 2, "n_chars_extracted": 66}, "src/spiceypy/benchmarks/test_cyice.py::419": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py"], "used_names": ["cyice", "pytest", "time"], "enclosing_function": "test_et2lst_v", "extracted_code": "# Source: src/spiceypy/cyice/__init__.py\n\"\"\"\n\nfrom .cyice import *", "n_imports_parsed": 10, "n_files_resolved": 2, "n_chars_extracted": 66}, "src/spiceypy/benchmarks/test_cyice.py::1982": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py"], "used_names": ["cyice", "pytest"], "enclosing_function": "test_spkpvn_v", "extracted_code": "# Source: src/spiceypy/cyice/__init__.py\n\"\"\"\n\nfrom .cyice import *", "n_imports_parsed": 10, "n_files_resolved": 2, "n_chars_extracted": 66}, "src/spiceypy/tests/test_wrapper.py::405": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/utils/callbacks.py", "src/spiceypy/utils/support_types.py"], "used_names": [], "enclosing_function": "test_bsrchd", "extracted_code": "", "n_imports_parsed": 11, "n_files_resolved": 3, "n_chars_extracted": 0}, "src/spiceypy/benchmarks/test_cyice.py::480": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py"], "used_names": ["ExtraKernels", "cyice", "pytest"], "enclosing_function": "test_evsgp4", "extracted_code": "# Source: src/spiceypy/cyice/__init__.py\n\"\"\"\n\nfrom .cyice import *", "n_imports_parsed": 10, "n_files_resolved": 2, "n_chars_extracted": 66}, "src/spiceypy/tests/test_spiceerrors.py::34": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py", "src/spiceypy/found_catcher.py"], "used_names": [], "enclosing_function": "test_tkversion", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 3, "n_chars_extracted": 0}, "src/spiceypy/tests/test_spiceerrors.py::101": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py", "src/spiceypy/found_catcher.py"], "used_names": ["CoreKernels", "ExtraKernels", "cyice", "pytest", "spiceypy"], "enclosing_function": "test_no_loaded_files_exception", "extracted_code": "# Source: src/spiceypy/__init__.py\n__version__ = \"8.0.2\"\n\nfrom .spiceypy import *\nfrom .utils import support_types\nfrom .utils import exceptions\n\n# Default setting for error reporting so that programs don't just exit out!\nerract(\"set\", 10, \"return\")\nerrdev(\"set\", 10, \"null\")\n\n\n# Source: src/spiceypy/cyice/__init__.py\n\"\"\"\n\nfrom .cyice import *", "n_imports_parsed": 6, "n_files_resolved": 3, "n_chars_extracted": 344}, "src/spiceypy/tests/test_wrapper.py::364": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/utils/callbacks.py", "src/spiceypy/utils/support_types.py"], "used_names": [], "enclosing_function": "test_bschoc", "extracted_code": "", "n_imports_parsed": 11, "n_files_resolved": 3, "n_chars_extracted": 0}, "src/spiceypy/tests/test_wrapper.py::353": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/utils/callbacks.py", "src/spiceypy/utils/support_types.py"], "used_names": [], "enclosing_function": "test_brckti", "extracted_code": "", "n_imports_parsed": 11, "n_files_resolved": 3, "n_chars_extracted": 0}, "src/spiceypy/tests/test_wrapper.py::365": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/utils/callbacks.py", "src/spiceypy/utils/support_types.py"], "used_names": [], "enclosing_function": "test_bschoc", "extracted_code": "", "n_imports_parsed": 11, "n_files_resolved": 3, "n_chars_extracted": 0}, "src/spiceypy/tests/test_spiceerrors.py::135": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py", "src/spiceypy/found_catcher.py"], "used_names": ["pytest"], "enclosing_function": "test_found_error_checker", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 3, "n_chars_extracted": 0}, "src/spiceypy/tests/test_context_manager.py::69": {"resolved_imports": ["src/spiceypy/__init__.py"], "used_names": ["CoreKernels", "pytest"], "enclosing_function": "test_side_effect", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "src/spiceypy/tests/test_logging.py::51": {"resolved_imports": [], "used_names": ["subprocess", "sys"], "enclosing_function": "test_import_default_does_not_emit_info", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "src/spiceypy/tests/test_context_manager.py::85": {"resolved_imports": ["src/spiceypy/__init__.py"], "used_names": ["CoreKernels", "pytest"], "enclosing_function": "test_invalid_input", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "src/spiceypy/tests/test_spiceerrors.py::91": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py", "src/spiceypy/found_catcher.py"], "used_names": ["CoreKernels", "ExtraKernels", "cyice", "pytest", "spiceypy"], "enclosing_function": "test_no_loaded_files_exception", "extracted_code": "# Source: src/spiceypy/__init__.py\n__version__ = \"8.0.2\"\n\nfrom .spiceypy import *\nfrom .utils import support_types\nfrom .utils import exceptions\n\n# Default setting for error reporting so that programs don't just exit out!\nerract(\"set\", 10, \"return\")\nerrdev(\"set\", 10, \"null\")\n\n\n# Source: src/spiceypy/cyice/__init__.py\n\"\"\"\n\nfrom .cyice import *", "n_imports_parsed": 6, "n_files_resolved": 3, "n_chars_extracted": 344}, "src/spiceypy/tests/test_context_manager.py::30": {"resolved_imports": ["src/spiceypy/__init__.py"], "used_names": ["CoreKernels", "pytest"], "enclosing_function": "test_input_types", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "src/spiceypy/tests/test_gettestkernels.py::34": {"resolved_imports": [], "used_names": ["CoreKernels", "attempt_download", "pytest"], "enclosing_function": "test_gettestkernels", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "src/spiceypy/benchmarks/test_cyice.py::1120": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py"], "used_names": ["cyice", "pytest"], "enclosing_function": "test_pi", "extracted_code": "# Source: src/spiceypy/cyice/__init__.py\n\"\"\"\n\nfrom .cyice import *", "n_imports_parsed": 10, "n_files_resolved": 2, "n_chars_extracted": 66}, "src/spiceypy/tests/test_spiceerrors.py::42": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py", "src/spiceypy/found_catcher.py"], "used_names": [], "enclosing_function": "test_geterror", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 3, "n_chars_extracted": 0}, "src/spiceypy/benchmarks/test_cyice.py::399": {"resolved_imports": ["src/spiceypy/__init__.py", "src/spiceypy/cyice/__init__.py"], "used_names": ["cyice", "pytest", "time"], "enclosing_function": "test_et2lst", "extracted_code": "# Source: src/spiceypy/cyice/__init__.py\n\"\"\"\n\nfrom .cyice import *", "n_imports_parsed": 10, "n_files_resolved": 2, "n_chars_extracted": 66}}}
oracle_context_cache/AnonymouX47__term-image.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/Azure-Samples__rag-postgres-openai-python.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"repo": "Azure-Samples/rag-postgres-openai-python", "n_pairs": 51, "version": "v2_function_scoped", "contexts": {"tests/test_openai_clients.py::65": {"resolved_imports": [], "used_names": ["common_parameters", "pytest"], "enclosing_function": "test_github_models_with_custom_values", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_frontend_routes.py::31": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_favicon", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_openai_clients.py::66": {"resolved_imports": [], "used_names": ["common_parameters", "pytest"], "enclosing_function": "test_github_models_with_custom_values", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_openai_clients.py::39": {"resolved_imports": [], "used_names": ["common_parameters", "create_openai_chat_client", "create_openai_embed_client", "pytest"], "enclosing_function": "test_github_models_configuration", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_api_routes.py::66": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_similar_handler_422", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_openai_clients.py::40": {"resolved_imports": [], "used_names": ["common_parameters", "create_openai_chat_client", "create_openai_embed_client", "pytest"], "enclosing_function": "test_github_models_configuration", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_postgres_engine.py::24": {"resolved_imports": [], "used_names": ["create_postgres_engine", "os", "pytest"], "enclosing_function": "test_create_postgres_engine", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_api_routes.py::213": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_chat_non_json_422", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_openai_clients.py::49": {"resolved_imports": [], "used_names": ["common_parameters", "create_openai_chat_client", "create_openai_embed_client", "pytest"], "enclosing_function": "test_github_models_configuration", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_postgres_searcher.py::8": {"resolved_imports": [], "used_names": [], "enclosing_function": "test_postgres_build_filter_clause_without_filters", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/e2e.py::111": {"resolved_imports": [], "used_names": ["Route"], "enclosing_function": "handle", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_postgres_searcher.py::36": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_postgres_searcher_search_empty_text_search", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/e2e.py::114": {"resolved_imports": [], "used_names": ["Route"], "enclosing_function": "handle", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_postgres_engine.py::26": {"resolved_imports": [], "used_names": ["create_postgres_engine", "os", "pytest"], "enclosing_function": "test_create_postgres_engine", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_postgres_engine.py::27": {"resolved_imports": [], "used_names": ["create_postgres_engine", "os", "pytest"], "enclosing_function": "test_create_postgres_engine", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_frontend_routes.py::40": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_assets_non_existent_404", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_api_routes.py::14": {"resolved_imports": [], "used_names": ["json", "pytest", "test_data"], "enclosing_function": "test_item_handler", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_postgres_engine.py::23": {"resolved_imports": [], "used_names": ["create_postgres_engine", "os", "pytest"], "enclosing_function": "test_create_postgres_engine", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/e2e.py::65": {"resolved_imports": [], "used_names": ["Route"], "enclosing_function": "handle", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_openai_clients.py::15": {"resolved_imports": [], "used_names": ["create_openai_embed_client", "pytest", "test_data"], "enclosing_function": "test_create_openai_embed_client", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_postgres_searcher.py::24": {"resolved_imports": [], "used_names": ["Filter"], "enclosing_function": "test_postgres_build_filter_clause_with_filters_numeric", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_frontend_routes.py::41": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_assets_non_existent_404", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/e2e.py::113": {"resolved_imports": [], "used_names": ["Route"], "enclosing_function": "handle", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_api_routes.py::105": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_search_handler_422", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_api_routes.py::64": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_similar_handler_422", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_frontend_routes.py::16": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_index", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_openai_clients.py::25": {"resolved_imports": [], "used_names": ["create_openai_chat_client", "pytest"], "enclosing_function": "test_create_openai_chat_client", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_frontend_routes.py::58": {"resolved_imports": [], "used_names": ["os", "pytest"], "enclosing_function": "test_assets", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_postgres_searcher.py::13": {"resolved_imports": [], "used_names": ["Filter"], "enclosing_function": "test_postgres_build_filter_clause_with_filters", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_frontend_routes.py::15": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_index", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_dependencies.py::9": {"resolved_imports": [], "used_names": ["common_parameters", "pytest"], "enclosing_function": "test_get_common_parameters", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_dependencies.py::20": {"resolved_imports": [], "used_names": ["common_parameters", "pytest"], "enclosing_function": "test_get_common_parameters_ollama", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_api_routes.py::16": {"resolved_imports": [], "used_names": ["json", "pytest", "test_data"], "enclosing_function": "test_item_handler", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_postgres_engine.py::25": {"resolved_imports": [], "used_names": ["create_postgres_engine", "os", "pytest"], "enclosing_function": "test_create_postgres_engine", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_api_routes.py::30": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_item_handler_404", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_dependencies.py::11": {"resolved_imports": [], "used_names": ["common_parameters", "pytest"], "enclosing_function": "test_get_common_parameters", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_dependencies.py::40": {"resolved_imports": [], "used_names": ["get_azure_credential", "pytest"], "enclosing_function": "test_get_azure_credential", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_dependencies.py::19": {"resolved_imports": [], "used_names": ["common_parameters", "pytest"], "enclosing_function": "test_get_common_parameters_ollama", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_postgres_searcher.py::41": {"resolved_imports": [], "used_names": ["ItemPublic", "pytest", "test_data"], "enclosing_function": "test_postgres_searcher_search", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_openai_clients.py::11": {"resolved_imports": [], "used_names": ["create_openai_embed_client", "pytest", "test_data"], "enclosing_function": "test_create_openai_embed_client", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_frontend_routes.py::17": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_index", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_dependencies.py::21": {"resolved_imports": [], "used_names": ["common_parameters", "pytest"], "enclosing_function": "test_get_common_parameters_ollama", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_embeddings.py::17": {"resolved_imports": [], "used_names": ["compute_text_embedding", "create_openai_embed_client", "pytest", "test_data"], "enclosing_function": "test_compute_text_embedding", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_openai_clients.py::50": {"resolved_imports": [], "used_names": ["common_parameters", "create_openai_chat_client", "create_openai_embed_client", "pytest"], "enclosing_function": "test_github_models_configuration", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_dependencies.py::29": {"resolved_imports": [], "used_names": ["common_parameters", "pytest"], "enclosing_function": "test_get_common_parameters_openai", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_frontend_routes.py::42": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_assets_non_existent_404", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_dependencies.py::41": {"resolved_imports": [], "used_names": ["get_azure_credential", "pytest"], "enclosing_function": "test_get_azure_credential", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_dependencies.py::10": {"resolved_imports": [], "used_names": ["common_parameters", "pytest"], "enclosing_function": "test_get_common_parameters", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_api_routes.py::32": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_item_handler_404", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_frontend_routes.py::18": {"resolved_imports": [], "used_names": ["pytest"], "enclosing_function": "test_index", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/e2e.py::112": {"resolved_imports": [], "used_names": ["Route"], "enclosing_function": "handle", "extracted_code": "", "n_imports_parsed": 10, "n_files_resolved": 0, "n_chars_extracted": 0}}}
oracle_context_cache/BayesWitnesses__m2cgen.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"repo": "BayesWitnesses/m2cgen", "n_pairs": 58, "version": "v2_function_scoped", "contexts": {"tests/test_ast.py::10": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py"], "used_names": ["ast", "pytest"], "enclosing_function": "test_count_exprs", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_ast.py::14": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py"], "used_names": ["ast", "pytest"], "enclosing_function": "test_count_exprs", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_ast.py::18": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py"], "used_names": ["ast", "pytest"], "enclosing_function": "test_count_exprs", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_ast.py::25": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py"], "used_names": ["ast", "pytest"], "enclosing_function": "test_count_exprs", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_ast.py::33": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py"], "used_names": ["ast", "pytest"], "enclosing_function": "test_count_exprs", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_ast.py::40": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py"], "used_names": ["ast"], "enclosing_function": "test_count_exprs_exclude_list", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_ast.py::91": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py"], "used_names": ["ast"], "enclosing_function": "test_count_all_exprs_types", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_ast.py::129": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py"], "used_names": ["ast"], "enclosing_function": "test_num_val", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_ast.py::128": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py"], "used_names": ["ast"], "enclosing_function": "test_num_val", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_ast.py::96": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py"], "used_names": ["deepcopy"], "enclosing_function": "test_exprs_equality", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_ast.py::125": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py"], "used_names": ["ast"], "enclosing_function": "test_num_val", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_ast.py::126": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py"], "used_names": ["ast"], "enclosing_function": "test_num_val", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_ast.py::101": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py"], "used_names": ["deepcopy"], "enclosing_function": "test_exprs_hash", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_cli.py::72": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/cli.py"], "used_names": ["cli", "io", "mock", "sys"], "enclosing_function": "test_language_is_required", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_cli.py::45": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/cli.py"], "used_names": ["cli", "io"], "enclosing_function": "test_file_as_input", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_cli.py::43": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/cli.py"], "used_names": ["cli", "io"], "enclosing_function": "test_file_as_input", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_cli.py::61": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/cli.py"], "used_names": ["capture", "cli"], "enclosing_function": "test_stdin_as_input", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_cli.py::96": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/cli.py"], "used_names": ["cli"], "enclosing_function": "test_function_name_csharp_default", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_cli.py::153": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/cli.py"], "used_names": ["__version__", "cli", "io", "mock", "sys"], "enclosing_function": "test_version", "extracted_code": "# Source: m2cgen/__init__.py\n__version__ = (Path(__file__).absolute().parent / \"VERSION.txt\").read_text(encoding=\"utf-8\").strip()", "n_imports_parsed": 6, "n_files_resolved": 2, "n_chars_extracted": 129}, "tests/test_cli.py::71": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/cli.py"], "used_names": ["cli", "io", "mock", "sys"], "enclosing_function": "test_language_is_required", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_fallback_expressions.py::45": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["CInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_abs_fallback_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.c.interpreter import CInterpreter\nfrom m2cgen.interpreters.c_sharp.interpreter import CSharpInterpreter\nfrom m2cgen.interpreters.dart.interpreter import DartInterpreter\nfrom m2cgen.interpreters.elixir.interpreter import ElixirInterpreter\nfrom m2cgen.interpreters.f_sharp.interpreter import FSharpInterpreter\nfrom m2cgen.interpreters.go.interpreter import GoInterpreter\nfrom m2cgen.interpreters.haskell.interpreter import HaskellInterpreter\nfrom m2cgen.interpreters.java.interpreter import JavaInterpreter\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\n\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n VisualBasicInterpreter,\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,", "n_imports_parsed": 4, "n_files_resolved": 3, "n_chars_extracted": 981}, "tests/test_fallback_expressions.py::17": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["PythonInterpreter", "ast", "pytest"], "enclosing_function": "test_required_funs_without_fallbacks", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n VisualBasicInterpreter,\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,", "n_imports_parsed": 4, "n_files_resolved": 3, "n_chars_extracted": 852}, "tests/test_fallback_expressions.py::21": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["PythonInterpreter", "ast", "pytest"], "enclosing_function": "test_required_funs_without_fallbacks", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n VisualBasicInterpreter,\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,", "n_imports_parsed": 4, "n_files_resolved": 3, "n_chars_extracted": 852}, "tests/utils.py::216": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/assemblers/__init__.py", "m2cgen/interpreters/utils.py"], "used_names": [], "enclosing_function": "assert_code_equal", "extracted_code": "", "n_imports_parsed": 25, "n_files_resolved": 4, "n_chars_extracted": 0}, "tests/utils.py::188": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/assemblers/__init__.py", "m2cgen/interpreters/utils.py"], "used_names": ["ast"], "enclosing_function": "cmp_exprs", "extracted_code": "", "n_imports_parsed": 25, "n_files_resolved": 4, "n_chars_extracted": 0}, "tests/assemblers/test_boosting_lightgbm.py::276": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/assemblers/__init__.py"], "used_names": ["LightGBMModelAssembler", "pytest"], "enclosing_function": "test_unknown_output_transform", "extracted_code": "# Source: m2cgen/assemblers/__init__.py\nfrom m2cgen.assemblers.boosting import (\n LightGBMModelAssembler,\n XGBoostLinearModelAssembler,\n XGBoostModelAssemblerSelector,\n XGBoostTreeModelAssembler\n)\nfrom m2cgen.assemblers.ensemble import RandomForestModelAssembler\nfrom m2cgen.assemblers.linear import (\n ProcessMLEModelAssembler,\n SklearnGLMModelAssembler,\n SklearnLinearModelAssembler,\n\n XGBoostTreeModelAssembler,\n XGBoostLinearModelAssembler,\n LightGBMModelAssembler,\n SklearnSVMModelAssembler,\n LightningSVMModelAssembler,\n StatsmodelsGLMModelAssembler,\n StatsmodelsModelAssemblerSelector,\n SklearnGLMModelAssembler,\n]\n\n\nSUPPORTED_MODELS = {\n\nSUPPORTED_MODELS = {\n # LightGBM\n \"lightgbm_LGBMClassifier\": LightGBMModelAssembler,\n \"lightgbm_LGBMRegressor\": LightGBMModelAssembler,\n\n # XGBoost\n \"xgboost_XGBClassifier\": XGBoostModelAssemblerSelector,\n \"xgboost_XGBRFClassifier\": XGBoostModelAssemblerSelector,\n \"xgboost_XGBRegressor\": XGBoostModelAssemblerSelector,\n \"xgboost_XGBRFRegressor\": XGBoostModelAssemblerSelector,\n\n # Sklearn SVM\n\n # LightGBM\n \"lightgbm_LGBMClassifier\": LightGBMModelAssembler,\n \"lightgbm_LGBMRegressor\": LightGBMModelAssembler,\n\n # XGBoost\n \"xgboost_XGBClassifier\": XGBoostModelAssemblerSelector,\n \"xgboost_XGBRFClassifier\": XGBoostModelAssemblerSelector,\n \"xgboost_XGBRegressor\": XGBoostModelAssemblerSelector,\n \"xgboost_XGBRFRegressor\": XGBoostModelAssemblerSelector,\n\n # Sklearn SVM\n \"sklearn_LinearSVC\": SklearnLinearModelAssembler,", "n_imports_parsed": 6, "n_files_resolved": 3, "n_chars_extracted": 1566}, "tests/assemblers/test_linear_sklearn.py::178": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/assemblers/__init__.py", "m2cgen/ast.py"], "used_names": ["assemblers", "linear_model", "pytest"], "enclosing_function": "test_glm_unknown_link_func", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/assemblers/test_linear_statsmodels.py::159": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/assemblers/__init__.py", "m2cgen/ast.py"], "used_names": ["assemblers", "pytest", "utils"], "enclosing_function": "test_unknown_constant_position", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/assemblers/test_linear_statsmodels.py::171": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/assemblers/__init__.py", "m2cgen/ast.py"], "used_names": ["assemblers", "pytest", "utils"], "enclosing_function": "test_unknown_model", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/assemblers/test_linear_statsmodels.py::593": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/assemblers/__init__.py", "m2cgen/ast.py"], "used_names": ["assemblers", "pytest", "utils"], "enclosing_function": "test_glm_unknown_link_func", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/assemblers/test_meta.py::38": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/assemblers/__init__.py"], "used_names": ["DummyRegressor", "RANSACModelAssembler", "RANSACRegressor", "pytest"], "enclosing_function": "test_ransac_unknown_base_estimator", "extracted_code": "# Source: m2cgen/assemblers/__init__.py\n StatsmodelsModelAssemblerSelector\n)\nfrom m2cgen.assemblers.meta import RANSACModelAssembler\nfrom m2cgen.assemblers.svm import LightningSVMModelAssembler, SklearnSVMModelAssembler\nfrom m2cgen.assemblers.tree import TreeModelAssembler\n\n__all__ = [\n SklearnLinearModelAssembler,\n StatsmodelsLinearModelAssembler,\n ProcessMLEModelAssembler,\n RANSACModelAssembler,\n TreeModelAssembler,\n\n StatsmodelsLinearModelAssembler,\n ProcessMLEModelAssembler,\n RANSACModelAssembler,\n TreeModelAssembler,\n RandomForestModelAssembler,\n XGBoostModelAssemblerSelector,\n XGBoostTreeModelAssembler,\n XGBoostLinearModelAssembler,\n LightGBMModelAssembler,\n SklearnSVMModelAssembler,\n LightningSVMModelAssembler,\n StatsmodelsGLMModelAssembler,\n\n \"sklearn_PassiveAggressiveRegressor\": SklearnLinearModelAssembler,\n \"sklearn_PoissonRegressor\": SklearnGLMModelAssembler,\n \"sklearn_RANSACRegressor\": RANSACModelAssembler,\n \"sklearn_Ridge\": SklearnLinearModelAssembler,\n \"sklearn_RidgeCV\": SklearnLinearModelAssembler,\n \"sklearn_SGDRegressor\": SklearnLinearModelAssembler,\n \"sklearn_TheilSenRegressor\": SklearnLinearModelAssembler,\n \"sklearn_TweedieRegressor\": SklearnGLMModelAssembler,\n\n # Statsmodels Linear Regressors\n \"statsmodels_GLMResultsWrapper\": StatsmodelsGLMModelAssembler,\n \"statsmodels_ProcessMLEResults\": ProcessMLEModelAssembler,", "n_imports_parsed": 7, "n_files_resolved": 3, "n_chars_extracted": 1441}, "tests/assemblers/test_svm_lightning.py::30": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/assemblers/__init__.py"], "used_names": ["KernelSVC", "LightningSVMModelAssembler", "cmp_exprs", "utils"], "enclosing_function": "test_norm_in_cosine_kernel", "extracted_code": "# Source: m2cgen/assemblers/__init__.py\n)\nfrom m2cgen.assemblers.meta import RANSACModelAssembler\nfrom m2cgen.assemblers.svm import LightningSVMModelAssembler, SklearnSVMModelAssembler\nfrom m2cgen.assemblers.tree import TreeModelAssembler\n\n__all__ = [\n SklearnLinearModelAssembler,\n StatsmodelsLinearModelAssembler,\n ProcessMLEModelAssembler,\n RANSACModelAssembler,\n TreeModelAssembler,\n RandomForestModelAssembler,\n\n LightGBMModelAssembler,\n SklearnSVMModelAssembler,\n LightningSVMModelAssembler,\n StatsmodelsGLMModelAssembler,\n StatsmodelsModelAssemblerSelector,\n SklearnGLMModelAssembler,\n]\n\n\nSUPPORTED_MODELS = {\n # LightGBM\n \"lightgbm_LGBMClassifier\": LightGBMModelAssembler,\n\n\n # Lightning SVM\n \"lightning_KernelSVC\": LightningSVMModelAssembler,\n \"lightning_LinearSVC\": SklearnLinearModelAssembler,\n \"lightning_LinearSVR\": SklearnLinearModelAssembler,\n\n # Sklearn Linear Regressors\n \"sklearn_ARDRegression\": SklearnLinearModelAssembler,\n \"sklearn_BayesianRidge\": SklearnLinearModelAssembler,\n \"sklearn_ElasticNet\": SklearnLinearModelAssembler,\n \"sklearn_ElasticNetCV\": SklearnLinearModelAssembler,\n \"sklearn_GammaRegressor\": SklearnGLMModelAssembler,", "n_imports_parsed": 6, "n_files_resolved": 3, "n_chars_extracted": 1228}, "tests/assemblers/test_svm_sklearn.py::109": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/assemblers/__init__.py"], "used_names": ["SVC", "SklearnSVMModelAssembler", "pytest"], "enclosing_function": "test_unknown_kernel", "extracted_code": "# Source: m2cgen/assemblers/__init__.py\n)\nfrom m2cgen.assemblers.meta import RANSACModelAssembler\nfrom m2cgen.assemblers.svm import LightningSVMModelAssembler, SklearnSVMModelAssembler\nfrom m2cgen.assemblers.tree import TreeModelAssembler\n\n__all__ = [\n SklearnLinearModelAssembler,\n StatsmodelsLinearModelAssembler,\n ProcessMLEModelAssembler,\n RANSACModelAssembler,\n TreeModelAssembler,\n RandomForestModelAssembler,\n\n XGBoostLinearModelAssembler,\n LightGBMModelAssembler,\n SklearnSVMModelAssembler,\n LightningSVMModelAssembler,\n StatsmodelsGLMModelAssembler,\n StatsmodelsModelAssemblerSelector,\n SklearnGLMModelAssembler,\n]\n\n\nSUPPORTED_MODELS = {\n # LightGBM\n\n \"sklearn_LinearSVC\": SklearnLinearModelAssembler,\n \"sklearn_LinearSVR\": SklearnLinearModelAssembler,\n \"sklearn_NuSVC\": SklearnSVMModelAssembler,\n \"sklearn_NuSVR\": SklearnSVMModelAssembler,\n \"sklearn_OneClassSVM\": SklearnSVMModelAssembler,\n \"sklearn_SVC\": SklearnSVMModelAssembler,\n \"sklearn_SVR\": SklearnSVMModelAssembler,\n\n # Lightning SVM\n \"lightning_KernelSVC\": LightningSVMModelAssembler,\n \"lightning_LinearSVC\": SklearnLinearModelAssembler,\n \"lightning_LinearSVR\": SklearnLinearModelAssembler,\n\n \"sklearn_LinearSVR\": SklearnLinearModelAssembler,\n \"sklearn_NuSVC\": SklearnSVMModelAssembler,\n \"sklearn_NuSVR\": SklearnSVMModelAssembler,\n \"sklearn_OneClassSVM\": SklearnSVMModelAssembler,\n \"sklearn_SVC\": SklearnSVMModelAssembler,\n \"sklearn_SVR\": SklearnSVMModelAssembler,\n\n # Lightning SVM\n \"lightning_KernelSVC\": LightningSVMModelAssembler,\n \"lightning_LinearSVC\": SklearnLinearModelAssembler,\n \"lightning_LinearSVR\": SklearnLinearModelAssembler,\n\n\n \"sklearn_NuSVC\": SklearnSVMModelAssembler,\n \"sklearn_NuSVR\": SklearnSVMModelAssembler,\n \"sklearn_OneClassSVM\": SklearnSVMModelAssembler,\n \"sklearn_SVC\": SklearnSVMModelAssembler,\n \"sklearn_SVR\": SklearnSVMModelAssembler,\n\n # Lightning SVM\n \"lightning_KernelSVC\": LightningSVMModelAssembler,\n \"lightning_LinearSVC\": SklearnLinearModelAssembler,\n \"lightning_LinearSVR\": SklearnLinearModelAssembler,\n\n # Sklearn Linear Regressors", "n_imports_parsed": 7, "n_files_resolved": 3, "n_chars_extracted": 2174}, "tests/interpreters/test_c.py::30": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["CInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_if_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.c.interpreter import CInterpreter\nfrom m2cgen.interpreters.c_sharp.interpreter import CSharpInterpreter\nfrom m2cgen.interpreters.dart.interpreter import DartInterpreter\nfrom m2cgen.interpreters.elixir.interpreter import ElixirInterpreter\nfrom m2cgen.interpreters.f_sharp.interpreter import FSharpInterpreter\nfrom m2cgen.interpreters.go.interpreter import GoInterpreter\nfrom m2cgen.interpreters.haskell.interpreter import HaskellInterpreter\nfrom m2cgen.interpreters.java.interpreter import JavaInterpreter\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\n\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n VisualBasicInterpreter,\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 981}, "tests/interpreters/test_c.py::90": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["CInterpreter", "assert_code_equal", "ast", "product", "pytest"], "enclosing_function": "test_associativity_in_bin_num_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.c.interpreter import CInterpreter\nfrom m2cgen.interpreters.c_sharp.interpreter import CSharpInterpreter\nfrom m2cgen.interpreters.dart.interpreter import DartInterpreter\nfrom m2cgen.interpreters.elixir.interpreter import ElixirInterpreter\nfrom m2cgen.interpreters.f_sharp.interpreter import FSharpInterpreter\nfrom m2cgen.interpreters.go.interpreter import GoInterpreter\nfrom m2cgen.interpreters.haskell.interpreter import HaskellInterpreter\nfrom m2cgen.interpreters.java.interpreter import JavaInterpreter\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\n\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n VisualBasicInterpreter,\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 981}, "tests/interpreters/test_c_sharp.py::34": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["CSharpInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_if_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.c.interpreter import CInterpreter\nfrom m2cgen.interpreters.c_sharp.interpreter import CSharpInterpreter\nfrom m2cgen.interpreters.dart.interpreter import DartInterpreter\nfrom m2cgen.interpreters.elixir.interpreter import ElixirInterpreter\nfrom m2cgen.interpreters.f_sharp.interpreter import FSharpInterpreter\nfrom m2cgen.interpreters.go.interpreter import GoInterpreter\nfrom m2cgen.interpreters.haskell.interpreter import HaskellInterpreter\nfrom m2cgen.interpreters.java.interpreter import JavaInterpreter\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\n\n JavascriptInterpreter,\n VisualBasicInterpreter,\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,\n RubyInterpreter,\n FSharpInterpreter,\n RustInterpreter,\n ElixirInterpreter,", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1065}, "tests/interpreters/test_dart.py::30": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["DartInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_if_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.c.interpreter import CInterpreter\nfrom m2cgen.interpreters.c_sharp.interpreter import CSharpInterpreter\nfrom m2cgen.interpreters.dart.interpreter import DartInterpreter\nfrom m2cgen.interpreters.elixir.interpreter import ElixirInterpreter\nfrom m2cgen.interpreters.f_sharp.interpreter import FSharpInterpreter\nfrom m2cgen.interpreters.go.interpreter import GoInterpreter\nfrom m2cgen.interpreters.haskell.interpreter import HaskellInterpreter\nfrom m2cgen.interpreters.java.interpreter import JavaInterpreter\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\n\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,\n RubyInterpreter,\n FSharpInterpreter,\n RustInterpreter,\n ElixirInterpreter,\n]", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1031}, "tests/interpreters/test_elixir.py::42": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["ElixirInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_if_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.c_sharp.interpreter import CSharpInterpreter\nfrom m2cgen.interpreters.dart.interpreter import DartInterpreter\nfrom m2cgen.interpreters.elixir.interpreter import ElixirInterpreter\nfrom m2cgen.interpreters.f_sharp.interpreter import FSharpInterpreter\nfrom m2cgen.interpreters.go.interpreter import GoInterpreter\nfrom m2cgen.interpreters.haskell.interpreter import HaskellInterpreter\nfrom m2cgen.interpreters.java.interpreter import JavaInterpreter\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\n\n FSharpInterpreter,\n RustInterpreter,\n ElixirInterpreter,\n]", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 927}, "tests/interpreters/test_f_sharp.py::28": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["FSharpInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_if_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.dart.interpreter import DartInterpreter\nfrom m2cgen.interpreters.elixir.interpreter import ElixirInterpreter\nfrom m2cgen.interpreters.f_sharp.interpreter import FSharpInterpreter\nfrom m2cgen.interpreters.go.interpreter import GoInterpreter\nfrom m2cgen.interpreters.haskell.interpreter import HaskellInterpreter\nfrom m2cgen.interpreters.java.interpreter import JavaInterpreter\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\n\n HaskellInterpreter,\n RubyInterpreter,\n FSharpInterpreter,\n RustInterpreter,\n ElixirInterpreter,\n]", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 967}, "tests/interpreters/test_go.py::30": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["GoInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_if_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.elixir.interpreter import ElixirInterpreter\nfrom m2cgen.interpreters.f_sharp.interpreter import FSharpInterpreter\nfrom m2cgen.interpreters.go.interpreter import GoInterpreter\nfrom m2cgen.interpreters.haskell.interpreter import HaskellInterpreter\nfrom m2cgen.interpreters.java.interpreter import JavaInterpreter\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\n\n PythonInterpreter,\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n VisualBasicInterpreter,\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,\n RubyInterpreter,", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1122}, "tests/interpreters/test_go.py::90": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["GoInterpreter", "assert_code_equal", "ast", "product", "pytest"], "enclosing_function": "test_associativity_in_bin_num_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.elixir.interpreter import ElixirInterpreter\nfrom m2cgen.interpreters.f_sharp.interpreter import FSharpInterpreter\nfrom m2cgen.interpreters.go.interpreter import GoInterpreter\nfrom m2cgen.interpreters.haskell.interpreter import HaskellInterpreter\nfrom m2cgen.interpreters.java.interpreter import JavaInterpreter\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\n\n PythonInterpreter,\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n VisualBasicInterpreter,\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,\n RubyInterpreter,", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1122}, "tests/interpreters/test_haskell.py::31": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["HaskellInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_if_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.f_sharp.interpreter import FSharpInterpreter\nfrom m2cgen.interpreters.go.interpreter import GoInterpreter\nfrom m2cgen.interpreters.haskell.interpreter import HaskellInterpreter\nfrom m2cgen.interpreters.java.interpreter import JavaInterpreter\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,\n RubyInterpreter,\n FSharpInterpreter,\n RustInterpreter,\n ElixirInterpreter,\n]", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1019}, "tests/interpreters/test_haskell.py::94": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["HaskellInterpreter", "assert_code_equal", "ast", "product", "pytest"], "enclosing_function": "test_associativity_in_bin_num_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.f_sharp.interpreter import FSharpInterpreter\nfrom m2cgen.interpreters.go.interpreter import GoInterpreter\nfrom m2cgen.interpreters.haskell.interpreter import HaskellInterpreter\nfrom m2cgen.interpreters.java.interpreter import JavaInterpreter\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,\n RubyInterpreter,\n FSharpInterpreter,\n RustInterpreter,\n ElixirInterpreter,\n]", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1019}, "tests/interpreters/test_java.py::32": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["JavaInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_if_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.go.interpreter import GoInterpreter\nfrom m2cgen.interpreters.haskell.interpreter import HaskellInterpreter\nfrom m2cgen.interpreters.java.interpreter import JavaInterpreter\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n VisualBasicInterpreter,\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1032}, "tests/interpreters/test_javascript.py::30": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["JavascriptInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_if_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.haskell.interpreter import HaskellInterpreter\nfrom m2cgen.interpreters.java.interpreter import JavaInterpreter\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n__all__ = [\n\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n VisualBasicInterpreter,\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,\n RubyInterpreter,\n FSharpInterpreter,", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1015}, "tests/interpreters/test_javascript.py::90": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["JavascriptInterpreter", "assert_code_equal", "ast", "product", "pytest"], "enclosing_function": "test_associativity_in_bin_num_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.haskell.interpreter import HaskellInterpreter\nfrom m2cgen.interpreters.java.interpreter import JavaInterpreter\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n__all__ = [\n\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n VisualBasicInterpreter,\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,\n RubyInterpreter,\n FSharpInterpreter,", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1015}, "tests/interpreters/test_php.py::31": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["PhpInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_if_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.java.interpreter import JavaInterpreter\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n__all__ = [\n JavaInterpreter,\n\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,\n RubyInterpreter,\n FSharpInterpreter,\n RustInterpreter,\n ElixirInterpreter,\n]", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 896}, "tests/interpreters/test_php.py::94": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["PhpInterpreter", "assert_code_equal", "ast", "product", "pytest"], "enclosing_function": "test_associativity_in_bin_num_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.java.interpreter import JavaInterpreter\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n__all__ = [\n JavaInterpreter,\n\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,\n RubyInterpreter,\n FSharpInterpreter,\n RustInterpreter,\n ElixirInterpreter,\n]", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 896}, "tests/interpreters/test_powershell.py::30": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["PowershellInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_if_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n\n VisualBasicInterpreter,\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,\n RubyInterpreter,\n FSharpInterpreter,\n RustInterpreter,\n ElixirInterpreter,\n]", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 905}, "tests/interpreters/test_powershell.py::90": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["PowershellInterpreter", "assert_code_equal", "ast", "product", "pytest"], "enclosing_function": "test_associativity_in_bin_num_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.javascript.interpreter import JavascriptInterpreter\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n\n VisualBasicInterpreter,\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,\n RubyInterpreter,\n FSharpInterpreter,\n RustInterpreter,\n ElixirInterpreter,\n]", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 905}, "tests/interpreters/test_python.py::382": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["PythonInterpreter", "ast"], "enclosing_function": "test_deep_expression", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n VisualBasicInterpreter,\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 852}, "tests/interpreters/test_python.py::27": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["PythonInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_if_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.php.interpreter import PhpInterpreter\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n VisualBasicInterpreter,\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 852}, "tests/interpreters/test_r.py::29": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["RInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_if_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.powershell.interpreter import PowershellInterpreter\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n GoInterpreter,\n\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,\n RubyInterpreter,\n FSharpInterpreter,\n RustInterpreter,\n ElixirInterpreter,\n]", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 774}, "tests/interpreters/test_ruby.py::29": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["RubyInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_if_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n\n DartInterpreter,\n HaskellInterpreter,\n RubyInterpreter,\n FSharpInterpreter,\n RustInterpreter,\n ElixirInterpreter,\n]", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 636}, "tests/interpreters/test_ruby.py::103": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["RubyInterpreter", "assert_code_equal", "ast", "product", "pytest"], "enclosing_function": "test_associativity_in_bin_num_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.python.interpreter import PythonInterpreter\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n\n DartInterpreter,\n HaskellInterpreter,\n RubyInterpreter,\n FSharpInterpreter,\n RustInterpreter,\n ElixirInterpreter,\n]", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 636}, "tests/interpreters/test_rust.py::30": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["RustInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_if_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n VisualBasicInterpreter,\n\n RubyInterpreter,\n FSharpInterpreter,\n RustInterpreter,\n ElixirInterpreter,\n]", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 550}, "tests/interpreters/test_rust.py::90": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["RustInterpreter", "assert_code_equal", "ast", "product", "pytest"], "enclosing_function": "test_associativity_in_bin_num_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.r.interpreter import RInterpreter\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n VisualBasicInterpreter,\n\n RubyInterpreter,\n FSharpInterpreter,\n RustInterpreter,\n ElixirInterpreter,\n]", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 550}, "tests/interpreters/test_visual_basic.py::32": {"resolved_imports": ["m2cgen/__init__.py", "m2cgen/ast.py", "m2cgen/interpreters/__init__.py"], "used_names": ["VisualBasicInterpreter", "assert_code_equal", "ast"], "enclosing_function": "test_if_expr", "extracted_code": "# Source: m2cgen/interpreters/__init__.py\nfrom m2cgen.interpreters.ruby.interpreter import RubyInterpreter\nfrom m2cgen.interpreters.rust.interpreter import RustInterpreter\nfrom m2cgen.interpreters.visual_basic.interpreter import VisualBasicInterpreter\n\n__all__ = [\n JavaInterpreter,\n PythonInterpreter,\n CInterpreter,\n GoInterpreter,\n JavascriptInterpreter,\n VisualBasicInterpreter,\n CSharpInterpreter,\n\n GoInterpreter,\n JavascriptInterpreter,\n VisualBasicInterpreter,\n CSharpInterpreter,\n PowershellInterpreter,\n RInterpreter,\n PhpInterpreter,\n DartInterpreter,\n HaskellInterpreter,\n RubyInterpreter,\n FSharpInterpreter,\n RustInterpreter,", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 696}}}
oracle_context_cache/BoboTiG__python-mss.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/BrainBlend-AI__atomic-agents.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/CalebBell__fluids.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/Chen-zexi__vllm-cli.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/Cloxl__xhshow.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/Cranot__roam-code.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/CursorTouch__Windows-MCP.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/DHI__terracotta.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/DLR-RM__stable-baselines3.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/DebarghaG__proofofthought.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/DeepLcom__deepl-python.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"repo": "DeepLcom/deepl-python", "n_pairs": 60, "version": "v2_function_scoped", "contexts": {"tests/test_cli.py::31": {"resolved_imports": ["deepl/__init__.py", "deepl/__main__.py"], "used_names": [], "enclosing_function": "test_help", "extracted_code": "", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_cli.py::60": {"resolved_imports": ["deepl/__init__.py", "deepl/__main__.py"], "used_names": [], "enclosing_function": "test_no_auth", "extracted_code": "", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_cli.py::106": {"resolved_imports": ["deepl/__init__.py", "deepl/__main__.py"], "used_names": [], "enclosing_function": "test_no_command", "extracted_code": "", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_general.py::113": {"resolved_imports": ["deepl/__init__.py"], "used_names": [], "enclosing_function": "test_glossary_languages", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_general.py::102": {"resolved_imports": ["deepl/__init__.py"], "used_names": [], "enclosing_function": "test_language", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_general.py::132": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "example_text", "os", "patch"], "enclosing_function": "test_user_agent", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 7, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_glossary.py::27": {"resolved_imports": ["deepl/__init__.py"], "used_names": [], "enclosing_function": "test_glossary_create", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_glossary.py::130": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "pytest"], "enclosing_function": "test_glossary_get_entries", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_glossary.py::202": {"resolved_imports": ["deepl/__init__.py"], "used_names": [], "enclosing_function": "test_glossary_translate_text_basic", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_glossary.py::208": {"resolved_imports": ["deepl/__init__.py"], "used_names": [], "enclosing_function": "test_glossary_translate_text_basic", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_glossary.py::23": {"resolved_imports": ["deepl/__init__.py"], "used_names": [], "enclosing_function": "test_glossary_create", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_glossary.py::24": {"resolved_imports": ["deepl/__init__.py"], "used_names": [], "enclosing_function": "test_glossary_create", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_glossary.py::178": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["needs_real_server"], "enclosing_function": "test_glossary_translate_text_sentence", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_glossary.py::69": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "pytest"], "enclosing_function": "test_glossary_create_invalid", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_glossary.py::91": {"resolved_imports": ["deepl/__init__.py"], "used_names": [], "enclosing_function": "test_glossary_create_large", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_glossary.py::22": {"resolved_imports": ["deepl/__init__.py"], "used_names": [], "enclosing_function": "test_glossary_create", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_glossary.py::30": {"resolved_imports": ["deepl/__init__.py"], "used_names": [], "enclosing_function": "test_glossary_create", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_multilingual_glossary.py::201": {"resolved_imports": ["deepl/__init__.py", "deepl/util.py", "deepl/api_data.py"], "used_names": ["util"], "enclosing_function": "test_glossary_create_csv", "extracted_code": "# Source: deepl/__init__.py\n)\n\nfrom .util import ( # noqa\n auth_key_is_free_account,\n convert_tsv_to_dict,\n convert_dict_to_tsv,\n validate_glossary_term,\n)\n\n__all__ = [\n \"__version__\",\n \"__author__\",", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 218}, "tests/test_multilingual_glossary.py::107": {"resolved_imports": ["deepl/__init__.py", "deepl/util.py", "deepl/api_data.py"], "used_names": ["MultilingualGlossaryDictionaryEntries"], "enclosing_function": "test_glossary_dictionary_update", "extracted_code": "# Source: deepl/api_data.py\nclass MultilingualGlossaryDictionaryEntries:\n def __init__(\n self,\n source_lang: str,\n target_lang: str,\n entries: Dict[str, str],\n ):\n self._source_lang = source_lang\n self._target_lang = target_lang\n self._entries = entries\n\n def __str__(self) -> str:\n return (\n \"MultilingualGlossaryDictionaryEntries: Source Language \"\n f\"{self._source_lang}, Target Language {self._target_lang} \"\n f\"Contents: {self._entries}\"\n )\n\n @staticmethod\n def from_json(json) -> \"MultilingualGlossaryDictionaryEntries\":\n \"\"\"Create MultilingualGlossaryDictionaryEntries from the given\n API JSON object.\n \"\"\"\n return MultilingualGlossaryDictionaryEntries(\n str(json[\"source_lang\"]),\n str(json[\"target_lang\"]),\n json[\"entries\"],\n )\n\n def to_json(self):\n \"\"\"Create API JSON object from\n MultilingualGlossaryDictionaryEntries\n \"\"\"\n return {\n \"source_lang\": self._source_lang,\n \"target_lang\": self._target_lang,\n \"entries\": self._entries,\n }\n\n @property\n def source_lang(self) -> str:\n return self._source_lang\n\n @property\n def target_lang(self) -> str:\n return self._target_lang\n\n @property\n def entries(self) -> Dict[str, str]:\n return self._entries", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1441}, "tests/test_multilingual_glossary.py::108": {"resolved_imports": ["deepl/__init__.py", "deepl/util.py", "deepl/api_data.py"], "used_names": ["MultilingualGlossaryDictionaryEntries"], "enclosing_function": "test_glossary_dictionary_update", "extracted_code": "# Source: deepl/api_data.py\nclass MultilingualGlossaryDictionaryEntries:\n def __init__(\n self,\n source_lang: str,\n target_lang: str,\n entries: Dict[str, str],\n ):\n self._source_lang = source_lang\n self._target_lang = target_lang\n self._entries = entries\n\n def __str__(self) -> str:\n return (\n \"MultilingualGlossaryDictionaryEntries: Source Language \"\n f\"{self._source_lang}, Target Language {self._target_lang} \"\n f\"Contents: {self._entries}\"\n )\n\n @staticmethod\n def from_json(json) -> \"MultilingualGlossaryDictionaryEntries\":\n \"\"\"Create MultilingualGlossaryDictionaryEntries from the given\n API JSON object.\n \"\"\"\n return MultilingualGlossaryDictionaryEntries(\n str(json[\"source_lang\"]),\n str(json[\"target_lang\"]),\n json[\"entries\"],\n )\n\n def to_json(self):\n \"\"\"Create API JSON object from\n MultilingualGlossaryDictionaryEntries\n \"\"\"\n return {\n \"source_lang\": self._source_lang,\n \"target_lang\": self._target_lang,\n \"entries\": self._entries,\n }\n\n @property\n def source_lang(self) -> str:\n return self._source_lang\n\n @property\n def target_lang(self) -> str:\n return self._target_lang\n\n @property\n def entries(self) -> Dict[str, str]:\n return self._entries", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1441}, "tests/test_multilingual_glossary.py::314": {"resolved_imports": ["deepl/__init__.py", "deepl/util.py", "deepl/api_data.py"], "used_names": ["MultilingualGlossaryDictionaryEntries", "deepl", "pytest", "util"], "enclosing_function": "test_glossary_get_entries", "extracted_code": "# Source: deepl/__init__.py\n)\n\nfrom .util import ( # noqa\n auth_key_is_free_account,\n convert_tsv_to_dict,\n convert_dict_to_tsv,\n validate_glossary_term,\n)\n\n__all__ = [\n \"__version__\",\n \"__author__\",\n\n\n# Source: deepl/api_data.py\nclass MultilingualGlossaryDictionaryEntries:\n def __init__(\n self,\n source_lang: str,\n target_lang: str,\n entries: Dict[str, str],\n ):\n self._source_lang = source_lang\n self._target_lang = target_lang\n self._entries = entries\n\n def __str__(self) -> str:\n return (\n \"MultilingualGlossaryDictionaryEntries: Source Language \"\n f\"{self._source_lang}, Target Language {self._target_lang} \"\n f\"Contents: {self._entries}\"\n )\n\n @staticmethod\n def from_json(json) -> \"MultilingualGlossaryDictionaryEntries\":\n \"\"\"Create MultilingualGlossaryDictionaryEntries from the given\n API JSON object.\n \"\"\"\n return MultilingualGlossaryDictionaryEntries(\n str(json[\"source_lang\"]),\n str(json[\"target_lang\"]),\n json[\"entries\"],\n )\n\n def to_json(self):\n \"\"\"Create API JSON object from\n MultilingualGlossaryDictionaryEntries\n \"\"\"\n return {\n \"source_lang\": self._source_lang,\n \"target_lang\": self._target_lang,\n \"entries\": self._entries,\n }\n\n @property\n def source_lang(self) -> str:\n return self._source_lang\n\n @property\n def target_lang(self) -> str:\n return self._target_lang\n\n @property\n def entries(self) -> Dict[str, str]:\n return self._entries", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1662}, "tests/test_multilingual_glossary.py::132": {"resolved_imports": ["deepl/__init__.py", "deepl/util.py", "deepl/api_data.py"], "used_names": ["MultilingualGlossaryDictionaryEntries", "pytest"], "enclosing_function": "test_glossary_name_update", "extracted_code": "# Source: deepl/api_data.py\nclass MultilingualGlossaryDictionaryEntries:\n def __init__(\n self,\n source_lang: str,\n target_lang: str,\n entries: Dict[str, str],\n ):\n self._source_lang = source_lang\n self._target_lang = target_lang\n self._entries = entries\n\n def __str__(self) -> str:\n return (\n \"MultilingualGlossaryDictionaryEntries: Source Language \"\n f\"{self._source_lang}, Target Language {self._target_lang} \"\n f\"Contents: {self._entries}\"\n )\n\n @staticmethod\n def from_json(json) -> \"MultilingualGlossaryDictionaryEntries\":\n \"\"\"Create MultilingualGlossaryDictionaryEntries from the given\n API JSON object.\n \"\"\"\n return MultilingualGlossaryDictionaryEntries(\n str(json[\"source_lang\"]),\n str(json[\"target_lang\"]),\n json[\"entries\"],\n )\n\n def to_json(self):\n \"\"\"Create API JSON object from\n MultilingualGlossaryDictionaryEntries\n \"\"\"\n return {\n \"source_lang\": self._source_lang,\n \"target_lang\": self._target_lang,\n \"entries\": self._entries,\n }\n\n @property\n def source_lang(self) -> str:\n return self._source_lang\n\n @property\n def target_lang(self) -> str:\n return self._target_lang\n\n @property\n def entries(self) -> Dict[str, str]:\n return self._entries", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1441}, "tests/test_multilingual_glossary.py::439": {"resolved_imports": ["deepl/__init__.py", "deepl/util.py", "deepl/api_data.py"], "used_names": ["MultilingualGlossaryDictionaryEntries"], "enclosing_function": "test_glossary_translate_text_basic", "extracted_code": "# Source: deepl/api_data.py\nclass MultilingualGlossaryDictionaryEntries:\n def __init__(\n self,\n source_lang: str,\n target_lang: str,\n entries: Dict[str, str],\n ):\n self._source_lang = source_lang\n self._target_lang = target_lang\n self._entries = entries\n\n def __str__(self) -> str:\n return (\n \"MultilingualGlossaryDictionaryEntries: Source Language \"\n f\"{self._source_lang}, Target Language {self._target_lang} \"\n f\"Contents: {self._entries}\"\n )\n\n @staticmethod\n def from_json(json) -> \"MultilingualGlossaryDictionaryEntries\":\n \"\"\"Create MultilingualGlossaryDictionaryEntries from the given\n API JSON object.\n \"\"\"\n return MultilingualGlossaryDictionaryEntries(\n str(json[\"source_lang\"]),\n str(json[\"target_lang\"]),\n json[\"entries\"],\n )\n\n def to_json(self):\n \"\"\"Create API JSON object from\n MultilingualGlossaryDictionaryEntries\n \"\"\"\n return {\n \"source_lang\": self._source_lang,\n \"target_lang\": self._target_lang,\n \"entries\": self._entries,\n }\n\n @property\n def source_lang(self) -> str:\n return self._source_lang\n\n @property\n def target_lang(self) -> str:\n return self._target_lang\n\n @property\n def entries(self) -> Dict[str, str]:\n return self._entries", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1441}, "tests/test_multilingual_glossary.py::140": {"resolved_imports": ["deepl/__init__.py", "deepl/util.py", "deepl/api_data.py"], "used_names": ["MultilingualGlossaryDictionaryEntries", "pytest"], "enclosing_function": "test_glossary_name_update", "extracted_code": "# Source: deepl/api_data.py\nclass MultilingualGlossaryDictionaryEntries:\n def __init__(\n self,\n source_lang: str,\n target_lang: str,\n entries: Dict[str, str],\n ):\n self._source_lang = source_lang\n self._target_lang = target_lang\n self._entries = entries\n\n def __str__(self) -> str:\n return (\n \"MultilingualGlossaryDictionaryEntries: Source Language \"\n f\"{self._source_lang}, Target Language {self._target_lang} \"\n f\"Contents: {self._entries}\"\n )\n\n @staticmethod\n def from_json(json) -> \"MultilingualGlossaryDictionaryEntries\":\n \"\"\"Create MultilingualGlossaryDictionaryEntries from the given\n API JSON object.\n \"\"\"\n return MultilingualGlossaryDictionaryEntries(\n str(json[\"source_lang\"]),\n str(json[\"target_lang\"]),\n json[\"entries\"],\n )\n\n def to_json(self):\n \"\"\"Create API JSON object from\n MultilingualGlossaryDictionaryEntries\n \"\"\"\n return {\n \"source_lang\": self._source_lang,\n \"target_lang\": self._target_lang,\n \"entries\": self._entries,\n }\n\n @property\n def source_lang(self) -> str:\n return self._source_lang\n\n @property\n def target_lang(self) -> str:\n return self._target_lang\n\n @property\n def entries(self) -> Dict[str, str]:\n return self._entries", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1441}, "tests/test_multilingual_glossary.py::205": {"resolved_imports": ["deepl/__init__.py", "deepl/util.py", "deepl/api_data.py"], "used_names": ["util"], "enclosing_function": "test_glossary_create_csv", "extracted_code": "# Source: deepl/__init__.py\n)\n\nfrom .util import ( # noqa\n auth_key_is_free_account,\n convert_tsv_to_dict,\n convert_dict_to_tsv,\n validate_glossary_term,\n)\n\n__all__ = [\n \"__version__\",\n \"__author__\",", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 218}, "tests/test_multilingual_glossary.py::206": {"resolved_imports": ["deepl/__init__.py", "deepl/util.py", "deepl/api_data.py"], "used_names": ["util"], "enclosing_function": "test_glossary_create_csv", "extracted_code": "# Source: deepl/__init__.py\n)\n\nfrom .util import ( # noqa\n auth_key_is_free_account,\n convert_tsv_to_dict,\n convert_dict_to_tsv,\n validate_glossary_term,\n)\n\n__all__ = [\n \"__version__\",\n \"__author__\",", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 218}, "tests/test_multilingual_glossary.py::416": {"resolved_imports": ["deepl/__init__.py", "deepl/util.py", "deepl/api_data.py"], "used_names": ["MultilingualGlossaryDictionaryEntries", "needs_real_server"], "enclosing_function": "test_glossary_translate_text_sentence", "extracted_code": "# Source: deepl/api_data.py\nclass MultilingualGlossaryDictionaryEntries:\n def __init__(\n self,\n source_lang: str,\n target_lang: str,\n entries: Dict[str, str],\n ):\n self._source_lang = source_lang\n self._target_lang = target_lang\n self._entries = entries\n\n def __str__(self) -> str:\n return (\n \"MultilingualGlossaryDictionaryEntries: Source Language \"\n f\"{self._source_lang}, Target Language {self._target_lang} \"\n f\"Contents: {self._entries}\"\n )\n\n @staticmethod\n def from_json(json) -> \"MultilingualGlossaryDictionaryEntries\":\n \"\"\"Create MultilingualGlossaryDictionaryEntries from the given\n API JSON object.\n \"\"\"\n return MultilingualGlossaryDictionaryEntries(\n str(json[\"source_lang\"]),\n str(json[\"target_lang\"]),\n json[\"entries\"],\n )\n\n def to_json(self):\n \"\"\"Create API JSON object from\n MultilingualGlossaryDictionaryEntries\n \"\"\"\n return {\n \"source_lang\": self._source_lang,\n \"target_lang\": self._target_lang,\n \"entries\": self._entries,\n }\n\n @property\n def source_lang(self) -> str:\n return self._source_lang\n\n @property\n def target_lang(self) -> str:\n return self._target_lang\n\n @property\n def entries(self) -> Dict[str, str]:\n return self._entries", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1441}, "tests/test_multilingual_glossary.py::171": {"resolved_imports": ["deepl/__init__.py", "deepl/util.py", "deepl/api_data.py"], "used_names": ["MultilingualGlossaryDictionaryEntries", "util"], "enclosing_function": "test_glossary_dictionary_replace", "extracted_code": "# Source: deepl/__init__.py\n)\n\nfrom .util import ( # noqa\n auth_key_is_free_account,\n convert_tsv_to_dict,\n convert_dict_to_tsv,\n validate_glossary_term,\n)\n\n__all__ = [\n \"__version__\",\n \"__author__\",\n\n\n# Source: deepl/api_data.py\nclass MultilingualGlossaryDictionaryEntries:\n def __init__(\n self,\n source_lang: str,\n target_lang: str,\n entries: Dict[str, str],\n ):\n self._source_lang = source_lang\n self._target_lang = target_lang\n self._entries = entries\n\n def __str__(self) -> str:\n return (\n \"MultilingualGlossaryDictionaryEntries: Source Language \"\n f\"{self._source_lang}, Target Language {self._target_lang} \"\n f\"Contents: {self._entries}\"\n )\n\n @staticmethod\n def from_json(json) -> \"MultilingualGlossaryDictionaryEntries\":\n \"\"\"Create MultilingualGlossaryDictionaryEntries from the given\n API JSON object.\n \"\"\"\n return MultilingualGlossaryDictionaryEntries(\n str(json[\"source_lang\"]),\n str(json[\"target_lang\"]),\n json[\"entries\"],\n )\n\n def to_json(self):\n \"\"\"Create API JSON object from\n MultilingualGlossaryDictionaryEntries\n \"\"\"\n return {\n \"source_lang\": self._source_lang,\n \"target_lang\": self._target_lang,\n \"entries\": self._entries,\n }\n\n @property\n def source_lang(self) -> str:\n return self._source_lang\n\n @property\n def target_lang(self) -> str:\n return self._target_lang\n\n @property\n def entries(self) -> Dict[str, str]:\n return self._entries", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1662}, "tests/test_multilingual_glossary.py::33": {"resolved_imports": ["deepl/__init__.py", "deepl/util.py", "deepl/api_data.py"], "used_names": ["MultilingualGlossaryDictionaryEntries"], "enclosing_function": "test_glossary_create", "extracted_code": "# Source: deepl/api_data.py\nclass MultilingualGlossaryDictionaryEntries:\n def __init__(\n self,\n source_lang: str,\n target_lang: str,\n entries: Dict[str, str],\n ):\n self._source_lang = source_lang\n self._target_lang = target_lang\n self._entries = entries\n\n def __str__(self) -> str:\n return (\n \"MultilingualGlossaryDictionaryEntries: Source Language \"\n f\"{self._source_lang}, Target Language {self._target_lang} \"\n f\"Contents: {self._entries}\"\n )\n\n @staticmethod\n def from_json(json) -> \"MultilingualGlossaryDictionaryEntries\":\n \"\"\"Create MultilingualGlossaryDictionaryEntries from the given\n API JSON object.\n \"\"\"\n return MultilingualGlossaryDictionaryEntries(\n str(json[\"source_lang\"]),\n str(json[\"target_lang\"]),\n json[\"entries\"],\n )\n\n def to_json(self):\n \"\"\"Create API JSON object from\n MultilingualGlossaryDictionaryEntries\n \"\"\"\n return {\n \"source_lang\": self._source_lang,\n \"target_lang\": self._target_lang,\n \"entries\": self._entries,\n }\n\n @property\n def source_lang(self) -> str:\n return self._source_lang\n\n @property\n def target_lang(self) -> str:\n return self._target_lang\n\n @property\n def entries(self) -> Dict[str, str]:\n return self._entries", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1441}, "tests/test_multilingual_glossary.py::51": {"resolved_imports": ["deepl/__init__.py", "deepl/util.py", "deepl/api_data.py"], "used_names": ["MultilingualGlossaryDictionaryEntries"], "enclosing_function": "test_glossary_create", "extracted_code": "# Source: deepl/api_data.py\nclass MultilingualGlossaryDictionaryEntries:\n def __init__(\n self,\n source_lang: str,\n target_lang: str,\n entries: Dict[str, str],\n ):\n self._source_lang = source_lang\n self._target_lang = target_lang\n self._entries = entries\n\n def __str__(self) -> str:\n return (\n \"MultilingualGlossaryDictionaryEntries: Source Language \"\n f\"{self._source_lang}, Target Language {self._target_lang} \"\n f\"Contents: {self._entries}\"\n )\n\n @staticmethod\n def from_json(json) -> \"MultilingualGlossaryDictionaryEntries\":\n \"\"\"Create MultilingualGlossaryDictionaryEntries from the given\n API JSON object.\n \"\"\"\n return MultilingualGlossaryDictionaryEntries(\n str(json[\"source_lang\"]),\n str(json[\"target_lang\"]),\n json[\"entries\"],\n )\n\n def to_json(self):\n \"\"\"Create API JSON object from\n MultilingualGlossaryDictionaryEntries\n \"\"\"\n return {\n \"source_lang\": self._source_lang,\n \"target_lang\": self._target_lang,\n \"entries\": self._entries,\n }\n\n @property\n def source_lang(self) -> str:\n return self._source_lang\n\n @property\n def target_lang(self) -> str:\n return self._target_lang\n\n @property\n def entries(self) -> Dict[str, str]:\n return self._entries", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 1441}, "tests/test_rephrase_text.py::31": {"resolved_imports": ["deepl/api_data.py"], "used_names": ["WriteResult"], "enclosing_function": "_check_sanity_of_improvements", "extracted_code": "# Source: deepl/api_data.py\nclass WriteResult:\n \"\"\"Holds the result of a text improvement request.\"\"\"\n\n def __init__(\n self, text: str, detected_source_language: str, target_language: str\n ):\n self.text = text\n self.detected_source_language = detected_source_language\n self.target_language = target_language\n\n def __str__(self):\n return self.text", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 393}, "tests/test_rephrase_text.py::34": {"resolved_imports": ["deepl/api_data.py"], "used_names": ["WriteResult"], "enclosing_function": "_check_sanity_of_improvements", "extracted_code": "# Source: deepl/api_data.py\nclass WriteResult:\n \"\"\"Holds the result of a text improvement request.\"\"\"\n\n def __init__(\n self, text: str, detected_source_language: str, target_language: str\n ):\n self.text = text\n self.detected_source_language = detected_source_language\n self.target_language = target_language\n\n def __str__(self):\n return self.text", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 393}, "tests/test_style_rules.py::15": {"resolved_imports": [], "used_names": ["needs_mock_server"], "enclosing_function": "test_get_all_style_rules", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_style_rules.py::18": {"resolved_imports": [], "used_names": ["needs_mock_server"], "enclosing_function": "test_get_all_style_rules", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_style_rules.py::20": {"resolved_imports": [], "used_names": ["needs_mock_server"], "enclosing_function": "test_get_all_style_rules", "extracted_code": "", "n_imports_parsed": 1, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/test_translate_document.py::318": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "example_text", "needs_mock_server", "time"], "enclosing_function": "test_translate_document_request_fields", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 7, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_translate_document.py::204": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "example_text", "pytest", "re"], "enclosing_function": "test_document_failure_during_translation", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 7, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_translate_document.py::186": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["example_text", "needs_mock_server"], "enclosing_function": "test_document_output_format", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_translate_document.py::203": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "example_text", "pytest", "re"], "enclosing_function": "test_document_failure_during_translation", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 7, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_translate_document.py::285": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["example_text", "time"], "enclosing_function": "test_translate_document_string", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_translate_document.py::28": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "example_text"], "enclosing_function": "test_translate_document_from_filepath", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 7, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_translate_document.py::261": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "needs_mock_server", "time"], "enclosing_function": "test_translate_document_low_level", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 7, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_translate_document.py::128": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["io", "needs_mock_server"], "enclosing_function": "test_translate_large_document", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_translate_document.py::27": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "example_text"], "enclosing_function": "test_translate_document_from_filepath", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 7, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_translate_document.py::29": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "example_text"], "enclosing_function": "test_translate_document_from_filepath", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 7, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_translate_text.py::432": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "needs_real_server"], "enclosing_function": "test_custom_instructions", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 5, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_translate_text.py::153": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["example_text", "needs_mock_server", "time"], "enclosing_function": "test_translate_with_retries", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_translate_text.py::28": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "example_text", "pytest"], "enclosing_function": "test_model_type", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 5, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_translate_text.py::433": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "needs_real_server"], "enclosing_function": "test_custom_instructions", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 5, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_translate_text.py::411": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "example_text"], "enclosing_function": "test_extra_body_params", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 5, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_translate_text.py::141": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_invalid_text", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_translate_text.py::14": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["example_text"], "enclosing_function": "test_single_text", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_translate_text.py::16": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["example_text"], "enclosing_function": "test_single_text", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_util.py::27": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "pytest"], "enclosing_function": "test_convert_dict_to_tsv", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_util.py::11": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "pytest"], "enclosing_function": "test_convert_tsv_to_dict", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_util.py::29": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "pytest"], "enclosing_function": "test_convert_dict_to_tsv", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_util.py::32": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "pytest"], "enclosing_function": "test_convert_dict_to_tsv", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_util.py::19": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "pytest"], "enclosing_function": "test_convert_tsv_to_dict", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_util.py::13": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "pytest"], "enclosing_function": "test_convert_tsv_to_dict", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 949}, "tests/test_util.py::16": {"resolved_imports": ["deepl/__init__.py"], "used_names": ["deepl", "pytest"], "enclosing_function": "test_convert_tsv_to_dict", "extracted_code": "# Source: deepl/__init__.py\n# Copyright 2022 DeepL SE (https://www.deepl.com)\n# Use of this source code is governed by an MIT\n# license that can be found in the LICENSE file.\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\n\nfrom .version import VERSION as __version__ # noqa\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n\n__author__ = \"DeepL SE <python-api@deepl.com>\"\n\nfrom .deepl_client import DeepLClient\n\nfrom .exceptions import ( # noqa\n AuthorizationException,\n ConnectionException,\n DeepLException,\n DocumentNotReadyException,\n DocumentTranslationException,\n GlossaryNotFoundException,\n TooManyRequestsException,", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 949}}}
oracle_context_cache/Delgan__loguru.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/DenisCarriere__geocoder.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/DisnakeDev__disnake.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/DonDebonair__slack-machine.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/Donkie__Spoolman.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"repo": "Donkie/Spoolman", "n_pairs": 115, "version": "v2_function_scoped", "contexts": {"tests_integration/tests/conftest.py::295": {"resolved_imports": [], "used_names": ["Any", "Iterable", "pytest"], "enclosing_function": "assert_lists_compatible", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/conftest.py::280": {"resolved_imports": [], "used_names": ["Any"], "enclosing_function": "assert_dicts_compatible", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/fields/test_create.py::199": {"resolved_imports": [], "used_names": ["URL", "httpx", "json"], "enclosing_function": "test_add_text_field_invalid_data", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/fields/test_create.py::230": {"resolved_imports": [], "used_names": ["URL", "httpx", "json"], "enclosing_function": "test_add_choice_field_invalid_choices", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/fields/test_create.py::317": {"resolved_imports": [], "used_names": ["URL", "assert_httpx_success", "httpx", "json"], "enclosing_function": "test_update_field_change_field_type", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/fields/test_delete.py::29": {"resolved_imports": [], "used_names": ["URL", "assert_httpx_success", "httpx", "json"], "enclosing_function": "test_delete_field", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/fields/test_delete.py::20": {"resolved_imports": [], "used_names": ["URL", "assert_httpx_success", "httpx", "json"], "enclosing_function": "test_delete_field", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/fields/test_get.py::20": {"resolved_imports": [], "used_names": ["URL", "assert_httpx_success", "assert_lists_compatible", "httpx", "json"], "enclosing_function": "test_get_field", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/fields/test_utilize.py::59": {"resolved_imports": [], "used_names": ["URL", "assert_httpx_code", "httpx"], "enclosing_function": "test_add_vendor_with_invalid_extra_field", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/fields/test_utilize.py::20": {"resolved_imports": [], "used_names": ["URL", "assert_httpx_success", "httpx", "json"], "enclosing_function": "test_add_vendor_with_extra_field", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_add.py::74": {"resolved_imports": [], "used_names": ["Any", "URL", "assert_dicts_compatible", "datetime", "httpx", "timezone"], "enclosing_function": "test_add_filament", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_add.py::174": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_add_filament_multi_color_errors", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_add.py::127": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_add_filament_color_hex_alpha", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_add.py::152": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_add_filament_multi_color", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_add.py::153": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_add_filament_multi_color", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_add.py::96": {"resolved_imports": [], "used_names": ["URL", "assert_dicts_compatible", "httpx"], "enclosing_function": "test_add_filament_required", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_add.py::50": {"resolved_imports": [], "used_names": ["Any", "URL", "assert_dicts_compatible", "datetime", "httpx", "timezone"], "enclosing_function": "test_add_filament", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_delete.py::40": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx"], "enclosing_function": "test_delete_filament", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_delete.py::51": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_delete_filament_not_found", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_find.py::169": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_filaments_limit_asc", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_find.py::217": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_filaments_limit_asc_offset_outside_range", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_find.py::167": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_filaments_limit_asc", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_find.py::119": {"resolved_imports": [], "used_names": ["URL", "assert_lists_compatible", "httpx"], "enclosing_function": "test_find_all_filaments", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_find.py::130": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_filaments_sort_asc", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_find.py::432": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_filaments_by_article_number", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_find.py::129": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_filaments_sort_asc", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_get.py::87": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_get_filament_not_found", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_get.py::89": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_get_filament_not_found", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_get.py::54": {"resolved_imports": [], "used_names": ["Any", "URL", "assert_dicts_compatible", "httpx"], "enclosing_function": "test_get_filament", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_update.py::173": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx"], "enclosing_function": "test_update_filament_cant_set_none", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_update.py::188": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_update_filament_not_found", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_update.py::190": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_update_filament_not_found", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_update.py::127": {"resolved_imports": [], "used_names": ["URL", "assert_dicts_compatible", "httpx"], "enclosing_function": "test_update_filament_multi_color", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/filament/test_update.py::72": {"resolved_imports": [], "used_names": ["Any", "URL", "assert_dicts_compatible", "httpx"], "enclosing_function": "test_update_filament", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/setting/test_get.py::27": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_get_unknown", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/setting/test_get.py::38": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_get_all", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/setting/test_get.py::16": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_get_currency", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/setting/test_set.py::75": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_set_unknown", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/setting/test_set.py::85": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_set_currency_wrong_type", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/setting/test_set.py::21": {"resolved_imports": [], "used_names": ["URL", "httpx", "json"], "enclosing_function": "test_set_currency", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/setting/test_set.py::61": {"resolved_imports": [], "used_names": ["URL", "httpx", "json"], "enclosing_function": "test_unset_currency", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/setting/test_set.py::104": {"resolved_imports": [], "used_names": ["URL", "httpx", "json"], "enclosing_function": "test_set_big_value", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_add.py::73": {"resolved_imports": [], "used_names": ["Any", "URL", "assert_dicts_compatible", "datetime", "httpx", "length_from_weight", "pytest", "timezone"], "enclosing_function": "test_add_spool_remaining_weight", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_add.py::197": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx"], "enclosing_function": "test_add_spool_both_used_and_remaining_weight", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_add.py::60": {"resolved_imports": [], "used_names": ["Any", "URL", "assert_dicts_compatible", "datetime", "httpx", "length_from_weight", "pytest", "timezone"], "enclosing_function": "test_add_spool_remaining_weight", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_add.py::62": {"resolved_imports": [], "used_names": ["Any", "URL", "assert_dicts_compatible", "datetime", "httpx", "length_from_weight", "pytest", "timezone"], "enclosing_function": "test_add_spool_remaining_weight", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_add.py::321": {"resolved_imports": [], "used_names": ["Any", "URL", "assert_dicts_compatible", "datetime", "httpx", "length_from_weight", "pytest", "timezone"], "enclosing_function": "test_add_spool_spool_weight", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_add.py::249": {"resolved_imports": [], "used_names": ["Any", "URL", "assert_dicts_compatible", "datetime", "httpx", "length_from_weight", "pytest", "timezone"], "enclosing_function": "test_add_spool_initial_weight", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_add.py::59": {"resolved_imports": [], "used_names": ["Any", "URL", "assert_dicts_compatible", "datetime", "httpx", "length_from_weight", "pytest", "timezone"], "enclosing_function": "test_add_spool_remaining_weight", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_add.py::61": {"resolved_imports": [], "used_names": ["Any", "URL", "assert_dicts_compatible", "datetime", "httpx", "length_from_weight", "pytest", "timezone"], "enclosing_function": "test_add_spool_remaining_weight", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_delete.py::30": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx"], "enclosing_function": "test_delete_spool", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_delete.py::41": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_delete_spool_not_found", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_find.py::165": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_spools_limit_asc", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_find.py::213": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_spools_limit_asc_offset_outside_range", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_find.py::405": {"resolved_imports": [], "used_names": ["URL", "assert_lists_compatible", "httpx"], "enclosing_function": "test_find_spools_by_multiple_vendor_ids", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_find.py::163": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_spools_limit_asc", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_find.py::187": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_spools_limit_asc_offset", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_find.py::132": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_spools_sort_asc", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_find.py::131": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_spools_sort_asc", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_find.py::372": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_spools_by_empty_filament_vendor_name", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_find.py::422": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_spools_by_empty_filament_vendor_id", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_find.py::435": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_spools_by_location", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_get.py::144": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_get_spool_not_found", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_get.py::44": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx"], "enclosing_function": "test_get_spool", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_get.py::146": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_get_spool_not_found", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_get.py::86": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx", "pytest"], "enclosing_function": "test_get_spool_default_weights", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_get.py::87": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx", "pytest"], "enclosing_function": "test_get_spool_default_weights", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_measure.py::49": {"resolved_imports": [], "used_names": ["Any", "URL", "datetime", "httpx", "pytest", "timezone"], "enclosing_function": "test_measure_spool", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_measure.py::44": {"resolved_imports": [], "used_names": ["Any", "URL", "datetime", "httpx", "pytest", "timezone"], "enclosing_function": "test_measure_spool", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_measure.py::46": {"resolved_imports": [], "used_names": ["Any", "URL", "datetime", "httpx", "pytest", "timezone"], "enclosing_function": "test_measure_spool", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_measure.py::98": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx", "pytest"], "enclosing_function": "test_measure_spool_higher_initial", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_measure.py::97": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx", "pytest"], "enclosing_function": "test_measure_spool_higher_initial", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_update.py::175": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx"], "enclosing_function": "test_update_spool_both_used_and_remaining_weight", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_update.py::188": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx"], "enclosing_function": "test_update_spool_not_found", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_update.py::74": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx", "length_from_weight", "pytest"], "enclosing_function": "test_update_spool", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_update.py::71": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx", "length_from_weight", "pytest"], "enclosing_function": "test_update_spool", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_update.py::72": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx", "length_from_weight", "pytest"], "enclosing_function": "test_update_spool", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_update.py::190": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx"], "enclosing_function": "test_update_spool_not_found", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_update.py::70": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx", "length_from_weight", "pytest"], "enclosing_function": "test_update_spool", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_update.py::73": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx", "length_from_weight", "pytest"], "enclosing_function": "test_update_spool", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_use.py::47": {"resolved_imports": [], "used_names": ["Any", "URL", "datetime", "httpx", "pytest", "timezone"], "enclosing_function": "test_use_spool_weight", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_use.py::121": {"resolved_imports": [], "used_names": ["Any", "URL", "httpx"], "enclosing_function": "test_use_spool_weight_and_length", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_use.py::134": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_use_spool_not_found", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_use.py::136": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_use_spool_not_found", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_use.py::42": {"resolved_imports": [], "used_names": ["Any", "URL", "datetime", "httpx", "pytest", "timezone"], "enclosing_function": "test_use_spool_weight", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_use.py::93": {"resolved_imports": [], "used_names": ["Any", "URL", "datetime", "httpx", "math", "pytest", "timezone"], "enclosing_function": "test_use_spool_length", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_use.py::177": {"resolved_imports": [], "used_names": ["Any", "URL", "asyncio", "httpx", "pytest"], "enclosing_function": "test_use_spool_concurrent", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/spool/test_use.py::43": {"resolved_imports": [], "used_names": ["Any", "URL", "datetime", "httpx", "pytest", "timezone"], "enclosing_function": "test_use_spool_weight", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_add.py::41": {"resolved_imports": [], "used_names": ["URL", "assert_dicts_compatible", "datetime", "httpx", "timezone"], "enclosing_function": "test_add_vendor", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_add.py::59": {"resolved_imports": [], "used_names": ["URL", "assert_dicts_compatible", "httpx"], "enclosing_function": "test_add_vendor_required", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_add.py::28": {"resolved_imports": [], "used_names": ["URL", "assert_dicts_compatible", "datetime", "httpx", "timezone"], "enclosing_function": "test_add_vendor", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_delete.py::29": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_delete_vendor", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_delete.py::40": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_delete_vendor_not_found", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_find.py::93": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_vendors_limit_asc", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_find.py::141": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_vendors_limit_asc_offset_outside_range", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_find.py::91": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_vendors_limit_asc", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_find.py::60": {"resolved_imports": [], "used_names": ["URL", "assert_lists_compatible", "httpx"], "enclosing_function": "test_find_all_vendors", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_find.py::71": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_vendors_sort_asc", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_find.py::70": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_vendors_sort_asc", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_find.py::174": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_vendors_by_name", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_find.py::187": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_vendors_by_empty_name", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_find.py::200": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_vendors_by_external_id", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_find.py::94": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_find_all_vendors_limit_asc", "extracted_code": "", "n_imports_parsed": 6, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_get.py::43": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_get_vendor_not_found", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_get.py::28": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_get_vendor", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_get.py::29": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_get_vendor", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_get.py::45": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_get_vendor_not_found", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_get.py::30": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_get_vendor", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_get.py::31": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_get_vendor", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_update.py::46": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_update_vendor_not_found", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_update.py::48": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_update_vendor_not_found", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_update.py::31": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_update_vendor", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_update.py::32": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_update_vendor", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_update.py::33": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_update_vendor", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests_integration/tests/vendor/test_update.py::34": {"resolved_imports": [], "used_names": ["URL", "httpx"], "enclosing_function": "test_update_vendor", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}}}
oracle_context_cache/EbodShojaei__bake.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/Filimoa__open-parse.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/FinanceData__FinanceDataReader.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"repo": "FinanceData/FinanceDataReader", "n_pairs": 30, "version": "v2_function_scoped", "contexts": {"tests/test_us.py::28": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_us_data_reader_yahoo", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_snap.py::23": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_snap_naver_finstate", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_basic.py::68": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_krx_index", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_basic.py::170": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_stocklistings", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_krx.py::73": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_krx_stock_data_reader", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_us.py::21": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_us_sp500_listing", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_snap.py::17": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_snap_krx_index_stocks", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_krx.py::22": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_krx_stock_listing_kosdaq", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_krx.py::29": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_krx_delisting_listing", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_snap.py::11": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_snap_krx_indices", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_economy.py::8": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_fred_data_reader", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_krx.py::36": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_krx_administrative_listing", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_us.py::10": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_us_stock_listing_nasdaq", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_us.py::11": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_us_stock_listing_nasdaq", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_basic.py::13": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_krx_daily", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_snap.py::30": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_snap_ecos_keystat", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_international.py::26": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_market_listing_hose", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_us.py::16": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_us_stock_listing_nyse", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_krx.py::13": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_krx_stock_listing", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_krx.py::21": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_krx_stock_listing_kosdaq", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_international.py::32": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_data_reader_international", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_international.py::20": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_market_listing_tse", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_krx.py::14": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_krx_stock_listing", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_international.py::8": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_market_listing_sse", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_investing.py::13": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_investing_data_reader", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_economy.py::9": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_fred_data_reader", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_international.py::14": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_market_listing_hkex", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_basic.py::42": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_krx_major_index", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_krx.py::42": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_krx_data_reader_basics", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_basic.py::164": {"resolved_imports": ["src/FinanceDataReader/__init__.py"], "used_names": ["pytest"], "enclosing_function": "test_stocklistings", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}}}
oracle_context_cache/Forethought-Technologies__AutoChain.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/GitGuardian__ggshield.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/IDSIA__sacred.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/JWock82__Pynite.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/JoshuaC215__agent-service-toolkit.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/JuanBindez__pytubefix.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"repo": "JuanBindez/pytubefix", "n_pairs": 138, "version": "v2_function_scoped", "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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\n self.caller = caller\n self.pattern = pattern", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 488}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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\n self.caller = caller\n self.pattern = pattern", "n_imports_parsed": 3, "n_files_resolved": 3, "n_chars_extracted": 488}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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\n self.caller = caller\n self.pattern = pattern", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 488}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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}, "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\n self.caller = caller\n self.pattern = pattern", "n_imports_parsed": 10, "n_files_resolved": 3, "n_chars_extracted": 488}, "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}, "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}, "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}}}
oracle_context_cache/Kludex__mangum.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"repo": "Kludex/mangum", "n_pairs": 63, "version": "v2_function_scoped", "contexts": {"tests/handlers/test_lambda_at_edge.py::241": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/lambda_at_edge.py"], "used_names": ["LambdaAtEdge", "pytest"], "enclosing_function": "test_aws_api_gateway_scope_real", "extracted_code": "# Source: mangum/handlers/lambda_at_edge.py\nclass LambdaAtEdge:\n @classmethod\n def infer(cls, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> bool:\n return \"Records\" in event and len(event[\"Records\"]) > 0 and \"cf\" in event[\"Records\"][0]\n\n # FIXME: Since this is the last in the chain it doesn't get coverage by default,\n # # just ignoring it for now.\n # return None # pragma: nocover\n\n def __init__(self, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> None:\n self.event = event\n self.context = context\n self.config = config\n\n @property\n def body(self) -> bytes:\n cf_request_body = self.event[\"Records\"][0][\"cf\"][\"request\"].get(\"body\", {})\n return maybe_encode_body(\n cf_request_body.get(\"data\"),\n is_base64=cf_request_body.get(\"encoding\", \"\") == \"base64\",\n )\n\n @property\n def scope(self) -> Scope:\n cf_request = self.event[\"Records\"][0][\"cf\"][\"request\"]\n scheme_header = cf_request[\"headers\"].get(\"cloudfront-forwarded-proto\", [{}])\n scheme = scheme_header[0].get(\"value\", \"https\")\n host_header = cf_request[\"headers\"].get(\"host\", [{}])\n server_name = host_header[0].get(\"value\", \"mangum\")\n if \":\" not in server_name:\n forwarded_port_header = cf_request[\"headers\"].get(\"x-forwarded-port\", [{}])\n server_port = forwarded_port_header[0].get(\"value\", 80)\n else:\n server_name, server_port = server_name.split(\":\") # pragma: no cover\n\n server = (server_name, int(server_port))\n source_ip = cf_request[\"clientIp\"]\n client = (source_ip, 0)\n http_method = cf_request[\"method\"]\n\n return {\n \"type\": \"http\",\n \"method\": http_method,\n \"http_version\": \"1.1\",\n \"headers\": [[k.encode(), v[0][\"value\"].encode()] for k, v in cf_request[\"headers\"].items()],\n \"path\": cf_request[\"uri\"],\n \"raw_path\": None,\n \"root_path\": \"\",\n \"scheme\": scheme,\n \"query_string\": cf_request[\"querystring\"].encode(),\n \"server\": server,\n \"client\": client,\n \"asgi\": {\"version\": \"3.0\", \"spec_version\": \"2.0\"},\n \"aws.event\": self.event,\n \"aws.context\": self.context,\n }\n\n def __call__(self, response: Response) -> dict[str, Any]:\n multi_value_headers, _ = handle_multi_value_headers(response[\"headers\"])\n response_body, is_base64_encoded = handle_base64_response_body(\n response[\"body\"], multi_value_headers, self.config[\"text_mime_types\"]\n )\n finalized_headers: dict[str, list[dict[str, str]]] = {\n key.decode().lower(): [{\"key\": key.decode().lower(), \"value\": val.decode()}]\n for key, val in response[\"headers\"]\n }\n\n return {\n \"status\": response[\"status\"],\n \"headers\": handle_exclude_headers(finalized_headers, self.config),\n \"body\": response_body,\n \"isBase64Encoded\": is_base64_encoded,\n }", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 3112}, "tests/handlers/test_alb.py::284": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/alb.py"], "used_names": ["Mangum", "pytest"], "enclosing_function": "test_aws_alb_set_cookies", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/handlers/test_lambda_at_edge.py::345": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/lambda_at_edge.py"], "used_names": ["Mangum"], "enclosing_function": "test_aws_lambda_at_edge_exclude_", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/handlers/test_lambda_at_edge.py::306": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/lambda_at_edge.py"], "used_names": ["Mangum"], "enclosing_function": "test_aws_lambda_at_edge_response_extra_mime_types", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/handlers/test_lambda_at_edge.py::318": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/lambda_at_edge.py"], "used_names": ["Mangum"], "enclosing_function": "test_aws_lambda_at_edge_response_extra_mime_types", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/test_lifespan.py::293": {"resolved_imports": ["mangum/__init__.py", "mangum/exceptions.py", "mangum/types.py"], "used_names": ["Mangum", "PlainTextResponse", "Starlette", "pytest"], "enclosing_function": "test_starlette_lifespan", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 141}, "tests/test_adapter.py::14": {"resolved_imports": ["mangum/__init__.py", "mangum/adapter.py", "mangum/exceptions.py", "mangum/types.py"], "used_names": ["DEFAULT_TEXT_MIME_TYPES", "Mangum"], "enclosing_function": "test_default_settings", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\n\n# Source: mangum/adapter.py\nHANDLERS: list[type[LambdaHandler]] = [ALB, HTTPGateway, APIGateway, LambdaAtEdge]\n\nDEFAULT_TEXT_MIME_TYPES: list[str] = [\n \"text/\",\n \"application/json\",\n \"application/javascript\",\n \"application/xml\",\n \"application/vnd.api+json\",\n \"application/vnd.oai.openapi\",\n]\n\n\n\n self.config = LambdaConfig(\n api_gateway_base_path=api_gateway_base_path or \"/\",\n text_mime_types=text_mime_types or [*DEFAULT_TEXT_MIME_TYPES],\n exclude_headers=[header.lower() for header in exclude_headers],\n )\n self._setup_event_loop()\n\n def infer(self, event: LambdaEvent, context: LambdaContext) -> LambdaHandler:\n for handler_cls in chain(self.custom_handlers, HANDLERS):\n if handler_cls.infer(event, context, self.config):\n return handler_cls(event, context, self.config)\n raise RuntimeError( # pragma: no cover", "n_imports_parsed": 5, "n_files_resolved": 4, "n_chars_extracted": 1074}, "tests/test_http.py::586": {"resolved_imports": ["mangum/__init__.py"], "used_names": ["BrotliMiddleware", "Mangum", "base64", "brotli", "json", "pytest"], "enclosing_function": "test_http_binary_br_response", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 15, "n_files_resolved": 1, "n_chars_extracted": 141}, "tests/handlers/test_http_gateway.py::562": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["Mangum", "pytest"], "enclosing_function": "test_aws_http_gateway_response_v2", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/handlers/test_alb.py::348": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/alb.py"], "used_names": ["Mangum"], "enclosing_function": "test_aws_alb_response_extra_mime_types", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/handlers/test_http_gateway.py::608": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["Mangum"], "enclosing_function": "test_aws_http_gateway_response_v1_extra_mime_types", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/handlers/test_api_gateway.py::381": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["Mangum"], "enclosing_function": "test_aws_api_gateway_response_extra_mime_types", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/handlers/test_api_gateway.py::368": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["Mangum"], "enclosing_function": "test_aws_api_gateway_response_extra_mime_types", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/test_http.py::580": {"resolved_imports": ["mangum/__init__.py"], "used_names": ["BrotliMiddleware", "Mangum", "base64", "brotli", "json", "pytest"], "enclosing_function": "test_http_binary_br_response", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 15, "n_files_resolved": 1, "n_chars_extracted": 141}, "tests/handlers/test_api_gateway.py::338": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["Mangum", "pytest"], "enclosing_function": "test_aws_api_gateway_response", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/handlers/test_api_gateway.py::238": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["APIGateway", "pytest"], "enclosing_function": "test_aws_api_gateway_scope_real", "extracted_code": "# Source: mangum/handlers/api_gateway.py\nclass APIGateway:\n @classmethod\n def infer(cls, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> bool:\n return \"resource\" in event and \"requestContext\" in event\n\n def __init__(self, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> None:\n self.event = event\n self.context = context\n self.config = config\n\n @property\n def body(self) -> bytes:\n return maybe_encode_body(\n self.event.get(\"body\", b\"\"),\n is_base64=self.event.get(\"isBase64Encoded\", False),\n )\n\n @property\n def scope(self) -> Scope:\n headers = _handle_multi_value_headers_for_request(self.event)\n return {\n \"type\": \"http\",\n \"http_version\": \"1.1\",\n \"method\": self.event[\"httpMethod\"],\n \"headers\": [[k.encode(), v.encode()] for k, v in headers.items()],\n \"path\": strip_api_gateway_path(\n self.event[\"path\"],\n api_gateway_base_path=self.config[\"api_gateway_base_path\"],\n ),\n \"raw_path\": None,\n \"root_path\": \"\",\n \"scheme\": headers.get(\"x-forwarded-proto\", \"https\"),\n \"query_string\": _encode_query_string_for_apigw(self.event),\n \"server\": get_server_and_port(headers),\n \"client\": (\n self.event[\"requestContext\"].get(\"identity\", {}).get(\"sourceIp\"),\n 0,\n ),\n \"asgi\": {\"version\": \"3.0\", \"spec_version\": \"2.0\"},\n \"aws.event\": self.event,\n \"aws.context\": self.context,\n }\n\n def __call__(self, response: Response) -> dict[str, Any]:\n finalized_headers, multi_value_headers = handle_multi_value_headers(response[\"headers\"])\n finalized_body, is_base64_encoded = handle_base64_response_body(\n response[\"body\"], finalized_headers, self.config[\"text_mime_types\"]\n )\n\n return {\n \"statusCode\": response[\"status\"],\n \"headers\": handle_exclude_headers(finalized_headers, self.config),\n \"multiValueHeaders\": handle_exclude_headers(multi_value_headers, self.config),\n \"body\": finalized_body,\n \"isBase64Encoded\": is_base64_encoded,\n }", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 2298}, "tests/handlers/test_api_gateway.py::409": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["Mangum"], "enclosing_function": "test_aws_api_gateway_exclude_headers", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/test_adapter.py::30": {"resolved_imports": ["mangum/__init__.py", "mangum/adapter.py", "mangum/exceptions.py", "mangum/types.py"], "used_names": ["ConfigurationError", "Mangum", "pytest"], "enclosing_function": "test_invalid_options", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\n\n# Source: mangum/exceptions.py\nclass ConfigurationError(Exception):\n \"\"\"Raise when an error occurs parsing configuration.\"\"\"", "n_imports_parsed": 5, "n_files_resolved": 4, "n_chars_extracted": 271}, "tests/handlers/test_api_gateway.py::369": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["Mangum"], "enclosing_function": "test_aws_api_gateway_response_extra_mime_types", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/test_http.py::248": {"resolved_imports": ["mangum/__init__.py"], "used_names": ["GZipMiddleware", "Mangum", "base64", "gzip", "json", "pytest"], "enclosing_function": "test_http_binary_gzip_response", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 15, "n_files_resolved": 1, "n_chars_extracted": 141}, "tests/handlers/test_alb.py::347": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/alb.py"], "used_names": ["Mangum"], "enclosing_function": "test_aws_alb_response_extra_mime_types", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/handlers/test_http_gateway.py::596": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["Mangum"], "enclosing_function": "test_aws_http_gateway_response_v1_extra_mime_types", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/handlers/test_http_gateway.py::643": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["Mangum"], "enclosing_function": "test_aws_http_gateway_response_v2_extra_mime_types", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/test_http.py::354": {"resolved_imports": ["mangum/__init__.py"], "used_names": ["Mangum", "pytest"], "enclosing_function": "test_set_cookies_v2", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 15, "n_files_resolved": 1, "n_chars_extracted": 141}, "tests/test_adapter.py::16": {"resolved_imports": ["mangum/__init__.py", "mangum/adapter.py", "mangum/exceptions.py", "mangum/types.py"], "used_names": ["DEFAULT_TEXT_MIME_TYPES", "Mangum"], "enclosing_function": "test_default_settings", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\n\n# Source: mangum/adapter.py\nHANDLERS: list[type[LambdaHandler]] = [ALB, HTTPGateway, APIGateway, LambdaAtEdge]\n\nDEFAULT_TEXT_MIME_TYPES: list[str] = [\n \"text/\",\n \"application/json\",\n \"application/javascript\",\n \"application/xml\",\n \"application/vnd.api+json\",\n \"application/vnd.oai.openapi\",\n]\n\n\n\n self.config = LambdaConfig(\n api_gateway_base_path=api_gateway_base_path or \"/\",\n text_mime_types=text_mime_types or [*DEFAULT_TEXT_MIME_TYPES],\n exclude_headers=[header.lower() for header in exclude_headers],\n )\n self._setup_event_loop()\n\n def infer(self, event: LambdaEvent, context: LambdaContext) -> LambdaHandler:\n for handler_cls in chain(self.custom_handlers, HANDLERS):\n if handler_cls.infer(event, context, self.config):\n return handler_cls(event, context, self.config)\n raise RuntimeError( # pragma: no cover", "n_imports_parsed": 5, "n_files_resolved": 4, "n_chars_extracted": 1074}, "tests/test_lifespan.py::334": {"resolved_imports": ["mangum/__init__.py", "mangum/exceptions.py", "mangum/types.py"], "used_names": ["Mangum", "Quart", "pytest"], "enclosing_function": "test_quart_lifespan", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 141}, "tests/test_adapter.py::17": {"resolved_imports": ["mangum/__init__.py", "mangum/adapter.py", "mangum/exceptions.py", "mangum/types.py"], "used_names": ["DEFAULT_TEXT_MIME_TYPES", "Mangum"], "enclosing_function": "test_default_settings", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\n\n# Source: mangum/adapter.py\nHANDLERS: list[type[LambdaHandler]] = [ALB, HTTPGateway, APIGateway, LambdaAtEdge]\n\nDEFAULT_TEXT_MIME_TYPES: list[str] = [\n \"text/\",\n \"application/json\",\n \"application/javascript\",\n \"application/xml\",\n \"application/vnd.api+json\",\n \"application/vnd.oai.openapi\",\n]\n\n\n\n self.config = LambdaConfig(\n api_gateway_base_path=api_gateway_base_path or \"/\",\n text_mime_types=text_mime_types or [*DEFAULT_TEXT_MIME_TYPES],\n exclude_headers=[header.lower() for header in exclude_headers],\n )\n self._setup_event_loop()\n\n def infer(self, event: LambdaEvent, context: LambdaContext) -> LambdaHandler:\n for handler_cls in chain(self.custom_handlers, HANDLERS):\n if handler_cls.infer(event, context, self.config):\n return handler_cls(event, context, self.config)\n raise RuntimeError( # pragma: no cover", "n_imports_parsed": 5, "n_files_resolved": 4, "n_chars_extracted": 1074}, "tests/handlers/test_api_gateway.py::261": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["parse"], "enclosing_function": "app", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/handlers/test_alb.py::318": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/alb.py"], "used_names": ["Mangum", "pytest"], "enclosing_function": "test_aws_alb_response", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/handlers/test_http_gateway.py::595": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["Mangum"], "enclosing_function": "test_aws_http_gateway_response_v1_extra_mime_types", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/handlers/test_http_gateway.py::500": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["Mangum", "pytest"], "enclosing_function": "test_aws_http_gateway_response_v1", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/handlers/test_http_gateway.py::230": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["HTTPGateway"], "enclosing_function": "test_aws_http_gateway_scope_v1_no_headers", "extracted_code": "# Source: mangum/handlers/api_gateway.py\nclass HTTPGateway:\n @classmethod\n def infer(cls, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> bool:\n return \"version\" in event and \"requestContext\" in event\n\n def __init__(self, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> None:\n self.event = event\n self.context = context\n self.config = config\n\n @property\n def body(self) -> bytes:\n return maybe_encode_body(\n self.event.get(\"body\", b\"\"),\n is_base64=self.event.get(\"isBase64Encoded\", False),\n )\n\n @property\n def scope(self) -> Scope:\n request_context = self.event[\"requestContext\"]\n event_version = self.event[\"version\"]\n\n # API Gateway v2\n if event_version == \"2.0\":\n headers = {k.lower(): v for k, v in self.event.get(\"headers\", {}).items()}\n source_ip = request_context[\"http\"][\"sourceIp\"]\n path = request_context[\"http\"][\"path\"]\n http_method = request_context[\"http\"][\"method\"]\n query_string = self.event.get(\"rawQueryString\", \"\").encode()\n\n if self.event.get(\"cookies\"):\n headers[\"cookie\"] = \"; \".join(self.event.get(\"cookies\", []))\n\n # API Gateway v1\n else:\n headers = _handle_multi_value_headers_for_request(self.event)\n source_ip = request_context.get(\"identity\", {}).get(\"sourceIp\")\n path = self.event[\"path\"]\n http_method = self.event[\"httpMethod\"]\n query_string = _encode_query_string_for_apigw(self.event)\n\n path = strip_api_gateway_path(\n path,\n api_gateway_base_path=self.config[\"api_gateway_base_path\"],\n )\n server = get_server_and_port(headers)\n client = (source_ip, 0)\n\n return {\n \"type\": \"http\",\n \"method\": http_method,\n \"http_version\": \"1.1\",\n \"headers\": [[k.encode(), v.encode()] for k, v in headers.items()],\n \"path\": path,\n \"raw_path\": None,\n \"root_path\": \"\",\n \"scheme\": headers.get(\"x-forwarded-proto\", \"https\"),\n \"query_string\": query_string,\n \"server\": server,\n \"client\": client,\n \"asgi\": {\"version\": \"3.0\", \"spec_version\": \"2.0\"},\n \"aws.event\": self.event,\n \"aws.context\": self.context,\n }\n\n def __call__(self, response: Response) -> dict[str, Any]:\n if self.scope[\"aws.event\"][\"version\"] == \"2.0\":\n finalized_headers, cookies = _combine_headers_v2(response[\"headers\"])\n\n if \"content-type\" not in finalized_headers and response[\"body\"] is not None:\n finalized_headers[\"content-type\"] = \"application/json\"\n\n finalized_body, is_base64_encoded = handle_base64_response_body(\n response[\"body\"], finalized_headers, self.config[\"text_mime_types\"]\n )\n response_out = {\n \"statusCode\": response[\"status\"],\n \"body\": finalized_body,\n \"headers\": finalized_headers or None,\n \"cookies\": cookies or None,\n \"isBase64Encoded\": is_base64_encoded,\n }\n return {key: value for key, value in response_out.items() if value is not None}\n\n finalized_headers, multi_value_headers = handle_multi_value_headers(response[\"headers\"])\n finalized_body, is_base64_encoded = handle_base64_response_body(\n response[\"body\"], finalized_headers, self.config[\"text_mime_types\"]\n )\n return {\n \"statusCode\": response[\"status\"],\n \"headers\": finalized_headers,\n \"multiValueHeaders\": multi_value_headers,\n \"body\": finalized_body,\n \"isBase64Encoded\": is_base64_encoded,\n }", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 3867}, "tests/handlers/test_api_gateway.py::275": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["Mangum", "parse", "pytest"], "enclosing_function": "test_aws_api_gateway_base_path", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/test_adapter.py::15": {"resolved_imports": ["mangum/__init__.py", "mangum/adapter.py", "mangum/exceptions.py", "mangum/types.py"], "used_names": ["DEFAULT_TEXT_MIME_TYPES", "Mangum"], "enclosing_function": "test_default_settings", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\n\n# Source: mangum/adapter.py\nHANDLERS: list[type[LambdaHandler]] = [ALB, HTTPGateway, APIGateway, LambdaAtEdge]\n\nDEFAULT_TEXT_MIME_TYPES: list[str] = [\n \"text/\",\n \"application/json\",\n \"application/javascript\",\n \"application/xml\",\n \"application/vnd.api+json\",\n \"application/vnd.oai.openapi\",\n]\n\n\n\n self.config = LambdaConfig(\n api_gateway_base_path=api_gateway_base_path or \"/\",\n text_mime_types=text_mime_types or [*DEFAULT_TEXT_MIME_TYPES],\n exclude_headers=[header.lower() for header in exclude_headers],\n )\n self._setup_event_loop()\n\n def infer(self, event: LambdaEvent, context: LambdaContext) -> LambdaHandler:\n for handler_cls in chain(self.custom_handlers, HANDLERS):\n if handler_cls.infer(event, context, self.config):\n return handler_cls(event, context, self.config)\n raise RuntimeError( # pragma: no cover", "n_imports_parsed": 5, "n_files_resolved": 4, "n_chars_extracted": 1074}, "tests/handlers/test_lambda_at_edge.py::307": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/lambda_at_edge.py"], "used_names": ["Mangum"], "enclosing_function": "test_aws_lambda_at_edge_response_extra_mime_types", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/handlers/test_http_gateway.py::218": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["HTTPGateway"], "enclosing_function": "test_aws_http_gateway_scope_v1_only_non_multi_headers", "extracted_code": "# Source: mangum/handlers/api_gateway.py\nclass HTTPGateway:\n @classmethod\n def infer(cls, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> bool:\n return \"version\" in event and \"requestContext\" in event\n\n def __init__(self, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> None:\n self.event = event\n self.context = context\n self.config = config\n\n @property\n def body(self) -> bytes:\n return maybe_encode_body(\n self.event.get(\"body\", b\"\"),\n is_base64=self.event.get(\"isBase64Encoded\", False),\n )\n\n @property\n def scope(self) -> Scope:\n request_context = self.event[\"requestContext\"]\n event_version = self.event[\"version\"]\n\n # API Gateway v2\n if event_version == \"2.0\":\n headers = {k.lower(): v for k, v in self.event.get(\"headers\", {}).items()}\n source_ip = request_context[\"http\"][\"sourceIp\"]\n path = request_context[\"http\"][\"path\"]\n http_method = request_context[\"http\"][\"method\"]\n query_string = self.event.get(\"rawQueryString\", \"\").encode()\n\n if self.event.get(\"cookies\"):\n headers[\"cookie\"] = \"; \".join(self.event.get(\"cookies\", []))\n\n # API Gateway v1\n else:\n headers = _handle_multi_value_headers_for_request(self.event)\n source_ip = request_context.get(\"identity\", {}).get(\"sourceIp\")\n path = self.event[\"path\"]\n http_method = self.event[\"httpMethod\"]\n query_string = _encode_query_string_for_apigw(self.event)\n\n path = strip_api_gateway_path(\n path,\n api_gateway_base_path=self.config[\"api_gateway_base_path\"],\n )\n server = get_server_and_port(headers)\n client = (source_ip, 0)\n\n return {\n \"type\": \"http\",\n \"method\": http_method,\n \"http_version\": \"1.1\",\n \"headers\": [[k.encode(), v.encode()] for k, v in headers.items()],\n \"path\": path,\n \"raw_path\": None,\n \"root_path\": \"\",\n \"scheme\": headers.get(\"x-forwarded-proto\", \"https\"),\n \"query_string\": query_string,\n \"server\": server,\n \"client\": client,\n \"asgi\": {\"version\": \"3.0\", \"spec_version\": \"2.0\"},\n \"aws.event\": self.event,\n \"aws.context\": self.context,\n }\n\n def __call__(self, response: Response) -> dict[str, Any]:\n if self.scope[\"aws.event\"][\"version\"] == \"2.0\":\n finalized_headers, cookies = _combine_headers_v2(response[\"headers\"])\n\n if \"content-type\" not in finalized_headers and response[\"body\"] is not None:\n finalized_headers[\"content-type\"] = \"application/json\"\n\n finalized_body, is_base64_encoded = handle_base64_response_body(\n response[\"body\"], finalized_headers, self.config[\"text_mime_types\"]\n )\n response_out = {\n \"statusCode\": response[\"status\"],\n \"body\": finalized_body,\n \"headers\": finalized_headers or None,\n \"cookies\": cookies or None,\n \"isBase64Encoded\": is_base64_encoded,\n }\n return {key: value for key, value in response_out.items() if value is not None}\n\n finalized_headers, multi_value_headers = handle_multi_value_headers(response[\"headers\"])\n finalized_body, is_base64_encoded = handle_base64_response_body(\n response[\"body\"], finalized_headers, self.config[\"text_mime_types\"]\n )\n return {\n \"statusCode\": response[\"status\"],\n \"headers\": finalized_headers,\n \"multiValueHeaders\": multi_value_headers,\n \"body\": finalized_body,\n \"isBase64Encoded\": is_base64_encoded,\n }", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 3867}, "tests/handlers/test_http_gateway.py::290": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["HTTPGateway"], "enclosing_function": "test_aws_http_gateway_scope_basic_v2", "extracted_code": "# Source: mangum/handlers/api_gateway.py\nclass HTTPGateway:\n @classmethod\n def infer(cls, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> bool:\n return \"version\" in event and \"requestContext\" in event\n\n def __init__(self, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> None:\n self.event = event\n self.context = context\n self.config = config\n\n @property\n def body(self) -> bytes:\n return maybe_encode_body(\n self.event.get(\"body\", b\"\"),\n is_base64=self.event.get(\"isBase64Encoded\", False),\n )\n\n @property\n def scope(self) -> Scope:\n request_context = self.event[\"requestContext\"]\n event_version = self.event[\"version\"]\n\n # API Gateway v2\n if event_version == \"2.0\":\n headers = {k.lower(): v for k, v in self.event.get(\"headers\", {}).items()}\n source_ip = request_context[\"http\"][\"sourceIp\"]\n path = request_context[\"http\"][\"path\"]\n http_method = request_context[\"http\"][\"method\"]\n query_string = self.event.get(\"rawQueryString\", \"\").encode()\n\n if self.event.get(\"cookies\"):\n headers[\"cookie\"] = \"; \".join(self.event.get(\"cookies\", []))\n\n # API Gateway v1\n else:\n headers = _handle_multi_value_headers_for_request(self.event)\n source_ip = request_context.get(\"identity\", {}).get(\"sourceIp\")\n path = self.event[\"path\"]\n http_method = self.event[\"httpMethod\"]\n query_string = _encode_query_string_for_apigw(self.event)\n\n path = strip_api_gateway_path(\n path,\n api_gateway_base_path=self.config[\"api_gateway_base_path\"],\n )\n server = get_server_and_port(headers)\n client = (source_ip, 0)\n\n return {\n \"type\": \"http\",\n \"method\": http_method,\n \"http_version\": \"1.1\",\n \"headers\": [[k.encode(), v.encode()] for k, v in headers.items()],\n \"path\": path,\n \"raw_path\": None,\n \"root_path\": \"\",\n \"scheme\": headers.get(\"x-forwarded-proto\", \"https\"),\n \"query_string\": query_string,\n \"server\": server,\n \"client\": client,\n \"asgi\": {\"version\": \"3.0\", \"spec_version\": \"2.0\"},\n \"aws.event\": self.event,\n \"aws.context\": self.context,\n }\n\n def __call__(self, response: Response) -> dict[str, Any]:\n if self.scope[\"aws.event\"][\"version\"] == \"2.0\":\n finalized_headers, cookies = _combine_headers_v2(response[\"headers\"])\n\n if \"content-type\" not in finalized_headers and response[\"body\"] is not None:\n finalized_headers[\"content-type\"] = \"application/json\"\n\n finalized_body, is_base64_encoded = handle_base64_response_body(\n response[\"body\"], finalized_headers, self.config[\"text_mime_types\"]\n )\n response_out = {\n \"statusCode\": response[\"status\"],\n \"body\": finalized_body,\n \"headers\": finalized_headers or None,\n \"cookies\": cookies or None,\n \"isBase64Encoded\": is_base64_encoded,\n }\n return {key: value for key, value in response_out.items() if value is not None}\n\n finalized_headers, multi_value_headers = handle_multi_value_headers(response[\"headers\"])\n finalized_body, is_base64_encoded = handle_base64_response_body(\n response[\"body\"], finalized_headers, self.config[\"text_mime_types\"]\n )\n return {\n \"statusCode\": response[\"status\"],\n \"headers\": finalized_headers,\n \"multiValueHeaders\": multi_value_headers,\n \"body\": finalized_body,\n \"isBase64Encoded\": is_base64_encoded,\n }", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 3867}, "tests/test_http.py::557": {"resolved_imports": ["mangum/__init__.py"], "used_names": ["Mangum", "pytest"], "enclosing_function": "test_http_response_headers", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 15, "n_files_resolved": 1, "n_chars_extracted": 141}, "tests/handlers/test_api_gateway.py::262": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["parse"], "enclosing_function": "app", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_lifespan.py::149": {"resolved_imports": ["mangum/__init__.py", "mangum/exceptions.py", "mangum/types.py"], "used_names": ["Mangum", "logging", "pytest"], "enclosing_function": "test_lifespan_error", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 141}, "tests/test_http.py::240": {"resolved_imports": ["mangum/__init__.py"], "used_names": ["GZipMiddleware", "Mangum", "base64", "gzip", "json", "pytest"], "enclosing_function": "test_http_binary_gzip_response", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 15, "n_files_resolved": 1, "n_chars_extracted": 141}, "tests/handlers/test_lambda_at_edge.py::243": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/lambda_at_edge.py"], "used_names": ["LambdaAtEdge", "pytest"], "enclosing_function": "test_aws_api_gateway_scope_real", "extracted_code": "# Source: mangum/handlers/lambda_at_edge.py\nclass LambdaAtEdge:\n @classmethod\n def infer(cls, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> bool:\n return \"Records\" in event and len(event[\"Records\"]) > 0 and \"cf\" in event[\"Records\"][0]\n\n # FIXME: Since this is the last in the chain it doesn't get coverage by default,\n # # just ignoring it for now.\n # return None # pragma: nocover\n\n def __init__(self, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> None:\n self.event = event\n self.context = context\n self.config = config\n\n @property\n def body(self) -> bytes:\n cf_request_body = self.event[\"Records\"][0][\"cf\"][\"request\"].get(\"body\", {})\n return maybe_encode_body(\n cf_request_body.get(\"data\"),\n is_base64=cf_request_body.get(\"encoding\", \"\") == \"base64\",\n )\n\n @property\n def scope(self) -> Scope:\n cf_request = self.event[\"Records\"][0][\"cf\"][\"request\"]\n scheme_header = cf_request[\"headers\"].get(\"cloudfront-forwarded-proto\", [{}])\n scheme = scheme_header[0].get(\"value\", \"https\")\n host_header = cf_request[\"headers\"].get(\"host\", [{}])\n server_name = host_header[0].get(\"value\", \"mangum\")\n if \":\" not in server_name:\n forwarded_port_header = cf_request[\"headers\"].get(\"x-forwarded-port\", [{}])\n server_port = forwarded_port_header[0].get(\"value\", 80)\n else:\n server_name, server_port = server_name.split(\":\") # pragma: no cover\n\n server = (server_name, int(server_port))\n source_ip = cf_request[\"clientIp\"]\n client = (source_ip, 0)\n http_method = cf_request[\"method\"]\n\n return {\n \"type\": \"http\",\n \"method\": http_method,\n \"http_version\": \"1.1\",\n \"headers\": [[k.encode(), v[0][\"value\"].encode()] for k, v in cf_request[\"headers\"].items()],\n \"path\": cf_request[\"uri\"],\n \"raw_path\": None,\n \"root_path\": \"\",\n \"scheme\": scheme,\n \"query_string\": cf_request[\"querystring\"].encode(),\n \"server\": server,\n \"client\": client,\n \"asgi\": {\"version\": \"3.0\", \"spec_version\": \"2.0\"},\n \"aws.event\": self.event,\n \"aws.context\": self.context,\n }\n\n def __call__(self, response: Response) -> dict[str, Any]:\n multi_value_headers, _ = handle_multi_value_headers(response[\"headers\"])\n response_body, is_base64_encoded = handle_base64_response_body(\n response[\"body\"], multi_value_headers, self.config[\"text_mime_types\"]\n )\n finalized_headers: dict[str, list[dict[str, str]]] = {\n key.decode().lower(): [{\"key\": key.decode().lower(), \"value\": val.decode()}]\n for key, val in response[\"headers\"]\n }\n\n return {\n \"status\": response[\"status\"],\n \"headers\": handle_exclude_headers(finalized_headers, self.config),\n \"body\": response_body,\n \"isBase64Encoded\": is_base64_encoded,\n }", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 3112}, "tests/test_http.py::190": {"resolved_imports": ["mangum/__init__.py"], "used_names": [], "enclosing_function": "app", "extracted_code": "", "n_imports_parsed": 15, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_http.py::153": {"resolved_imports": ["mangum/__init__.py"], "used_names": ["Mangum", "pytest"], "enclosing_function": "test_http_exception_mid_response", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 15, "n_files_resolved": 1, "n_chars_extracted": 141}, "tests/test_http.py::135": {"resolved_imports": ["mangum/__init__.py"], "used_names": ["Mangum", "pytest"], "enclosing_function": "test_http_response", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 15, "n_files_resolved": 1, "n_chars_extracted": 141}, "tests/test_http.py::178": {"resolved_imports": ["mangum/__init__.py"], "used_names": ["Mangum", "PlainTextResponse", "Request", "Route", "Starlette", "cast", "pytest"], "enclosing_function": "test_http_exception_handler", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 15, "n_files_resolved": 1, "n_chars_extracted": 141}, "tests/handlers/test_custom.py::50": {"resolved_imports": ["mangum/types.py"], "used_names": [], "enclosing_function": "test_custom_handler", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/handlers/test_lambda_at_edge.py::277": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/lambda_at_edge.py"], "used_names": ["Mangum", "pytest"], "enclosing_function": "test_aws_lambda_at_edge_response", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/handlers/test_api_gateway.py::240": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["APIGateway", "pytest"], "enclosing_function": "test_aws_api_gateway_scope_real", "extracted_code": "# Source: mangum/handlers/api_gateway.py\nclass APIGateway:\n @classmethod\n def infer(cls, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> bool:\n return \"resource\" in event and \"requestContext\" in event\n\n def __init__(self, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> None:\n self.event = event\n self.context = context\n self.config = config\n\n @property\n def body(self) -> bytes:\n return maybe_encode_body(\n self.event.get(\"body\", b\"\"),\n is_base64=self.event.get(\"isBase64Encoded\", False),\n )\n\n @property\n def scope(self) -> Scope:\n headers = _handle_multi_value_headers_for_request(self.event)\n return {\n \"type\": \"http\",\n \"http_version\": \"1.1\",\n \"method\": self.event[\"httpMethod\"],\n \"headers\": [[k.encode(), v.encode()] for k, v in headers.items()],\n \"path\": strip_api_gateway_path(\n self.event[\"path\"],\n api_gateway_base_path=self.config[\"api_gateway_base_path\"],\n ),\n \"raw_path\": None,\n \"root_path\": \"\",\n \"scheme\": headers.get(\"x-forwarded-proto\", \"https\"),\n \"query_string\": _encode_query_string_for_apigw(self.event),\n \"server\": get_server_and_port(headers),\n \"client\": (\n self.event[\"requestContext\"].get(\"identity\", {}).get(\"sourceIp\"),\n 0,\n ),\n \"asgi\": {\"version\": \"3.0\", \"spec_version\": \"2.0\"},\n \"aws.event\": self.event,\n \"aws.context\": self.context,\n }\n\n def __call__(self, response: Response) -> dict[str, Any]:\n finalized_headers, multi_value_headers = handle_multi_value_headers(response[\"headers\"])\n finalized_body, is_base64_encoded = handle_base64_response_body(\n response[\"body\"], finalized_headers, self.config[\"text_mime_types\"]\n )\n\n return {\n \"statusCode\": response[\"status\"],\n \"headers\": handle_exclude_headers(finalized_headers, self.config),\n \"multiValueHeaders\": handle_exclude_headers(multi_value_headers, self.config),\n \"body\": finalized_body,\n \"isBase64Encoded\": is_base64_encoded,\n }", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 2298}, "tests/handlers/test_http_gateway.py::371": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["HTTPGateway", "pytest"], "enclosing_function": "test_aws_http_gateway_scope_real_v1", "extracted_code": "# Source: mangum/handlers/api_gateway.py\nclass HTTPGateway:\n @classmethod\n def infer(cls, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> bool:\n return \"version\" in event and \"requestContext\" in event\n\n def __init__(self, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> None:\n self.event = event\n self.context = context\n self.config = config\n\n @property\n def body(self) -> bytes:\n return maybe_encode_body(\n self.event.get(\"body\", b\"\"),\n is_base64=self.event.get(\"isBase64Encoded\", False),\n )\n\n @property\n def scope(self) -> Scope:\n request_context = self.event[\"requestContext\"]\n event_version = self.event[\"version\"]\n\n # API Gateway v2\n if event_version == \"2.0\":\n headers = {k.lower(): v for k, v in self.event.get(\"headers\", {}).items()}\n source_ip = request_context[\"http\"][\"sourceIp\"]\n path = request_context[\"http\"][\"path\"]\n http_method = request_context[\"http\"][\"method\"]\n query_string = self.event.get(\"rawQueryString\", \"\").encode()\n\n if self.event.get(\"cookies\"):\n headers[\"cookie\"] = \"; \".join(self.event.get(\"cookies\", []))\n\n # API Gateway v1\n else:\n headers = _handle_multi_value_headers_for_request(self.event)\n source_ip = request_context.get(\"identity\", {}).get(\"sourceIp\")\n path = self.event[\"path\"]\n http_method = self.event[\"httpMethod\"]\n query_string = _encode_query_string_for_apigw(self.event)\n\n path = strip_api_gateway_path(\n path,\n api_gateway_base_path=self.config[\"api_gateway_base_path\"],\n )\n server = get_server_and_port(headers)\n client = (source_ip, 0)\n\n return {\n \"type\": \"http\",\n \"method\": http_method,\n \"http_version\": \"1.1\",\n \"headers\": [[k.encode(), v.encode()] for k, v in headers.items()],\n \"path\": path,\n \"raw_path\": None,\n \"root_path\": \"\",\n \"scheme\": headers.get(\"x-forwarded-proto\", \"https\"),\n \"query_string\": query_string,\n \"server\": server,\n \"client\": client,\n \"asgi\": {\"version\": \"3.0\", \"spec_version\": \"2.0\"},\n \"aws.event\": self.event,\n \"aws.context\": self.context,\n }\n\n def __call__(self, response: Response) -> dict[str, Any]:\n if self.scope[\"aws.event\"][\"version\"] == \"2.0\":\n finalized_headers, cookies = _combine_headers_v2(response[\"headers\"])\n\n if \"content-type\" not in finalized_headers and response[\"body\"] is not None:\n finalized_headers[\"content-type\"] = \"application/json\"\n\n finalized_body, is_base64_encoded = handle_base64_response_body(\n response[\"body\"], finalized_headers, self.config[\"text_mime_types\"]\n )\n response_out = {\n \"statusCode\": response[\"status\"],\n \"body\": finalized_body,\n \"headers\": finalized_headers or None,\n \"cookies\": cookies or None,\n \"isBase64Encoded\": is_base64_encoded,\n }\n return {key: value for key, value in response_out.items() if value is not None}\n\n finalized_headers, multi_value_headers = handle_multi_value_headers(response[\"headers\"])\n finalized_body, is_base64_encoded = handle_base64_response_body(\n response[\"body\"], finalized_headers, self.config[\"text_mime_types\"]\n )\n return {\n \"statusCode\": response[\"status\"],\n \"headers\": finalized_headers,\n \"multiValueHeaders\": multi_value_headers,\n \"body\": finalized_body,\n \"isBase64Encoded\": is_base64_encoded,\n }", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 3867}, "tests/handlers/test_alb.py::359": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/alb.py"], "used_names": ["Mangum"], "enclosing_function": "test_aws_alb_response_extra_mime_types", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/handlers/test_http_gateway.py::654": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["Mangum"], "enclosing_function": "test_aws_http_gateway_response_v2_extra_mime_types", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 141}, "tests/test_http.py::195": {"resolved_imports": ["mangum/__init__.py"], "used_names": ["Mangum", "pytest"], "enclosing_function": "test_http_cycle_state", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 15, "n_files_resolved": 1, "n_chars_extracted": 141}, "tests/test_lifespan.py::77": {"resolved_imports": ["mangum/__init__.py", "mangum/exceptions.py", "mangum/types.py"], "used_names": ["Mangum", "pytest"], "enclosing_function": "test_lifespan", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 141}, "tests/handlers/test_http_gateway.py::191": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["HTTPGateway"], "enclosing_function": "test_aws_http_gateway_scope_basic_v1", "extracted_code": "# Source: mangum/handlers/api_gateway.py\nclass HTTPGateway:\n @classmethod\n def infer(cls, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> bool:\n return \"version\" in event and \"requestContext\" in event\n\n def __init__(self, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> None:\n self.event = event\n self.context = context\n self.config = config\n\n @property\n def body(self) -> bytes:\n return maybe_encode_body(\n self.event.get(\"body\", b\"\"),\n is_base64=self.event.get(\"isBase64Encoded\", False),\n )\n\n @property\n def scope(self) -> Scope:\n request_context = self.event[\"requestContext\"]\n event_version = self.event[\"version\"]\n\n # API Gateway v2\n if event_version == \"2.0\":\n headers = {k.lower(): v for k, v in self.event.get(\"headers\", {}).items()}\n source_ip = request_context[\"http\"][\"sourceIp\"]\n path = request_context[\"http\"][\"path\"]\n http_method = request_context[\"http\"][\"method\"]\n query_string = self.event.get(\"rawQueryString\", \"\").encode()\n\n if self.event.get(\"cookies\"):\n headers[\"cookie\"] = \"; \".join(self.event.get(\"cookies\", []))\n\n # API Gateway v1\n else:\n headers = _handle_multi_value_headers_for_request(self.event)\n source_ip = request_context.get(\"identity\", {}).get(\"sourceIp\")\n path = self.event[\"path\"]\n http_method = self.event[\"httpMethod\"]\n query_string = _encode_query_string_for_apigw(self.event)\n\n path = strip_api_gateway_path(\n path,\n api_gateway_base_path=self.config[\"api_gateway_base_path\"],\n )\n server = get_server_and_port(headers)\n client = (source_ip, 0)\n\n return {\n \"type\": \"http\",\n \"method\": http_method,\n \"http_version\": \"1.1\",\n \"headers\": [[k.encode(), v.encode()] for k, v in headers.items()],\n \"path\": path,\n \"raw_path\": None,\n \"root_path\": \"\",\n \"scheme\": headers.get(\"x-forwarded-proto\", \"https\"),\n \"query_string\": query_string,\n \"server\": server,\n \"client\": client,\n \"asgi\": {\"version\": \"3.0\", \"spec_version\": \"2.0\"},\n \"aws.event\": self.event,\n \"aws.context\": self.context,\n }\n\n def __call__(self, response: Response) -> dict[str, Any]:\n if self.scope[\"aws.event\"][\"version\"] == \"2.0\":\n finalized_headers, cookies = _combine_headers_v2(response[\"headers\"])\n\n if \"content-type\" not in finalized_headers and response[\"body\"] is not None:\n finalized_headers[\"content-type\"] = \"application/json\"\n\n finalized_body, is_base64_encoded = handle_base64_response_body(\n response[\"body\"], finalized_headers, self.config[\"text_mime_types\"]\n )\n response_out = {\n \"statusCode\": response[\"status\"],\n \"body\": finalized_body,\n \"headers\": finalized_headers or None,\n \"cookies\": cookies or None,\n \"isBase64Encoded\": is_base64_encoded,\n }\n return {key: value for key, value in response_out.items() if value is not None}\n\n finalized_headers, multi_value_headers = handle_multi_value_headers(response[\"headers\"])\n finalized_body, is_base64_encoded = handle_base64_response_body(\n response[\"body\"], finalized_headers, self.config[\"text_mime_types\"]\n )\n return {\n \"statusCode\": response[\"status\"],\n \"headers\": finalized_headers,\n \"multiValueHeaders\": multi_value_headers,\n \"body\": finalized_body,\n \"isBase64Encoded\": is_base64_encoded,\n }", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 3867}, "tests/handlers/test_api_gateway.py::285": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/api_gateway.py"], "used_names": ["parse"], "enclosing_function": "app", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_lifespan.py::75": {"resolved_imports": ["mangum/__init__.py", "mangum/exceptions.py", "mangum/types.py"], "used_names": ["Mangum", "pytest"], "enclosing_function": "test_lifespan", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 141}, "tests/handlers/test_alb.py::244": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/alb.py"], "used_names": ["ALB", "pytest"], "enclosing_function": "test_aws_alb_scope_real", "extracted_code": "# Source: mangum/handlers/alb.py\nclass ALB:\n @classmethod\n def infer(cls, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> bool:\n return \"requestContext\" in event and \"elb\" in event[\"requestContext\"]\n\n def __init__(self, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> None:\n self.event = event\n self.context = context\n self.config = config\n\n @property\n def body(self) -> bytes:\n return maybe_encode_body(\n self.event.get(\"body\", b\"\"),\n is_base64=self.event.get(\"isBase64Encoded\", False),\n )\n\n @property\n def scope(self) -> Scope:\n headers = transform_headers(self.event)\n list_headers = [list(x) for x in headers]\n # Unique headers. If there are duplicates, it will use the last defined.\n uq_headers = {k.decode(): v.decode() for k, v in headers}\n source_ip = uq_headers.get(\"x-forwarded-for\", \"\")\n path = unquote(self.event[\"path\"]) if self.event[\"path\"] else \"/\"\n http_method = self.event[\"httpMethod\"]\n\n params = self.event.get(\n \"multiValueQueryStringParameters\",\n self.event.get(\"queryStringParameters\", {}),\n )\n if not params:\n query_string = b\"\"\n else:\n query_string = encode_query_string_for_alb(params)\n\n server = get_server_and_port(uq_headers)\n client = (source_ip, 0)\n\n scope: Scope = {\n \"type\": \"http\",\n \"method\": http_method,\n \"http_version\": \"1.1\",\n \"headers\": list_headers,\n \"path\": path,\n \"raw_path\": None,\n \"root_path\": \"\",\n \"scheme\": uq_headers.get(\"x-forwarded-proto\", \"https\"),\n \"query_string\": query_string,\n \"server\": server,\n \"client\": client,\n \"asgi\": {\"version\": \"3.0\", \"spec_version\": \"2.0\"},\n \"aws.event\": self.event,\n \"aws.context\": self.context,\n }\n\n return scope\n\n def __call__(self, response: Response) -> dict[str, Any]:\n multi_value_headers: dict[str, list[str]] = {}\n for key, value in response[\"headers\"]:\n lower_key = key.decode().lower()\n if lower_key not in multi_value_headers:\n multi_value_headers[lower_key] = []\n multi_value_headers[lower_key].append(value.decode())\n\n finalized_headers = case_mutated_headers(multi_value_headers)\n finalized_body, is_base64_encoded = handle_base64_response_body(\n response[\"body\"], finalized_headers, self.config[\"text_mime_types\"]\n )\n\n out = {\n \"statusCode\": response[\"status\"],\n \"body\": finalized_body,\n \"isBase64Encoded\": is_base64_encoded,\n }\n\n # You must use multiValueHeaders if you have enabled multi-value headers and\n # headers otherwise.\n multi_value_headers_enabled = \"multiValueHeaders\" in self.scope[\"aws.event\"]\n if multi_value_headers_enabled:\n out[\"multiValueHeaders\"] = handle_exclude_headers(multi_value_headers, self.config)\n else:\n out[\"headers\"] = handle_exclude_headers(finalized_headers, self.config)\n\n return out", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 3258}, "tests/test_http.py::494": {"resolved_imports": ["mangum/__init__.py"], "used_names": ["Mangum", "pytest"], "enclosing_function": "test_http_empty_header", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 15, "n_files_resolved": 1, "n_chars_extracted": 141}, "tests/test_lifespan.py::179": {"resolved_imports": ["mangum/__init__.py", "mangum/exceptions.py", "mangum/types.py"], "used_names": ["LifespanFailure", "Mangum", "pytest"], "enclosing_function": "test_lifespan_unexpected_message", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\n\n# Source: mangum/exceptions.py\nclass LifespanFailure(Exception):\n \"\"\"Raise when a lifespan failure event is sent by an application.\"\"\"", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 281}, "tests/test_http.py::616": {"resolved_imports": ["mangum/__init__.py"], "used_names": ["Mangum", "logging", "pytest"], "enclosing_function": "test_http_logging", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]", "n_imports_parsed": 15, "n_files_resolved": 1, "n_chars_extracted": 141}, "tests/handlers/test_alb.py::242": {"resolved_imports": ["mangum/__init__.py", "mangum/handlers/alb.py"], "used_names": ["ALB", "pytest"], "enclosing_function": "test_aws_alb_scope_real", "extracted_code": "# Source: mangum/handlers/alb.py\nclass ALB:\n @classmethod\n def infer(cls, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> bool:\n return \"requestContext\" in event and \"elb\" in event[\"requestContext\"]\n\n def __init__(self, event: LambdaEvent, context: LambdaContext, config: LambdaConfig) -> None:\n self.event = event\n self.context = context\n self.config = config\n\n @property\n def body(self) -> bytes:\n return maybe_encode_body(\n self.event.get(\"body\", b\"\"),\n is_base64=self.event.get(\"isBase64Encoded\", False),\n )\n\n @property\n def scope(self) -> Scope:\n headers = transform_headers(self.event)\n list_headers = [list(x) for x in headers]\n # Unique headers. If there are duplicates, it will use the last defined.\n uq_headers = {k.decode(): v.decode() for k, v in headers}\n source_ip = uq_headers.get(\"x-forwarded-for\", \"\")\n path = unquote(self.event[\"path\"]) if self.event[\"path\"] else \"/\"\n http_method = self.event[\"httpMethod\"]\n\n params = self.event.get(\n \"multiValueQueryStringParameters\",\n self.event.get(\"queryStringParameters\", {}),\n )\n if not params:\n query_string = b\"\"\n else:\n query_string = encode_query_string_for_alb(params)\n\n server = get_server_and_port(uq_headers)\n client = (source_ip, 0)\n\n scope: Scope = {\n \"type\": \"http\",\n \"method\": http_method,\n \"http_version\": \"1.1\",\n \"headers\": list_headers,\n \"path\": path,\n \"raw_path\": None,\n \"root_path\": \"\",\n \"scheme\": uq_headers.get(\"x-forwarded-proto\", \"https\"),\n \"query_string\": query_string,\n \"server\": server,\n \"client\": client,\n \"asgi\": {\"version\": \"3.0\", \"spec_version\": \"2.0\"},\n \"aws.event\": self.event,\n \"aws.context\": self.context,\n }\n\n return scope\n\n def __call__(self, response: Response) -> dict[str, Any]:\n multi_value_headers: dict[str, list[str]] = {}\n for key, value in response[\"headers\"]:\n lower_key = key.decode().lower()\n if lower_key not in multi_value_headers:\n multi_value_headers[lower_key] = []\n multi_value_headers[lower_key].append(value.decode())\n\n finalized_headers = case_mutated_headers(multi_value_headers)\n finalized_body, is_base64_encoded = handle_base64_response_body(\n response[\"body\"], finalized_headers, self.config[\"text_mime_types\"]\n )\n\n out = {\n \"statusCode\": response[\"status\"],\n \"body\": finalized_body,\n \"isBase64Encoded\": is_base64_encoded,\n }\n\n # You must use multiValueHeaders if you have enabled multi-value headers and\n # headers otherwise.\n multi_value_headers_enabled = \"multiValueHeaders\" in self.scope[\"aws.event\"]\n if multi_value_headers_enabled:\n out[\"multiValueHeaders\"] = handle_exclude_headers(multi_value_headers, self.config)\n else:\n out[\"headers\"] = handle_exclude_headers(finalized_headers, self.config)\n\n return out", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 3258}, "tests/test_adapter.py::33": {"resolved_imports": ["mangum/__init__.py", "mangum/adapter.py", "mangum/exceptions.py", "mangum/types.py"], "used_names": ["ConfigurationError", "Mangum", "pytest"], "enclosing_function": "test_invalid_options", "extracted_code": "# Source: mangum/__init__.py\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\nfrom mangum.adapter import Mangum\n\n__all__ = [\"Mangum\"]\n\n\n# Source: mangum/exceptions.py\nclass ConfigurationError(Exception):\n \"\"\"Raise when an error occurs parsing configuration.\"\"\"", "n_imports_parsed": 5, "n_files_resolved": 4, "n_chars_extracted": 271}}}
oracle_context_cache/Lancetnik__Propan.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/LonamiWebs__Telethon.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/LuteOrg__lute-v3.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/Lux-Luna__LunaVox.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/MarshalX__atproto.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/MartenBE__mkslides.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"repo": "MartenBE/mkslides", "n_pairs": 67, "version": "v2_function_scoped", "contexts": {"tests/utils.py::41": {"resolved_imports": [], "used_names": ["Path", "subprocess"], "enclosing_function": "__run_build_generic", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/utils.py::76": {"resolved_imports": [], "used_names": ["Path"], "enclosing_function": "assert_html_contains", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/baseline/test_baseline.py::31": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_process_directory_without_config", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/baseline/test_baseline.py::35": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_process_directory_without_config", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/baseline/test_baseline.py::32": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_process_directory_without_config", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/baseline/test_baseline.py::37": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_process_directory_without_config", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/baseline/test_baseline.py::36": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_process_directory_without_config", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/favicons/test_favicons.py::67": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_local_slideshow_favicon_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/favicons/test_favicons.py::45": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_local_index_favicon_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/favicons/test_favicons.py::62": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_local_slideshow_favicon_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/favicons/test_favicons.py::72": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_local_slideshow_favicon_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/favicons/test_favicons.py::16": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_absolute_url_index_favicon_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/frontmatter/test_frontmatter.py::162": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_frontmatter_paths_are_relative_to_mdfile", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/frontmatter/test_frontmatter.py::136": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_frontmatter_paths_are_relative_to_mdfile", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/frontmatter/test_frontmatter.py::166": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_frontmatter_paths_are_relative_to_mdfile", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/frontmatter/test_frontmatter.py::149": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_frontmatter_paths_are_relative_to_mdfile", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/frontmatter/test_frontmatter.py::21": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "assert_html_contains", "assert_html_contains_regexp", "re", "run_build_strict"], "enclosing_function": "test_frontmatter_overrides_default", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/frontmatter/test_frontmatter.py::140": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_frontmatter_paths_are_relative_to_mdfile", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/frontmatter/test_frontmatter.py::29": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "assert_html_contains", "assert_html_contains_regexp", "re", "run_build_strict"], "enclosing_function": "test_frontmatter_overrides_default", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/frontmatter/test_frontmatter.py::26": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "assert_html_contains", "assert_html_contains_regexp", "re", "run_build_strict"], "enclosing_function": "test_frontmatter_overrides_default", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/frontmatter/test_frontmatter.py::35": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "assert_html_contains", "assert_html_contains_regexp", "re", "run_build_strict"], "enclosing_function": "test_frontmatter_overrides_default", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/frontmatter/test_frontmatter.py::31": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "assert_html_contains", "assert_html_contains_regexp", "re", "run_build_strict"], "enclosing_function": "test_frontmatter_overrides_default", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/images/test_images.py::21": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "run_build_strict"], "enclosing_function": "test_process_directory_without_config", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/images/test_images.py::18": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "run_build_strict"], "enclosing_function": "test_process_directory_without_config", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/images/test_images.py::19": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "run_build_strict"], "enclosing_function": "test_process_directory_without_config", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/images/test_images.py::20": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "run_build_strict"], "enclosing_function": "test_process_directory_without_config", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/index/test_index.py::21": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_index_title", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/index/test_index.py::20": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_index_title", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/index/test_index.py::32": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_index_banner", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/markdown_data_options/test_markdown_data_options.py::19": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains_regexp", "re", "run_build_strict"], "enclosing_function": "test_revealjs_markdown_data_options", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/navtree/test_navtree.py::91": {"resolved_imports": ["src/mkslides/config.py", "src/mkslides/markupgenerator.py", "src/mkslides/navtree.py"], "used_names": ["Any", "DeepDiff", "MarkupGenerator", "NavTree", "get_config", "json"], "enclosing_function": "test_navtree_from_md_files", "extracted_code": "# Source: src/mkslides/config.py\ndef get_config(config_file: Path | None = None) -> DictConfig:\n config = OmegaConf.structured(Config)\n\n if not config_file and DEFAULT_CONFIG_LOCATION.exists():\n config_file = DEFAULT_CONFIG_LOCATION.resolve(strict=True).absolute()\n\n config.internal.config_path = config_file\n if config_file:\n try:\n loaded_config = OmegaConf.load(config_file)\n config = OmegaConf.merge(config, loaded_config)\n\n logger.info(f\"Loaded config from '{config_file}'\")\n except Exception:\n logger.exception(f\"Failed to load config from {config_file}\")\n raise\n\n assert OmegaConf.is_dict(config)\n\n logger.debug(f\"Used config:\\n\\n{OmegaConf.to_yaml(config, resolve=True)}\")\n\n return config\n\n\n# Source: src/mkslides/markupgenerator.py\nclass MarkupGenerator:\n def __init__(\n self,\n global_config: DictConfig,\n md_root_path: Path,\n output_directory_path: Path,\n strict: bool,\n ) -> None:\n self.global_config = global_config\n self.md_root_path = md_root_path.resolve(strict=True)\n self.output_directory_path = output_directory_path.resolve(strict=False)\n logger.info(\n f\"Output directory: '{self.output_directory_path.absolute()}'\",\n )\n\n self.output_assets_path = self.output_directory_path / OUTPUT_ASSETS_DIRNAME\n self.output_revealjs_path = self.output_assets_path / \"reveal-js\"\n self.output_highlightjs_themes_path = (\n self.output_assets_path / \"highlight-js-themes\"\n )\n\n self.strict = strict\n\n def process_markdown(self) -> None:\n \"\"\"Process the markdown files and generate HTML slideshows.\"\"\"\n logger.debug(\"Processing markdown\")\n start_time = time.perf_counter()\n\n self.__create_or_clear_output_directory()\n\n if self.md_root_path.is_file():\n assert self.md_root_path.suffix == \".md\", (\n \"md_root_path must be a markdown file\"\n )\n self.__process_markdown_file()\n else:\n self.__process_markdown_directory()\n\n end_time = time.perf_counter()\n logger.info(\n f\"Finished processing markdown in {end_time - start_time:.2f} seconds\",\n )\n\n def __create_or_clear_output_directory(self) -> None:\n \"\"\"Clear or create the output directory and copy reveal.js.\"\"\"\n if self.output_directory_path.exists():\n shutil.rmtree(self.output_directory_path)\n logger.debug(\"Output directory already exists, deleted\")\n\n self.output_directory_path.mkdir(parents=True, exist_ok=True)\n logger.debug(\"Output directory created\")\n\n with resources.as_file(REVEALJS_RESOURCE) as revealjs_path:\n self.__copy(revealjs_path, self.output_revealjs_path)\n\n with resources.as_file(HIGHLIGHTJS_THEMES_RESOURCE) as highlightjs_themes_path:\n self.__copy(highlightjs_themes_path, self.output_highlightjs_themes_path)\n\n def scan_files(self) -> tuple[list[MdFileToProcess], list[Path]]:\n \"\"\"Scan the markdown directory for markdown files and other files.\"\"\"\n md_files: list[MdFileToProcess] = []\n non_md_files: list[Path] = []\n\n for file in self.md_root_path.rglob(\"*\"):\n if file.is_file():\n resolved_file = file.resolve(strict=True)\n if resolved_file.suffix.lower() == \".md\":\n destination_path = (\n self.output_directory_path\n / resolved_file.relative_to(self.md_root_path).with_suffix(\n \".html\",\n )\n )\n\n md_files.append(\n self.__create_md_file_to_process(\n resolved_file,\n destination_path,\n ),\n )\n\n else:\n non_md_files.append(resolved_file)\n\n return md_files, non_md_files\n\n def __create_md_file_to_process(\n self,\n source_path: Path,\n destination_path: Path,\n ) -> MdFileToProcess:\n \"\"\"Create an MdFileToProcess instance from a markdown file.\"\"\"\n content = source_path.read_text(encoding=\"utf-8-sig\")\n frontmatter_metadata, markdown_content = frontmatter.parse(content)\n\n slide_config = self.__generate_slide_config(\n source_path,\n destination_path,\n frontmatter_metadata,\n )\n assert slide_config\n\n markdown_content = emojize(markdown_content, language=\"alias\")\n\n if preprocess_script := slide_config.slides.preprocess_script:\n preprocess_function = load_preprocessing_function(preprocess_script)\n if not preprocess_function:\n msg = (\n f\"Preprocessing function '{preprocess_script}' could not be loaded\"\n )\n raise ImportError(msg)\n markdown_content = preprocess_function(markdown_content)\n logger.debug(\n f\"Applied preprocessing function '{preprocess_script}' to markdown content of '{source_path}'\",\n )\n\n return MdFileToProcess(\n source_path=source_path,\n destination_path=destination_path,\n slide_config=slide_config,\n markdown_content=markdown_content,\n )\n\n def __process_markdown_file(self) -> None:\n \"\"\"Process the detected markdown file.\"\"\"\n absolute_input_path = self.md_root_path.absolute()\n logger.debug(f\"Processing markdown file at '{absolute_input_path}'\")\n logger.warning(\n f\"When you use a single file like '{absolute_input_path}' as `PATH`, only default static assets will be copied to the output folder. If you want to include images or other files, create a folder instead and pass that as `PATH`. Using a file as `PATH` is more meant for a quick slideshow in a pinch using only text.\",\n )\n\n destination_path = self.output_directory_path / \"index.html\"\n md_file_data = self.__create_md_file_to_process(\n self.md_root_path,\n destination_path,\n )\n\n self.__process_detected_markdown_files([md_file_data])\n\n def __process_markdown_directory(self) -> None:\n \"\"\"Process the detected markdown files in a directory.\"\"\"\n logger.debug(\n f\"Processing markdown directory at '{self.md_root_path.absolute()}'\",\n )\n\n md_files, non_md_files = self.scan_files()\n\n self.__process_detected_markdown_files(md_files, non_md_files)\n\n def __process_detected_markdown_files(\n self,\n md_files: list,\n non_md_files: list | None = None,\n ) -> None:\n \"\"\"Process the detected markdown files and copy non-markdown files.\"\"\"\n if non_md_files:\n for file in non_md_files:\n destination_path = self.output_directory_path / file.relative_to(\n self.md_root_path,\n )\n self.__copy(file, destination_path)\n\n self.__handle_relative_links(md_files)\n\n templates = self.__load_templates(md_files)\n\n if len(md_files) == 1:\n md_files[0].destination_path = self.output_directory_path / \"index.html\"\n else:\n self.__generate_index(md_files)\n\n self.__render_slideshows(md_files, templates)\n\n def __render_slideshows(\n self,\n md_files: list[MdFileToProcess],\n templates: dict[str, Template],\n ) -> None:\n \"\"\"Render all markdown files to HTML slideshows.\"\"\"\n for md_file_data in md_files:\n slide_config = md_file_data.slide_config\n\n slideshow_template = None\n if template_config := slide_config.slides.template:\n slideshow_template = templates[template_config]\n else:\n slideshow_template = DEFAULT_SLIDESHOW_TEMPLATE\n\n revealjs_path = self.output_revealjs_path.relative_to(\n md_file_data.destination_path.parent,\n walk_up=True,\n )\n\n # https://revealjs.com/markdown/#external-markdown\n markdown_data_options = {\n key: value\n for key, value in {\n \"data-separator\": slide_config.slides.separator,\n \"data-separator-vertical\": slide_config.slides.separator_vertical,\n \"data-separator-notes\": slide_config.slides.separator_notes,\n \"data-charset\": slide_config.slides.charset,\n }.items()\n if value\n }\n\n markup = slideshow_template.render(\n favicon=slide_config.slides.favicon,\n theme=slide_config.slides.theme,\n highlight_theme=slide_config.slides.highlight_theme,\n revealjs_path=revealjs_path,\n markdown_data_options=markdown_data_options,\n markdown=md_file_data.markdown_content,\n revealjs_config=OmegaConf.to_container(slide_config.revealjs),\n plugins=slide_config.plugins,\n )\n\n self.__create_or_overwrite_file(\n md_file_data.destination_path,\n markup,\n )\n\n def __load_templates(\n self,\n md_files: list[MdFileToProcess],\n ) -> dict[str, Template]:\n \"\"\"Load Jinja2 templates from the markdown files.\"\"\"\n templates: dict[str, Template] = {}\n\n for md_file_data in md_files:\n template = md_file_data.slide_config.slides.template\n if template and template not in templates:\n templates[template] = LOCAL_JINJA2_ENVIRONMENT.get_template(template)\n logger.debug(f\"Loaded custom template '{template}'\")\n\n return templates\n\n def __generate_theme_url(\n self,\n destination_path: Path,\n slide_config: DictConfig,\n frontmatter_metadata: dict[str, object],\n ) -> str | None:\n \"\"\"Generate the reveal.js theme URL.\"\"\"\n theme = slide_config.slides.theme\n\n if theme is None:\n return None\n\n if theme in REVEALJS_THEMES_LIST:\n return str(\n (\n self.output_revealjs_path / \"dist\" / \"theme\" / f\"{theme}.css\"\n ).relative_to(destination_path.parent, walk_up=True),\n )\n\n if get_url_type(theme) != URLType.RELATIVE or (\n \"slides\" in frontmatter_metadata\n and isinstance(frontmatter_metadata[\"slides\"], dict)\n and frontmatter_metadata[\"slides\"].get(\"theme\")\n ):\n return theme\n\n return str(\n (self.output_directory_path / theme).relative_to(\n destination_path.parent,\n walk_up=True,\n ),\n )\n\n def __generate_highlight_theme_url(\n self,\n destination_path: Path,\n slide_config: DictConfig,\n frontmatter_metadata: dict[str, object],\n ) -> str | None:\n \"\"\"Generate the highlight.js theme URL.\"\"\"\n highlight_theme = slide_config.slides.highlight_theme\n\n if highlight_theme is None:\n return None\n\n if highlight_theme in HIGHLIGHTJS_THEMES_LIST:\n return str(\n (\n self.output_highlightjs_themes_path / f\"{highlight_theme}.css\"\n ).relative_to(destination_path.parent, walk_up=True),\n )\n\n if get_url_type(highlight_theme) != URLType.RELATIVE or (\n \"slides\" in frontmatter_metadata\n and isinstance(frontmatter_metadata[\"slides\"], dict)\n and frontmatter_metadata[\"slides\"].get(\"highlight_theme\")\n ):\n return highlight_theme\n\n return str(\n (self.output_directory_path / highlight_theme).relative_to(\n destination_path.parent,\n walk_up=True,\n ),\n )\n\n def __generate_favicon_url(\n self,\n destination_path: Path,\n slide_config: DictConfig,\n frontmatter_metadata: dict[str, object],\n ) -> str | None:\n favicon = slide_config.slides.favicon\n\n if favicon is None:\n return None\n\n if get_url_type(favicon) != URLType.RELATIVE or (\n \"slides\" in frontmatter_metadata\n and isinstance(frontmatter_metadata[\"slides\"], dict)\n and frontmatter_metadata[\"slides\"].get(\"favicon\")\n ):\n return favicon\n\n return str(\n (self.output_directory_path / favicon).relative_to(\n destination_path.parent,\n walk_up=True,\n ),\n )\n\n def __generate_preprocess_script_absolute_path(\n self,\n source_path: Path,\n slide_config: DictConfig,\n frontmatter_metadata: dict[str, object],\n ) -> str | None:\n \"\"\"Generate the absolute path for the preprocess script if it is a relative URL.\"\"\"\n preprocess_script = slide_config.slides.preprocess_script\n\n if slide_config.slides.preprocess_script is None:\n return None\n\n if get_url_type(preprocess_script) != URLType.RELATIVE:\n return preprocess_script\n\n if (\n \"slides\" in frontmatter_metadata\n and isinstance(frontmatter_metadata[\"slides\"], dict)\n and frontmatter_metadata[\"slides\"].get(\"preprocess_script\")\n ):\n return str(\n (source_path.parent / preprocess_script).resolve(strict=True),\n )\n\n return str(\n (\n self.global_config.internal.config_path.parent / preprocess_script\n ).resolve(strict=True),\n )\n\n def __generate_slide_config(\n self,\n source_path: Path,\n destination_path: Path,\n frontmatter_metadata: dict[str, object],\n ) -> DictConfig:\n \"\"\"Generate the slide configuration by merging the metadata retrieved from the frontmatter of the markdown and the global configuration.\"\"\"\n slide_config: DictConfig = deepcopy(self.global_config)\n\n if frontmatter_metadata:\n for key in FRONTMATTER_ALLOWED_KEYS:\n if key in frontmatter_metadata:\n OmegaConf.update(slide_config, key, frontmatter_metadata[key])\n\n slide_config.slides.theme = self.__generate_theme_url(\n destination_path,\n slide_config,\n frontmatter_metadata,\n )\n\n slide_config.slides.highlight_theme = self.__generate_highlight_theme_url(\n destination_path,\n slide_config,\n frontmatter_metadata,\n )\n\n slide_config.slides.favicon = self.__generate_favicon_url(\n destination_path,\n slide_config,\n frontmatter_metadata,\n )\n\n slide_config.slides.preprocess_script = (\n self.__generate_preprocess_script_absolute_path(\n source_path,\n slide_config,\n frontmatter_metadata,\n )\n )\n\n return slide_config\n\n def __generate_index(self, md_files: list[MdFileToProcess]) -> None:\n \"\"\"Generate an index.html file in the output directory.\"\"\"\n logger.debug(\"Generating index\")\n\n navtree = NavTree(self.md_root_path, self.output_directory_path)\n if self.global_config.index.nav:\n nav_from_config = OmegaConf.to_container(self.global_config.index.nav)\n assert isinstance(nav_from_config, list), \"nav must be a list\"\n logger.debug(\"Generating navigation tree from config\")\n navtree.from_config_json(nav_from_config)\n navtree.validate_with_md_files(md_files, strict=self.strict)\n else:\n logger.debug(\"Generating navigation tree from markdown files\")\n navtree.from_md_files(md_files)\n\n logger.debug(\n f\"Generated navigation tree with input root path {navtree.input_root_path.absolute()} and output root path {navtree.output_root_path.absolute()}\",\n )\n\n if logger.isEnabledFor(logging.DEBUG):\n navtree_json = json.dumps(json.loads(navtree.to_json()), indent=4)\n logger.debug(f\"Navigation tree:\\n\\n{navtree_json}\\n\")\n\n # Refresh the templates here, so they have effect when live reloading\n index_template = None\n if template_config := self.global_config.index.template:\n index_template = LOCAL_JINJA2_ENVIRONMENT.get_template(template_config)\n else:\n index_template = DEFAULT_INDEX_TEMPLATE\n\n content = index_template.render(\n favicon=self.global_config.index.favicon,\n title=self.global_config.index.title,\n theme=self.global_config.index.theme,\n navtree=navtree,\n build_datetime=datetime.datetime.now(tz=datetime.UTC),\n enable_footer=self.global_config.index.enable_footer,\n )\n self.__create_or_overwrite_file(\n self.output_directory_path / \"index.html\",\n content,\n )\n\n def __create_or_overwrite_file(self, destination_path: Path, content: Any) -> None:\n \"\"\"Create or overwrite a file with the given content.\"\"\"\n is_overwrite = destination_path.exists()\n\n destination_path.parent.mkdir(parents=True, exist_ok=True)\n destination_path.write_text(content, encoding=\"utf-8\")\n\n action = \"Overwritten\" if is_overwrite else \"Created\"\n logger.debug(f\"{action} file '{destination_path}'\")\n\n def __copy(self, source_path: Path, destination_path: Path) -> None:\n \"\"\"Copy a file or directory from the source path to the destination path.\"\"\"\n is_overwrite = destination_path.exists()\n is_directory = source_path.is_dir()\n\n destination_path.parent.mkdir(parents=True, exist_ok=True)\n\n if is_directory:\n shutil.copytree(source_path, destination_path, dirs_exist_ok=True)\n else:\n shutil.copy(source_path, destination_path)\n\n action = \"Overwritten\" if is_overwrite else \"Copied\"\n file_or_directory = \"directory\" if is_directory else \"file\"\n logger.debug(\n f\"{action} {file_or_directory} '{source_path.absolute()}' to '{destination_path.absolute()}'\",\n )\n\n def __handle_relative_links(\n self,\n md_file_data: list[MdFileToProcess],\n ) -> None:\n \"\"\"Check if all relative link targets are present and normalize .md links.\"\"\"\n for md_file in md_file_data:\n content = md_file.markdown_content\n\n for link in self.__find_all_relative_links(content):\n link_path = md_file.source_path.parent / link\n relative_source_path = md_file.source_path.relative_to(\n self.md_root_path,\n )\n\n if not link_path.exists():\n msg = f\"File '{relative_source_path}' contains a link '{link}', but the target is not found among slide files.\"\n if self.strict:\n raise FileNotFoundError(msg)\n logger.warning(msg)\n elif link.lower().endswith(\".md\"):\n content = self.__replace_md_link_target(content, link)\n\n md_file.markdown_content = content\n\n def __find_all_relative_links(self, markdown_content: str) -> set[str]:\n \"\"\"Find all relative links in the given markdown content.\"\"\"\n html_content = markdown.markdown(markdown_content, extensions=[\"extra\"])\n soup = BeautifulSoup(html_content, \"html.parser\")\n\n found_links = set()\n\n for link in soup.find_all(\"a\", href=True):\n if not link.find_parents([\"code\", \"pre\"]):\n found_links.add(link[\"href\"])\n\n for link in soup.find_all(\"img\", src=True):\n if not link.find_parents([\"code\", \"pre\"]):\n found_links.add(link[\"src\"])\n\n for link in soup.find_all(\"source\", src=True):\n if not link.find_parents([\"code\", \"pre\"]):\n found_links.add(link[\"src\"])\n\n for comment in soup.find_all(string=lambda text: isinstance(text, Comment)):\n if match := HTML_BACKGROUND_IMAGE_REGEX.search(comment):\n found_links.add(match.group(\"location\"))\n\n relative_links = {\n link for link in found_links if get_url_type(link) == URLType.RELATIVE\n }\n\n return relative_links\n\n def __replace_md_link_target(self, content: str, link: str) -> str:\n \"\"\"Replace a specific .md link target with .html in markdown and HTML links.\"\"\"\n\n def _replacer(match: re.Match, *, link: str) -> str:\n matched_location = match.group(\"location\")\n\n # Only touch matches that correspond exactly to this link\n if matched_location != link:\n return match.group(0)\n\n new_location = MD_EXTENSION_REGEX.sub(\".html\", matched_location)\n return match.group(0).replace(matched_location, new_location)\n\n for regex in (MD_RELATIVE_LINK_REGEX, HTML_RELATIVE_LINK_REGEX):\n bound_replacer = partial(_replacer, link=link)\n content = regex.sub(bound_replacer, content)\n\n return content\n\n\n# Source: src/mkslides/navtree.py\nclass NavTree:\n def __init__(self, input_root_path: Path, output_root_path: Path) -> None:\n self.input_root_path = input_root_path\n self.output_root_path = output_root_path\n\n # Relative path as str is the index, title as str the data.\n self.tree = Tree()\n self.tree.create_node(identifier=\"root\")\n\n def from_md_files(self, md_files: list[MdFileToProcess]) -> None:\n for md_file in md_files:\n relative_source_path = md_file.source_path.relative_to(\n self.input_root_path,\n )\n parts = relative_source_path.parts\n\n current_relative_source_path = Path()\n parent_node_id = str(self.tree.root)\n for part in parts:\n current_relative_source_path /= part\n\n node_id = None\n if (self.input_root_path / current_relative_source_path).is_dir():\n node_id = str(current_relative_source_path)\n else:\n node_id = str(current_relative_source_path.with_suffix(\".html\"))\n\n node_data = None\n if md_file.slide_config.slides.title:\n node_data = md_file.slide_config.slides.title\n else:\n node_data = current_relative_source_path.stem\n\n if node_id not in self.tree:\n self.tree.create_node(\n identifier=node_id,\n parent=parent_node_id,\n data=node_data,\n )\n\n parent_node_id = node_id\n\n def from_config_json(self, json_data: list) -> None:\n assert isinstance(json_data, list), \"json data must be a list\"\n\n for item in json_data:\n self.__node_from_config_json(\n item,\n self.output_root_path,\n str(self.tree.root),\n )\n\n def __node_from_config_json(\n self,\n json_data: dict | str,\n current_path: Path,\n parent_node_id: str,\n ) -> None:\n # leaf node\n #\n # - filename.md\n #\n if isinstance(json_data, str):\n destination_path = (current_path / json_data).with_suffix(\".html\")\n node_id = str(destination_path.relative_to(self.output_root_path))\n node_data = destination_path.stem\n\n self.tree.create_node(\n identifier=node_id,\n parent=parent_node_id,\n data=node_data,\n )\n\n # category or leaf node with custom file name\n elif isinstance(json_data, dict):\n assert len(json_data.keys()) == 1, \"json dict must have one key\"\n\n title, content = next(iter(json_data.items()))\n\n # leaf node with custom name\n #\n # - custom-file-name: filename.md\n #\n if isinstance(content, str):\n destination_path = (current_path / content).with_suffix(\".html\")\n node_id = str(destination_path.relative_to(self.output_root_path))\n node_data = title\n\n self.tree.create_node(\n identifier=node_id,\n parent=parent_node_id,\n data=node_data,\n )\n\n # category node\n #\n # - category:\n # - ...\n #\n elif isinstance(content, list):\n destination_path = current_path / title\n node_id = str(f\"{destination_path.relative_to(self.output_root_path)}\")\n node_data = title\n\n self.tree.create_node(\n identifier=node_id,\n parent=parent_node_id,\n data=node_data,\n )\n\n for item in content:\n self.__node_from_config_json(item, destination_path, node_id)\n\n else:\n msg = f\"json dict must have a string or list as value, but value is of {type(content)}\"\n raise TypeError(msg)\n\n else:\n msg = (\n f\"json data must be a string or dict, but is of type {type(json_data)}\"\n )\n\n raise TypeError(msg)\n\n def is_node_leaf(self, node_id: str) -> bool:\n return self.tree[node_id].is_leaf(self.tree.identifier)\n\n def get_node_children(self, node_id: str) -> list:\n return sorted(self.tree.children(node_id), key=lambda n: n.identifier)\n\n def to_json(self) -> str:\n if not self.tree:\n return \"{}\"\n\n return self.tree.to_json(with_data=True)\n\n def validate_with_md_files(\n self,\n md_files: list[MdFileToProcess],\n strict: bool,\n ) -> None:\n md_file_relative_destination_paths = [\n str(md_file.destination_path.relative_to(self.output_root_path))\n for md_file in md_files\n ]\n\n files_not_in_navtree = []\n for md_file_relative_destination_path in md_file_relative_destination_paths:\n if md_file_relative_destination_path not in self.tree:\n source_file_name = str(\n Path(md_file_relative_destination_path).with_suffix(\".md\"),\n )\n files_not_in_navtree.append(source_file_name)\n\n if files_not_in_navtree:\n logger.info(\n \"The following pages exist in the slides directory, but are not included in the 'nav' configuration:\",\n )\n\n for file_name in files_not_in_navtree:\n logger.info(f\"\\t- {file_name}\")\n\n for node_id in self.tree.expand_tree():\n node = self.tree.get_node(node_id)\n assert node\n if (\n node.is_leaf(self.tree.identifier)\n and node.identifier not in md_file_relative_destination_paths\n ):\n source_file_name = Path(node.identifier).with_suffix(\".md\").name\n msg = f\"A reference to '{source_file_name}' is included in the 'nav' configuration, which is not found in the slideshow files.\"\n if strict:\n raise FileNotFoundError(msg)\n logger.warning(msg)", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 27622}, "tests/navtree/test_navtree.py::194": {"resolved_imports": ["src/mkslides/config.py", "src/mkslides/markupgenerator.py", "src/mkslides/navtree.py"], "used_names": ["Any", "re", "subprocess"], "enclosing_function": "test_files_not_in_folder_without_strict", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 3, "n_chars_extracted": 0}, "tests/plugins/test_plugins.py::25": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "assert_html_contains_regexp", "re", "run_build_strict"], "enclosing_function": "test_plugins", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/plugins/test_plugins.py::29": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "assert_html_contains_regexp", "re", "run_build_strict"], "enclosing_function": "test_plugins", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/plugins/test_plugins.py::21": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "assert_html_contains_regexp", "re", "run_build_strict"], "enclosing_function": "test_plugins", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/plugins/test_plugins.py::37": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "assert_html_contains_regexp", "re", "run_build_strict"], "enclosing_function": "test_plugins", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/plugins/test_plugins.py::33": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "assert_html_contains_regexp", "re", "run_build_strict"], "enclosing_function": "test_plugins", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/preprocessing/test_preprocessing.py::17": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains_regexp", "re", "run_build_strict"], "enclosing_function": "test_preprocessing", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/preprocessing/test_preprocessing.py::31": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains_regexp", "re", "run_build_strict"], "enclosing_function": "test_preprocessing", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/relative_links/test_relative_links.py::43": {"resolved_imports": [], "used_names": ["Any", "re", "subprocess"], "enclosing_function": "test_non_existing_relative_links_without_strict", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/relative_slideshow_links/test_relative_slideshow_links.py::94": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_relative_slideshow_links", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/relative_slideshow_links/test_relative_slideshow_links.py::18": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_relative_slideshow_links", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/relative_slideshow_links/test_relative_slideshow_links.py::19": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_relative_slideshow_links", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/relative_slideshow_links/test_relative_slideshow_links.py::98": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_relative_slideshow_links", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/relative_slideshow_links/test_relative_slideshow_links.py::20": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_relative_slideshow_links", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/revealjs_options/test_revealjs_options.py::21": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_revealjs_default_options", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/revealjs_options/test_revealjs_options.py::53": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains_regexp", "re", "run_build_strict"], "enclosing_function": "test_revealjs_string_options", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/revealjs_options/test_revealjs_options.py::30": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains_regexp", "re", "run_build_strict"], "enclosing_function": "test_revealjs_integer_options", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/single_md_in_folder/test_single_md_in_folder.py::33": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_multiple_md_files_in_folder", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/single_md_in_folder/test_single_md_in_folder.py::20": {"resolved_imports": [], "used_names": ["Any", "assert_file_does_not_exist", "assert_file_exist", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_single_md_files_in_folder", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/single_md_in_folder/test_single_md_in_folder.py::21": {"resolved_imports": [], "used_names": ["Any", "assert_file_does_not_exist", "assert_file_exist", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_single_md_files_in_folder", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/single_md_in_folder/test_single_md_in_folder.py::23": {"resolved_imports": [], "used_names": ["Any", "assert_file_does_not_exist", "assert_file_exist", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_single_md_files_in_folder", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/single_md_in_folder/test_single_md_in_folder.py::24": {"resolved_imports": [], "used_names": ["Any", "assert_file_does_not_exist", "assert_file_exist", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_single_md_files_in_folder", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/text/test_emojis.py::23": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_emojize", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/text/test_emojis.py::22": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_emojize", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/themes/test_themes.py::46": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_local_slideshow_theme_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/themes/test_themes.py::20": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_local_slideshow_theme_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/themes/test_themes.py::33": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_local_slideshow_theme_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/themes/test_themes.py::50": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_local_slideshow_theme_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/themes/test_themes.py::59": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_local_slideshow_theme_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/themes/test_themes.py::108": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_builtin_slideshow_theme_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/themes/test_themes.py::79": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_absolute_url_slideshow_theme_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/themes/test_themes.py::83": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_absolute_url_slideshow_theme_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/themes/test_themes.py::75": {"resolved_imports": [], "used_names": ["Any", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_absolute_url_slideshow_theme_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/themes/test_themes.py::118": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_builtin_slideshow_theme_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/themes/test_themes.py::123": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_builtin_slideshow_theme_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}, "tests/themes/test_themes.py::132": {"resolved_imports": [], "used_names": ["Any", "assert_file_exist", "assert_html_contains", "run_build_strict"], "enclosing_function": "test_builtin_slideshow_theme_path", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 0, "n_chars_extracted": 0}}}
oracle_context_cache/MasoniteFramework__masonite.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/MaxHalford__prince.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"repo": "MaxHalford/prince", "n_pairs": 42, "version": "v2_function_scoped", "contexts": {"tests/test_ca.py::95": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_eigenvalues", "extracted_code": "", "n_imports_parsed": 13, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_famd.py::73": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_eigenvalues", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_gpa.py::47": {"resolved_imports": ["prince/__init__.py"], "used_names": ["prince"], "enclosing_function": "test_fit_bad_init", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_gpa.py::34": {"resolved_imports": ["prince/__init__.py"], "used_names": ["prince"], "enclosing_function": "test_fit", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_mca.py::83": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_col_cos2", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_mca.py::70": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_col_coords", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_pca.py::137": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_eigenvalues", "extracted_code": "", "n_imports_parsed": 12, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_gpa.py::82": {"resolved_imports": ["prince/__init__.py"], "used_names": ["prince"], "enclosing_function": "test_copy", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_pca.py::128": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_eigenvalues", "extracted_code": "", "n_imports_parsed": 12, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_ca.py::113": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_row_contrib", "extracted_code": "", "n_imports_parsed": 13, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_famd.py::66": {"resolved_imports": ["prince/__init__.py"], "used_names": [], "enclosing_function": "test_cat_cols", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_pca.py::165": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_row_contrib", "extracted_code": "", "n_imports_parsed": 12, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_mfa.py::76": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_eigenvalues", "extracted_code": "", "n_imports_parsed": 12, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_ca.py::94": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_eigenvalues", "extracted_code": "", "n_imports_parsed": 13, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_ca.py::108": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_row_coords", "extracted_code": "", "n_imports_parsed": 13, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_ca.py::120": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_row_cosine_similarities", "extracted_code": "", "n_imports_parsed": 13, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_pca.py::127": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_eigenvalues", "extracted_code": "", "n_imports_parsed": 12, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_pca.py::160": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_row_cosine_similarities", "extracted_code": "", "n_imports_parsed": 12, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_pca.py::149": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R", "pytest"], "enclosing_function": "test_row_coords", "extracted_code": "", "n_imports_parsed": 12, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_gpa.py::68": {"resolved_imports": ["prince/__init__.py"], "used_names": ["prince"], "enclosing_function": "test_fit_transform_equal", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_pca.py::129": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_eigenvalues", "extracted_code": "", "n_imports_parsed": 12, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_gpa.py::75": {"resolved_imports": ["prince/__init__.py"], "used_names": ["prince"], "enclosing_function": "test_fit_transform_single", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_famd.py::72": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_eigenvalues", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_ca.py::96": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_eigenvalues", "extracted_code": "", "n_imports_parsed": 13, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_famd.py::71": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_eigenvalues", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_svd.py::64": {"resolved_imports": ["prince/__init__.py", "prince/svd.py"], "used_names": ["load_df_from_R", "svd"], "enclosing_function": "test_U", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_famd.py::82": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R", "pytest"], "enclosing_function": "test_row_coords", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_mfa.py::77": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_eigenvalues", "extracted_code": "", "n_imports_parsed": 12, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_mfa.py::75": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_eigenvalues", "extracted_code": "", "n_imports_parsed": 12, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_svd.py::71": {"resolved_imports": ["prince/__init__.py", "prince/svd.py"], "used_names": ["robjects", "svd"], "enclosing_function": "test_s", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_svd.py::68": {"resolved_imports": ["prince/__init__.py", "prince/svd.py"], "used_names": ["load_df_from_R", "svd"], "enclosing_function": "test_U", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_svd.py::78": {"resolved_imports": ["prince/__init__.py", "prince/svd.py"], "used_names": ["load_df_from_R", "svd"], "enclosing_function": "test_V", "extracted_code": "", "n_imports_parsed": 7, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_pca.py::136": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_eigenvalues", "extracted_code": "", "n_imports_parsed": 12, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_gpa.py::59": {"resolved_imports": ["prince/__init__.py"], "used_names": ["prince"], "enclosing_function": "test_transform", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_mca.py::199": {"resolved_imports": ["prince/__init__.py"], "used_names": ["prince"], "enclosing_function": "test_type_doesnt_matter", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_gpa.py::86": {"resolved_imports": ["prince/__init__.py"], "used_names": ["prince"], "enclosing_function": "test_copy", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_mfa.py::106": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R", "pytest"], "enclosing_function": "test_row_coords", "extracted_code": "", "n_imports_parsed": 12, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_famd.py::58": {"resolved_imports": ["prince/__init__.py"], "used_names": [], "enclosing_function": "test_num_cols", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_gpa.py::60": {"resolved_imports": ["prince/__init__.py"], "used_names": ["prince"], "enclosing_function": "test_transform", "extracted_code": "", "n_imports_parsed": 5, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_famd.py::87": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_row_contrib", "extracted_code": "", "n_imports_parsed": 9, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_mfa.py::111": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R"], "enclosing_function": "test_row_contrib", "extracted_code": "", "n_imports_parsed": 12, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_ca.py::79": {"resolved_imports": ["prince/__init__.py"], "used_names": ["load_df_from_R", "sparse"], "enclosing_function": "test_svd_U", "extracted_code": "", "n_imports_parsed": 13, "n_files_resolved": 1, "n_chars_extracted": 0}}}
oracle_context_cache/Mayitzin__ahrs.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"repo": "Mayitzin/ahrs", "n_pairs": 45, "version": "v2_function_scoped", "contexts": {"tests/test_core_functions.py::11": {"resolved_imports": ["ahrs/utils/core.py"], "used_names": [], "enclosing_function": "test_assert_numerical_iterable", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_estimators.py::353": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_adaptive_gain", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_dcm.py::40": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_rotation_matrix_from_euler_angles", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_common_tools.py::14": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_geometry_circle_default", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wgs84.py::22": {"resolved_imports": ["ahrs/__init__.py"], "used_names": [], "enclosing_function": "test_normal_gravity", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_quaternions.py::27": {"resolved_imports": ["ahrs/__init__.py"], "used_names": [], "enclosing_function": "test_identity_quaternion", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_common_tools.py::23": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_geometry_circle_custom", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wgs84.py::21": {"resolved_imports": ["ahrs/__init__.py"], "used_names": [], "enclosing_function": "test_normal_gravity", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wgs84.py::7": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_correct_values", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wgs84.py::23": {"resolved_imports": ["ahrs/__init__.py"], "used_names": [], "enclosing_function": "test_normal_gravity", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_common_tools.py::16": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_geometry_circle_default", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_dcm.py::60": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_wrong_input_matrix", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_estimators.py::24": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_wrong_frame", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wgs84.py::13": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_correct_values", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wmm.py::84": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["os"], "enclosing_function": "test_wmm2015", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wgs84.py::28": {"resolved_imports": ["ahrs/__init__.py"], "used_names": [], "enclosing_function": "test_values", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wmm.py::85": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["os"], "enclosing_function": "test_wmm2015", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_common_tools.py::12": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_geometry_circle_default", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_quaternions.py::338": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_conjugate", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wgs84.py::27": {"resolved_imports": ["ahrs/__init__.py"], "used_names": [], "enclosing_function": "test_values", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_quaternions.py::287": {"resolved_imports": ["ahrs/__init__.py"], "used_names": [], "enclosing_function": "test_identity_quaternion", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wgs84.py::12": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_correct_values", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wgs84.py::24": {"resolved_imports": ["ahrs/__init__.py"], "used_names": [], "enclosing_function": "test_normal_gravity", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_metrics.py::8": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_correct_values", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_dcm.py::39": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_rotation_matrix_from_euler_angles", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_core_functions.py::8": {"resolved_imports": ["ahrs/utils/core.py"], "used_names": [], "enclosing_function": "test_assert_same_shapes", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_dcm.py::38": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_rotation_matrix_from_euler_angles", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wmm.py::88": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["os"], "enclosing_function": "test_wmm2015", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_core_functions.py::19": {"resolved_imports": ["ahrs/utils/core.py"], "used_names": [], "enclosing_function": "test_get_nan_intervals", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wmm.py::86": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["os"], "enclosing_function": "test_wmm2015", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_quaternions.py::108": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_wrong_input_array", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_estimators.py::21": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_multiple_values", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wmm.py::87": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["os"], "enclosing_function": "test_wmm2015", "extracted_code": "", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wgs84.py::8": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_correct_values", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wgs84.py::31": {"resolved_imports": ["ahrs/__init__.py"], "used_names": [], "enclosing_function": "test_values", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_estimators.py::358": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_adaptive_gain", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_quaternions.py::126": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_random_attitudes", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_wgs84.py::14": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_correct_values", "extracted_code": "", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_metrics.py::30": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_guard_clauses", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_quaternions.py::396": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_one_random_attitude", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_estimators.py::350": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_adaptive_gain", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_quaternions.py::28": {"resolved_imports": ["ahrs/__init__.py"], "used_names": [], "enclosing_function": "test_identity_quaternion", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_dcm.py::20": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_rotation_matrix_in_SO3", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_quaternions.py::35": {"resolved_imports": ["ahrs/__init__.py"], "used_names": [], "enclosing_function": "test_conjugate", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}, "tests/test_common_tools.py::21": {"resolved_imports": ["ahrs/__init__.py"], "used_names": ["ahrs"], "enclosing_function": "test_geometry_circle_custom", "extracted_code": "", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 0}}}
oracle_context_cache/MerrimanInd__drawpyo.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/MiniMax-AI__Mini-Agent.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/MinishLab__model2vec.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/MinishLab__semhash.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"repo": "MinishLab/semhash", "n_pairs": 33, "version": "v2_function_scoped", "contexts": {"tests/test_utils.py::14": {"resolved_imports": ["semhash/records.py", "semhash/utils.py"], "used_names": ["make_hashable"], "enclosing_function": "test_make_hashable", "extracted_code": "# Source: semhash/utils.py\ndef make_hashable(value: Any) -> Any:\n \"\"\"\n Convert a value to a hashable representation for use as dict keys.\n\n Strings and other hashable types are returned as-is.\n Non-hashable types (like PIL images, numpy arrays) are hashed to a string.\n\n :param value: The value to make hashable.\n :return: A hashable representation of the value.\n \"\"\"\n # Fast path: most values are strings or already hashable\n if isinstance(value, (str, int, float, bool, type(None))):\n return value\n # Handle objects with tobytes() (PIL Image, numpy array, etc.)\n if hasattr(value, \"tobytes\"):\n return hashlib.md5(value.tobytes()).hexdigest()\n # Fallback: try to hash, otherwise stringify\n try:\n hash(value)\n return value\n except TypeError:\n return str(value)", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 837}, "tests/test_utils.py::45": {"resolved_imports": ["semhash/records.py", "semhash/utils.py"], "used_names": ["coerce_value"], "enclosing_function": "test_coerce_value", "extracted_code": "# Source: semhash/utils.py\ndef coerce_value(value: Any) -> Any:\n \"\"\"\n Coerce a value for encoding: stringify primitives, keep complex types raw.\n\n This ensures primitives (int, float, bool) work with text encoders,\n while complex types (PIL images, tensors, etc.) are passed through for multimodal encoders.\n\n :param value: The value to coerce.\n :return: The coerced value.\n \"\"\"\n if isinstance(value, (str, bytes)):\n return value\n if isinstance(value, (int, float, bool)):\n return str(value)\n return value", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 549}, "tests/test_utils.py::15": {"resolved_imports": ["semhash/records.py", "semhash/utils.py"], "used_names": ["make_hashable"], "enclosing_function": "test_make_hashable", "extracted_code": "# Source: semhash/utils.py\ndef make_hashable(value: Any) -> Any:\n \"\"\"\n Convert a value to a hashable representation for use as dict keys.\n\n Strings and other hashable types are returned as-is.\n Non-hashable types (like PIL images, numpy arrays) are hashed to a string.\n\n :param value: The value to make hashable.\n :return: A hashable representation of the value.\n \"\"\"\n # Fast path: most values are strings or already hashable\n if isinstance(value, (str, int, float, bool, type(None))):\n return value\n # Handle objects with tobytes() (PIL Image, numpy array, etc.)\n if hasattr(value, \"tobytes\"):\n return hashlib.md5(value.tobytes()).hexdigest()\n # Fallback: try to hash, otherwise stringify\n try:\n hash(value)\n return value\n except TypeError:\n return str(value)", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 837}, "tests/test_utils.py::117": {"resolved_imports": ["semhash/records.py", "semhash/utils.py"], "used_names": ["remove_exact_duplicates"], "enclosing_function": "test_remove_exact_duplicates", "extracted_code": "# Source: semhash/records.py\ndef remove_exact_duplicates(\n records: Sequence[dict[str, Any]],\n columns: Sequence[str],\n reference_records: list[list[dict[str, Any]]] | None = None,\n) -> tuple[list[dict[str, Any]], list[tuple[dict[str, Any], list[dict[str, Any]]]]]:\n \"\"\"\n Remove exact duplicates based on the hashable representation of each record.\n\n If reference_records is None, the function will only check for duplicates within the records list.\n\n :param records: A list of records to check for exact duplicates.\n :param columns: Columns to unpack.\n :param reference_records: A list of records to compare against. These are already unpacked\n :return: A list of deduplicated records and a list of duplicates.\n \"\"\"\n deduplicated: list[dict[str, Any]] = []\n duplicates: list[tuple[dict[str, Any], list[dict[str, Any]]]] = []\n\n column_set = set(columns)\n\n # Build seen set from reference_records (cross-dataset mode) or empty (single-dataset mode)\n seen: defaultdict[frozendict[str, Any], list[dict[str, Any]]] = defaultdict(list)\n if reference_records is not None:\n for record_set in reference_records:\n key = to_frozendict(record_set[0], column_set)\n seen[key] = list(record_set)\n\n for record in records:\n frozen_record = to_frozendict(record, column_set)\n if duplicated_records := seen.get(frozen_record):\n duplicates.append((record, duplicated_records))\n else:\n deduplicated.append(record)\n # Single-dataset mode: track this record for future comparisons\n if reference_records is None:\n seen[frozen_record].append(record)\n\n return deduplicated, duplicates", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 1725}, "tests/test_datamodels.py::42": {"resolved_imports": ["semhash/datamodels.py"], "used_names": ["DuplicateRecord"], "enclosing_function": "test_rethreshold", "extracted_code": "# Source: semhash/datamodels.py\nclass DuplicateRecord(Generic[Record]):\n \"\"\"\n A single record with its duplicates.\n\n Attributes\n ----------\n record: The original record being deduplicated.\n exact: Whether the record was identified as an exact match.\n duplicates: List of tuples consisting of duplicate records and their associated scores.\n\n \"\"\"\n\n record: Record\n exact: bool\n duplicates: DuplicateList = field(default_factory=list)\n\n def _rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n self.duplicates = [(d, score) for d, score in self.duplicates if score >= threshold]", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 666}, "tests/test_utils.py::81": {"resolved_imports": ["semhash/records.py", "semhash/utils.py"], "used_names": ["compute_candidate_limit"], "enclosing_function": "test_compute_candidate_limit", "extracted_code": "# Source: semhash/utils.py\ndef compute_candidate_limit(\n total: int,\n selection_size: int,\n fraction: float = 0.1,\n min_candidates: int = 100,\n max_candidates: int = 1000,\n) -> int:\n \"\"\"\n Compute the 'auto' candidate limit based on the total number of records.\n\n :param total: Total number of records.\n :param selection_size: Number of representatives to select.\n :param fraction: Fraction of total records to consider as candidates.\n :param min_candidates: Minimum number of candidates.\n :param max_candidates: Maximum number of candidates.\n :return: Computed candidate limit.\n \"\"\"\n # 1) fraction of total\n limit = int(total * fraction)\n # 2) ensure enough to pick selection_size\n limit = max(limit, selection_size)\n # 3) enforce lower bound\n limit = max(limit, min_candidates)\n # 4) enforce upper bound (and never exceed the dataset)\n limit = min(limit, max_candidates, total)\n return limit", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 961}, "tests/test_datamodels.py::123": {"resolved_imports": ["semhash/datamodels.py"], "used_names": ["DeduplicationResult", "DuplicateRecord"], "enclosing_function": "test_selected_with_duplicates_dicts", "extracted_code": "# Source: semhash/datamodels.py\nclass DuplicateRecord(Generic[Record]):\n \"\"\"\n A single record with its duplicates.\n\n Attributes\n ----------\n record: The original record being deduplicated.\n exact: Whether the record was identified as an exact match.\n duplicates: List of tuples consisting of duplicate records and their associated scores.\n\n \"\"\"\n\n record: Record\n exact: bool\n duplicates: DuplicateList = field(default_factory=list)\n\n def _rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n self.duplicates = [(d, score) for d, score in self.duplicates if score >= threshold]\n\nclass DeduplicationResult(Generic[Record]):\n \"\"\"\n Deduplication result.\n\n Attributes\n ----------\n selected: List of deduplicated records after removing duplicates.\n filtered: List of DuplicateRecord objects containing details about duplicates of an original record.\n threshold: The similarity threshold used for deduplication.\n columns: Columns used for deduplication.\n\n \"\"\"\n\n selected: list[Record] = field(default_factory=list)\n filtered: list[DuplicateRecord] = field(default_factory=list)\n threshold: float = field(default=0.9)\n columns: Sequence[str] | None = field(default=None)\n\n @property\n def duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return 1.0 - len(self.selected) / denom\n return 0.0\n\n @property\n def exact_duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped due to an exact match.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return len([dup for dup in self.filtered if dup.exact]) / denom\n return 0.0\n\n def get_least_similar_from_duplicates(self, n: int = 1) -> list[tuple[Record, Record, float]]:\n \"\"\"\n Return the N least similar duplicate pairs.\n\n :param n: The number of least similar pairs to return.\n :return: A list of tuples consisting of (original_record, duplicate_record, score).\n \"\"\"\n all_pairs = [(dup.record, d, score) for dup in self.filtered for d, score in dup.duplicates]\n sorted_pairs = sorted(all_pairs, key=lambda x: x[2]) # Sort by score\n return sorted_pairs[:n]\n\n def rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n if self.threshold > threshold:\n raise ValueError(\"Threshold is smaller than the given value.\")\n # Invalidate cached property before modifying data\n self.__dict__.pop(\"selected_with_duplicates\", None)\n # Rethreshold duplicates and move records without duplicates to selected\n for dup in list(self.filtered):\n dup._rethreshold(threshold)\n if not dup.duplicates:\n self.filtered.remove(dup)\n self.selected.append(dup.record)\n self.threshold = threshold\n\n @cached_property\n def selected_with_duplicates(self) -> list[SelectedWithDuplicates[Record]]:\n \"\"\"\n For every kept record, return the duplicates that were removed along with their similarity scores.\n\n :return: A list of tuples where each tuple contains a kept record\n and a list of its duplicates with their similarity scores.\n \"\"\"\n\n def _to_hashable(record: Record) -> frozendict[str, str] | str:\n \"\"\"Convert a record to a hashable representation.\"\"\"\n if isinstance(record, dict) and self.columns is not None:\n # Convert dict to frozendict for immutability and hashability\n return to_frozendict(record, set(self.columns))\n return str(record)\n\n # Build a mapping from original-record to [(duplicate, score), …]\n buckets: defaultdict[Hashable, DuplicateList] = defaultdict(list)\n for duplicate_record in self.filtered:\n for original_record, score in duplicate_record.duplicates:\n buckets[_to_hashable(original_record)].append((duplicate_record.record, float(score)))\n\n result: list[SelectedWithDuplicates[Record]] = []\n for selected in self.selected:\n # Get the list of duplicates for the selected record\n raw_list = buckets.get(_to_hashable(selected), [])\n # Ensure we don't have duplicates in the list\n # Use full-record canonical JSON for dicts so that unhashable values are handled correctly\n deduped = {\n (\n json.dumps(rec, sort_keys=True, separators=(\",\", \":\"), ensure_ascii=False)\n if isinstance(rec, dict)\n else rec\n ): (rec, score)\n for rec, score in raw_list\n }\n result.append(SelectedWithDuplicates(record=selected, duplicates=list(deduped.values())))\n\n return result", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 4987}, "tests/test_utils.py::44": {"resolved_imports": ["semhash/records.py", "semhash/utils.py"], "used_names": ["coerce_value"], "enclosing_function": "test_coerce_value", "extracted_code": "# Source: semhash/utils.py\ndef coerce_value(value: Any) -> Any:\n \"\"\"\n Coerce a value for encoding: stringify primitives, keep complex types raw.\n\n This ensures primitives (int, float, bool) work with text encoders,\n while complex types (PIL images, tensors, etc.) are passed through for multimodal encoders.\n\n :param value: The value to coerce.\n :return: The coerced value.\n \"\"\"\n if isinstance(value, (str, bytes)):\n return value\n if isinstance(value, (int, float, bool)):\n return str(value)\n return value", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 549}, "tests/test_semhash.py::57": {"resolved_imports": ["semhash/__init__.py", "semhash/datamodels.py", "semhash/utils.py"], "used_names": ["Encoder", "SemHash"], "enclosing_function": "test_multi_dataset_deduplication", "extracted_code": "# Source: semhash/__init__.py\nfrom pyversity import Strategy\n\nfrom semhash.semhash import SemHash\n\n__all__ = [\"SemHash\", \"Strategy\"]\n\nfrom semhash.semhash import SemHash\n\n__all__ = [\"SemHash\", \"Strategy\"]\n\n\n# Source: semhash/utils.py\nclass Encoder(Protocol):\n \"\"\"An encoder protocol for SemHash. Supports text, images, or any encodable data.\"\"\"\n\n def encode(\n self,\n inputs: Sequence[Any] | Any,\n **kwargs: Any,\n ) -> np.ndarray:\n \"\"\"\n Encode a list of inputs into embeddings.\n\n :param inputs: A list of inputs to encode (strings, images, etc.).\n :param **kwargs: Additional keyword arguments.\n :return: The embeddings of the inputs.\n \"\"\"\n ...", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 722}, "tests/test_utils.py::151": {"resolved_imports": ["semhash/records.py", "semhash/utils.py"], "used_names": ["prepare_records", "pytest"], "enclosing_function": "test_prepare_records", "extracted_code": "# Source: semhash/records.py\ndef prepare_records(\n records: Sequence[Record], columns: Sequence[str] | None\n) -> tuple[list[dict[str, Any]], Sequence[str], bool]:\n \"\"\"\n Validate and prepare records for processing.\n\n :param records: A list of records (strings or dictionaries).\n :param columns: Columns to use if records are dictionaries.\n :return: Tuple of (dict_records, columns, was_string).\n :raises ValueError: If records are empty.\n :raises ValueError: If columns are not provided for dictionary records.\n :raises ValueError: If dict record contains None values.\n :raises ValueError: If records are not homogeneous (mixed strings and dicts).\n \"\"\"\n if len(records) == 0:\n raise ValueError(\"records must not be empty\")\n\n if columns is None and isinstance(records[0], dict):\n raise ValueError(\"Columns must be specified when passing dictionaries.\")\n\n # String path: convert to dicts with \"text\" column\n if isinstance(records[0], str):\n if not all(isinstance(r, str) for r in records):\n raise ValueError(\"All records must be strings when the first record is a string.\")\n columns = [\"text\"]\n dict_records: list[dict[str, Any]] = [{\"text\": record} for record in records]\n was_string = True\n # Dict path: validate and coerce values\n else:\n if not all(isinstance(r, dict) for r in records):\n raise ValueError(\"All records must be dicts when the first record is a dict.\")\n assert columns is not None\n\n # Coerce values: stringify primitives, keep complex types raw (for images, etc.)\n dict_records_typed: list[dict[str, Any]] = list(records)\n dict_records = []\n for record in dict_records_typed:\n # Start with a copy of the full record to preserve non-embedding fields\n coerced: dict[str, Any] = dict(record)\n # Then coerce only the embedding columns\n for column in columns:\n val = record.get(column)\n if val is None:\n raise ValueError(f\"Column '{column}' has None value in record {record}\")\n coerced[column] = coerce_value(val)\n dict_records.append(coerced)\n was_string = False\n\n return dict_records, columns, was_string", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 2302}, "tests/test_datamodels.py::224": {"resolved_imports": ["semhash/datamodels.py"], "used_names": ["DeduplicationResult", "DuplicateRecord"], "enclosing_function": "test_selected_with_duplicates_cache_invalidation_on_rethreshold", "extracted_code": "# Source: semhash/datamodels.py\nclass DuplicateRecord(Generic[Record]):\n \"\"\"\n A single record with its duplicates.\n\n Attributes\n ----------\n record: The original record being deduplicated.\n exact: Whether the record was identified as an exact match.\n duplicates: List of tuples consisting of duplicate records and their associated scores.\n\n \"\"\"\n\n record: Record\n exact: bool\n duplicates: DuplicateList = field(default_factory=list)\n\n def _rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n self.duplicates = [(d, score) for d, score in self.duplicates if score >= threshold]\n\nclass DeduplicationResult(Generic[Record]):\n \"\"\"\n Deduplication result.\n\n Attributes\n ----------\n selected: List of deduplicated records after removing duplicates.\n filtered: List of DuplicateRecord objects containing details about duplicates of an original record.\n threshold: The similarity threshold used for deduplication.\n columns: Columns used for deduplication.\n\n \"\"\"\n\n selected: list[Record] = field(default_factory=list)\n filtered: list[DuplicateRecord] = field(default_factory=list)\n threshold: float = field(default=0.9)\n columns: Sequence[str] | None = field(default=None)\n\n @property\n def duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return 1.0 - len(self.selected) / denom\n return 0.0\n\n @property\n def exact_duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped due to an exact match.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return len([dup for dup in self.filtered if dup.exact]) / denom\n return 0.0\n\n def get_least_similar_from_duplicates(self, n: int = 1) -> list[tuple[Record, Record, float]]:\n \"\"\"\n Return the N least similar duplicate pairs.\n\n :param n: The number of least similar pairs to return.\n :return: A list of tuples consisting of (original_record, duplicate_record, score).\n \"\"\"\n all_pairs = [(dup.record, d, score) for dup in self.filtered for d, score in dup.duplicates]\n sorted_pairs = sorted(all_pairs, key=lambda x: x[2]) # Sort by score\n return sorted_pairs[:n]\n\n def rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n if self.threshold > threshold:\n raise ValueError(\"Threshold is smaller than the given value.\")\n # Invalidate cached property before modifying data\n self.__dict__.pop(\"selected_with_duplicates\", None)\n # Rethreshold duplicates and move records without duplicates to selected\n for dup in list(self.filtered):\n dup._rethreshold(threshold)\n if not dup.duplicates:\n self.filtered.remove(dup)\n self.selected.append(dup.record)\n self.threshold = threshold\n\n @cached_property\n def selected_with_duplicates(self) -> list[SelectedWithDuplicates[Record]]:\n \"\"\"\n For every kept record, return the duplicates that were removed along with their similarity scores.\n\n :return: A list of tuples where each tuple contains a kept record\n and a list of its duplicates with their similarity scores.\n \"\"\"\n\n def _to_hashable(record: Record) -> frozendict[str, str] | str:\n \"\"\"Convert a record to a hashable representation.\"\"\"\n if isinstance(record, dict) and self.columns is not None:\n # Convert dict to frozendict for immutability and hashability\n return to_frozendict(record, set(self.columns))\n return str(record)\n\n # Build a mapping from original-record to [(duplicate, score), …]\n buckets: defaultdict[Hashable, DuplicateList] = defaultdict(list)\n for duplicate_record in self.filtered:\n for original_record, score in duplicate_record.duplicates:\n buckets[_to_hashable(original_record)].append((duplicate_record.record, float(score)))\n\n result: list[SelectedWithDuplicates[Record]] = []\n for selected in self.selected:\n # Get the list of duplicates for the selected record\n raw_list = buckets.get(_to_hashable(selected), [])\n # Ensure we don't have duplicates in the list\n # Use full-record canonical JSON for dicts so that unhashable values are handled correctly\n deduped = {\n (\n json.dumps(rec, sort_keys=True, separators=(\",\", \":\"), ensure_ascii=False)\n if isinstance(rec, dict)\n else rec\n ): (rec, score)\n for rec, score in raw_list\n }\n result.append(SelectedWithDuplicates(record=selected, duplicates=list(deduped.values())))\n\n return result", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 4987}, "tests/test_utils.py::53": {"resolved_imports": ["semhash/records.py", "semhash/utils.py"], "used_names": ["coerce_value"], "enclosing_function": "test_coerce_value", "extracted_code": "# Source: semhash/utils.py\ndef coerce_value(value: Any) -> Any:\n \"\"\"\n Coerce a value for encoding: stringify primitives, keep complex types raw.\n\n This ensures primitives (int, float, bool) work with text encoders,\n while complex types (PIL images, tensors, etc.) are passed through for multimodal encoders.\n\n :param value: The value to coerce.\n :return: The coerced value.\n \"\"\"\n if isinstance(value, (str, bytes)):\n return value\n if isinstance(value, (int, float, bool)):\n return str(value)\n return value", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 549}, "tests/test_datamodels.py::29": {"resolved_imports": ["semhash/datamodels.py"], "used_names": ["DeduplicationResult"], "enclosing_function": "test_deduplication_scoring_empty", "extracted_code": "# Source: semhash/datamodels.py\nclass DeduplicationResult(Generic[Record]):\n \"\"\"\n Deduplication result.\n\n Attributes\n ----------\n selected: List of deduplicated records after removing duplicates.\n filtered: List of DuplicateRecord objects containing details about duplicates of an original record.\n threshold: The similarity threshold used for deduplication.\n columns: Columns used for deduplication.\n\n \"\"\"\n\n selected: list[Record] = field(default_factory=list)\n filtered: list[DuplicateRecord] = field(default_factory=list)\n threshold: float = field(default=0.9)\n columns: Sequence[str] | None = field(default=None)\n\n @property\n def duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return 1.0 - len(self.selected) / denom\n return 0.0\n\n @property\n def exact_duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped due to an exact match.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return len([dup for dup in self.filtered if dup.exact]) / denom\n return 0.0\n\n def get_least_similar_from_duplicates(self, n: int = 1) -> list[tuple[Record, Record, float]]:\n \"\"\"\n Return the N least similar duplicate pairs.\n\n :param n: The number of least similar pairs to return.\n :return: A list of tuples consisting of (original_record, duplicate_record, score).\n \"\"\"\n all_pairs = [(dup.record, d, score) for dup in self.filtered for d, score in dup.duplicates]\n sorted_pairs = sorted(all_pairs, key=lambda x: x[2]) # Sort by score\n return sorted_pairs[:n]\n\n def rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n if self.threshold > threshold:\n raise ValueError(\"Threshold is smaller than the given value.\")\n # Invalidate cached property before modifying data\n self.__dict__.pop(\"selected_with_duplicates\", None)\n # Rethreshold duplicates and move records without duplicates to selected\n for dup in list(self.filtered):\n dup._rethreshold(threshold)\n if not dup.duplicates:\n self.filtered.remove(dup)\n self.selected.append(dup.record)\n self.threshold = threshold\n\n @cached_property\n def selected_with_duplicates(self) -> list[SelectedWithDuplicates[Record]]:\n \"\"\"\n For every kept record, return the duplicates that were removed along with their similarity scores.\n\n :return: A list of tuples where each tuple contains a kept record\n and a list of its duplicates with their similarity scores.\n \"\"\"\n\n def _to_hashable(record: Record) -> frozendict[str, str] | str:\n \"\"\"Convert a record to a hashable representation.\"\"\"\n if isinstance(record, dict) and self.columns is not None:\n # Convert dict to frozendict for immutability and hashability\n return to_frozendict(record, set(self.columns))\n return str(record)\n\n # Build a mapping from original-record to [(duplicate, score), …]\n buckets: defaultdict[Hashable, DuplicateList] = defaultdict(list)\n for duplicate_record in self.filtered:\n for original_record, score in duplicate_record.duplicates:\n buckets[_to_hashable(original_record)].append((duplicate_record.record, float(score)))\n\n result: list[SelectedWithDuplicates[Record]] = []\n for selected in self.selected:\n # Get the list of duplicates for the selected record\n raw_list = buckets.get(_to_hashable(selected), [])\n # Ensure we don't have duplicates in the list\n # Use full-record canonical JSON for dicts so that unhashable values are handled correctly\n deduped = {\n (\n json.dumps(rec, sort_keys=True, separators=(\",\", \":\"), ensure_ascii=False)\n if isinstance(rec, dict)\n else rec\n ): (rec, score)\n for rec, score in raw_list\n }\n result.append(SelectedWithDuplicates(record=selected, duplicates=list(deduped.values())))\n\n return result", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 4351}, "tests/test_utils.py::79": {"resolved_imports": ["semhash/records.py", "semhash/utils.py"], "used_names": ["compute_candidate_limit"], "enclosing_function": "test_compute_candidate_limit", "extracted_code": "# Source: semhash/utils.py\ndef compute_candidate_limit(\n total: int,\n selection_size: int,\n fraction: float = 0.1,\n min_candidates: int = 100,\n max_candidates: int = 1000,\n) -> int:\n \"\"\"\n Compute the 'auto' candidate limit based on the total number of records.\n\n :param total: Total number of records.\n :param selection_size: Number of representatives to select.\n :param fraction: Fraction of total records to consider as candidates.\n :param min_candidates: Minimum number of candidates.\n :param max_candidates: Maximum number of candidates.\n :return: Computed candidate limit.\n \"\"\"\n # 1) fraction of total\n limit = int(total * fraction)\n # 2) ensure enough to pick selection_size\n limit = max(limit, selection_size)\n # 3) enforce lower bound\n limit = max(limit, min_candidates)\n # 4) enforce upper bound (and never exceed the dataset)\n limit = min(limit, max_candidates, total)\n return limit", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 961}, "tests/test_utils.py::26": {"resolved_imports": ["semhash/records.py", "semhash/utils.py"], "used_names": ["make_hashable"], "enclosing_function": "test_make_hashable", "extracted_code": "# Source: semhash/utils.py\ndef make_hashable(value: Any) -> Any:\n \"\"\"\n Convert a value to a hashable representation for use as dict keys.\n\n Strings and other hashable types are returned as-is.\n Non-hashable types (like PIL images, numpy arrays) are hashed to a string.\n\n :param value: The value to make hashable.\n :return: A hashable representation of the value.\n \"\"\"\n # Fast path: most values are strings or already hashable\n if isinstance(value, (str, int, float, bool, type(None))):\n return value\n # Handle objects with tobytes() (PIL Image, numpy array, etc.)\n if hasattr(value, \"tobytes\"):\n return hashlib.md5(value.tobytes()).hexdigest()\n # Fallback: try to hash, otherwise stringify\n try:\n hash(value)\n return value\n except TypeError:\n return str(value)", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 837}, "tests/test_utils.py::46": {"resolved_imports": ["semhash/records.py", "semhash/utils.py"], "used_names": ["coerce_value"], "enclosing_function": "test_coerce_value", "extracted_code": "# Source: semhash/utils.py\ndef coerce_value(value: Any) -> Any:\n \"\"\"\n Coerce a value for encoding: stringify primitives, keep complex types raw.\n\n This ensures primitives (int, float, bool) work with text encoders,\n while complex types (PIL images, tensors, etc.) are passed through for multimodal encoders.\n\n :param value: The value to coerce.\n :return: The coerced value.\n \"\"\"\n if isinstance(value, (str, bytes)):\n return value\n if isinstance(value, (int, float, bool)):\n return str(value)\n return value", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 549}, "tests/test_utils.py::63": {"resolved_imports": ["semhash/records.py", "semhash/utils.py"], "used_names": ["frozendict", "pytest", "to_frozendict"], "enclosing_function": "test_to_frozendict", "extracted_code": "# Source: semhash/utils.py\ndef to_frozendict(record: dict[str, Any], columns: Sequence[str] | set[str]) -> frozendict[str, Any]:\n \"\"\"\n Convert a record to a frozendict with hashable values.\n\n :param record: The record to convert.\n :param columns: The columns to include.\n :return: A frozendict with only the specified columns (values made hashable).\n :raises ValueError: If a column is missing from the record.\n \"\"\"\n try:\n return frozendict({k: make_hashable(record[k]) for k in columns})\n except KeyError as e:\n missing = e.args[0]\n raise ValueError(f\"Missing column '{missing}' in record {record}\") from e", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 655}, "tests/test_utils.py::77": {"resolved_imports": ["semhash/records.py", "semhash/utils.py"], "used_names": ["compute_candidate_limit"], "enclosing_function": "test_compute_candidate_limit", "extracted_code": "# Source: semhash/utils.py\ndef compute_candidate_limit(\n total: int,\n selection_size: int,\n fraction: float = 0.1,\n min_candidates: int = 100,\n max_candidates: int = 1000,\n) -> int:\n \"\"\"\n Compute the 'auto' candidate limit based on the total number of records.\n\n :param total: Total number of records.\n :param selection_size: Number of representatives to select.\n :param fraction: Fraction of total records to consider as candidates.\n :param min_candidates: Minimum number of candidates.\n :param max_candidates: Maximum number of candidates.\n :return: Computed candidate limit.\n \"\"\"\n # 1) fraction of total\n limit = int(total * fraction)\n # 2) ensure enough to pick selection_size\n limit = max(limit, selection_size)\n # 3) enforce lower bound\n limit = max(limit, min_candidates)\n # 4) enforce upper bound (and never exceed the dataset)\n limit = min(limit, max_candidates, total)\n return limit", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 961}, "tests/test_utils.py::13": {"resolved_imports": ["semhash/records.py", "semhash/utils.py"], "used_names": ["make_hashable"], "enclosing_function": "test_make_hashable", "extracted_code": "# Source: semhash/utils.py\ndef make_hashable(value: Any) -> Any:\n \"\"\"\n Convert a value to a hashable representation for use as dict keys.\n\n Strings and other hashable types are returned as-is.\n Non-hashable types (like PIL images, numpy arrays) are hashed to a string.\n\n :param value: The value to make hashable.\n :return: A hashable representation of the value.\n \"\"\"\n # Fast path: most values are strings or already hashable\n if isinstance(value, (str, int, float, bool, type(None))):\n return value\n # Handle objects with tobytes() (PIL Image, numpy array, etc.)\n if hasattr(value, \"tobytes\"):\n return hashlib.md5(value.tobytes()).hexdigest()\n # Fallback: try to hash, otherwise stringify\n try:\n hash(value)\n return value\n except TypeError:\n return str(value)", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 837}, "tests/test_datamodels.py::207": {"resolved_imports": ["semhash/datamodels.py"], "used_names": ["DeduplicationResult", "DuplicateRecord"], "enclosing_function": "test_selected_with_duplicates_caching", "extracted_code": "# Source: semhash/datamodels.py\nclass DuplicateRecord(Generic[Record]):\n \"\"\"\n A single record with its duplicates.\n\n Attributes\n ----------\n record: The original record being deduplicated.\n exact: Whether the record was identified as an exact match.\n duplicates: List of tuples consisting of duplicate records and their associated scores.\n\n \"\"\"\n\n record: Record\n exact: bool\n duplicates: DuplicateList = field(default_factory=list)\n\n def _rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n self.duplicates = [(d, score) for d, score in self.duplicates if score >= threshold]\n\nclass DeduplicationResult(Generic[Record]):\n \"\"\"\n Deduplication result.\n\n Attributes\n ----------\n selected: List of deduplicated records after removing duplicates.\n filtered: List of DuplicateRecord objects containing details about duplicates of an original record.\n threshold: The similarity threshold used for deduplication.\n columns: Columns used for deduplication.\n\n \"\"\"\n\n selected: list[Record] = field(default_factory=list)\n filtered: list[DuplicateRecord] = field(default_factory=list)\n threshold: float = field(default=0.9)\n columns: Sequence[str] | None = field(default=None)\n\n @property\n def duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return 1.0 - len(self.selected) / denom\n return 0.0\n\n @property\n def exact_duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped due to an exact match.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return len([dup for dup in self.filtered if dup.exact]) / denom\n return 0.0\n\n def get_least_similar_from_duplicates(self, n: int = 1) -> list[tuple[Record, Record, float]]:\n \"\"\"\n Return the N least similar duplicate pairs.\n\n :param n: The number of least similar pairs to return.\n :return: A list of tuples consisting of (original_record, duplicate_record, score).\n \"\"\"\n all_pairs = [(dup.record, d, score) for dup in self.filtered for d, score in dup.duplicates]\n sorted_pairs = sorted(all_pairs, key=lambda x: x[2]) # Sort by score\n return sorted_pairs[:n]\n\n def rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n if self.threshold > threshold:\n raise ValueError(\"Threshold is smaller than the given value.\")\n # Invalidate cached property before modifying data\n self.__dict__.pop(\"selected_with_duplicates\", None)\n # Rethreshold duplicates and move records without duplicates to selected\n for dup in list(self.filtered):\n dup._rethreshold(threshold)\n if not dup.duplicates:\n self.filtered.remove(dup)\n self.selected.append(dup.record)\n self.threshold = threshold\n\n @cached_property\n def selected_with_duplicates(self) -> list[SelectedWithDuplicates[Record]]:\n \"\"\"\n For every kept record, return the duplicates that were removed along with their similarity scores.\n\n :return: A list of tuples where each tuple contains a kept record\n and a list of its duplicates with their similarity scores.\n \"\"\"\n\n def _to_hashable(record: Record) -> frozendict[str, str] | str:\n \"\"\"Convert a record to a hashable representation.\"\"\"\n if isinstance(record, dict) and self.columns is not None:\n # Convert dict to frozendict for immutability and hashability\n return to_frozendict(record, set(self.columns))\n return str(record)\n\n # Build a mapping from original-record to [(duplicate, score), …]\n buckets: defaultdict[Hashable, DuplicateList] = defaultdict(list)\n for duplicate_record in self.filtered:\n for original_record, score in duplicate_record.duplicates:\n buckets[_to_hashable(original_record)].append((duplicate_record.record, float(score)))\n\n result: list[SelectedWithDuplicates[Record]] = []\n for selected in self.selected:\n # Get the list of duplicates for the selected record\n raw_list = buckets.get(_to_hashable(selected), [])\n # Ensure we don't have duplicates in the list\n # Use full-record canonical JSON for dicts so that unhashable values are handled correctly\n deduped = {\n (\n json.dumps(rec, sort_keys=True, separators=(\",\", \":\"), ensure_ascii=False)\n if isinstance(rec, dict)\n else rec\n ): (rec, score)\n for rec, score in raw_list\n }\n result.append(SelectedWithDuplicates(record=selected, duplicates=list(deduped.values())))\n\n return result", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 4987}, "tests/test_semhash.py::331": {"resolved_imports": ["semhash/__init__.py", "semhash/datamodels.py", "semhash/utils.py"], "used_names": ["Encoder", "SemHash"], "enclosing_function": "test_preserve_non_embedding_fields", "extracted_code": "# Source: semhash/__init__.py\nfrom pyversity import Strategy\n\nfrom semhash.semhash import SemHash\n\n__all__ = [\"SemHash\", \"Strategy\"]\n\nfrom semhash.semhash import SemHash\n\n__all__ = [\"SemHash\", \"Strategy\"]\n\n\n# Source: semhash/utils.py\nclass Encoder(Protocol):\n \"\"\"An encoder protocol for SemHash. Supports text, images, or any encodable data.\"\"\"\n\n def encode(\n self,\n inputs: Sequence[Any] | Any,\n **kwargs: Any,\n ) -> np.ndarray:\n \"\"\"\n Encode a list of inputs into embeddings.\n\n :param inputs: A list of inputs to encode (strings, images, etc.).\n :param **kwargs: Additional keyword arguments.\n :return: The embeddings of the inputs.\n \"\"\"\n ...", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 722}, "tests/test_semhash.py::183": {"resolved_imports": ["semhash/__init__.py", "semhash/datamodels.py", "semhash/utils.py"], "used_names": ["Encoder", "SemHash", "pytest"], "enclosing_function": "test_filter_outliers", "extracted_code": "# Source: semhash/__init__.py\nfrom pyversity import Strategy\n\nfrom semhash.semhash import SemHash\n\n__all__ = [\"SemHash\", \"Strategy\"]\n\nfrom semhash.semhash import SemHash\n\n__all__ = [\"SemHash\", \"Strategy\"]\n\n\n# Source: semhash/utils.py\nclass Encoder(Protocol):\n \"\"\"An encoder protocol for SemHash. Supports text, images, or any encodable data.\"\"\"\n\n def encode(\n self,\n inputs: Sequence[Any] | Any,\n **kwargs: Any,\n ) -> np.ndarray:\n \"\"\"\n Encode a list of inputs into embeddings.\n\n :param inputs: A list of inputs to encode (strings, images, etc.).\n :param **kwargs: Additional keyword arguments.\n :return: The embeddings of the inputs.\n \"\"\"\n ...", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 722}, "tests/test_semhash.py::333": {"resolved_imports": ["semhash/__init__.py", "semhash/datamodels.py", "semhash/utils.py"], "used_names": ["Encoder", "SemHash"], "enclosing_function": "test_preserve_non_embedding_fields", "extracted_code": "# Source: semhash/__init__.py\nfrom pyversity import Strategy\n\nfrom semhash.semhash import SemHash\n\n__all__ = [\"SemHash\", \"Strategy\"]\n\nfrom semhash.semhash import SemHash\n\n__all__ = [\"SemHash\", \"Strategy\"]\n\n\n# Source: semhash/utils.py\nclass Encoder(Protocol):\n \"\"\"An encoder protocol for SemHash. Supports text, images, or any encodable data.\"\"\"\n\n def encode(\n self,\n inputs: Sequence[Any] | Any,\n **kwargs: Any,\n ) -> np.ndarray:\n \"\"\"\n Encode a list of inputs into embeddings.\n\n :param inputs: A list of inputs to encode (strings, images, etc.).\n :param **kwargs: Additional keyword arguments.\n :return: The embeddings of the inputs.\n \"\"\"\n ...", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 722}, "tests/test_datamodels.py::127": {"resolved_imports": ["semhash/datamodels.py"], "used_names": ["DeduplicationResult", "DuplicateRecord"], "enclosing_function": "test_selected_with_duplicates_dicts", "extracted_code": "# Source: semhash/datamodels.py\nclass DuplicateRecord(Generic[Record]):\n \"\"\"\n A single record with its duplicates.\n\n Attributes\n ----------\n record: The original record being deduplicated.\n exact: Whether the record was identified as an exact match.\n duplicates: List of tuples consisting of duplicate records and their associated scores.\n\n \"\"\"\n\n record: Record\n exact: bool\n duplicates: DuplicateList = field(default_factory=list)\n\n def _rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n self.duplicates = [(d, score) for d, score in self.duplicates if score >= threshold]\n\nclass DeduplicationResult(Generic[Record]):\n \"\"\"\n Deduplication result.\n\n Attributes\n ----------\n selected: List of deduplicated records after removing duplicates.\n filtered: List of DuplicateRecord objects containing details about duplicates of an original record.\n threshold: The similarity threshold used for deduplication.\n columns: Columns used for deduplication.\n\n \"\"\"\n\n selected: list[Record] = field(default_factory=list)\n filtered: list[DuplicateRecord] = field(default_factory=list)\n threshold: float = field(default=0.9)\n columns: Sequence[str] | None = field(default=None)\n\n @property\n def duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return 1.0 - len(self.selected) / denom\n return 0.0\n\n @property\n def exact_duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped due to an exact match.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return len([dup for dup in self.filtered if dup.exact]) / denom\n return 0.0\n\n def get_least_similar_from_duplicates(self, n: int = 1) -> list[tuple[Record, Record, float]]:\n \"\"\"\n Return the N least similar duplicate pairs.\n\n :param n: The number of least similar pairs to return.\n :return: A list of tuples consisting of (original_record, duplicate_record, score).\n \"\"\"\n all_pairs = [(dup.record, d, score) for dup in self.filtered for d, score in dup.duplicates]\n sorted_pairs = sorted(all_pairs, key=lambda x: x[2]) # Sort by score\n return sorted_pairs[:n]\n\n def rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n if self.threshold > threshold:\n raise ValueError(\"Threshold is smaller than the given value.\")\n # Invalidate cached property before modifying data\n self.__dict__.pop(\"selected_with_duplicates\", None)\n # Rethreshold duplicates and move records without duplicates to selected\n for dup in list(self.filtered):\n dup._rethreshold(threshold)\n if not dup.duplicates:\n self.filtered.remove(dup)\n self.selected.append(dup.record)\n self.threshold = threshold\n\n @cached_property\n def selected_with_duplicates(self) -> list[SelectedWithDuplicates[Record]]:\n \"\"\"\n For every kept record, return the duplicates that were removed along with their similarity scores.\n\n :return: A list of tuples where each tuple contains a kept record\n and a list of its duplicates with their similarity scores.\n \"\"\"\n\n def _to_hashable(record: Record) -> frozendict[str, str] | str:\n \"\"\"Convert a record to a hashable representation.\"\"\"\n if isinstance(record, dict) and self.columns is not None:\n # Convert dict to frozendict for immutability and hashability\n return to_frozendict(record, set(self.columns))\n return str(record)\n\n # Build a mapping from original-record to [(duplicate, score), …]\n buckets: defaultdict[Hashable, DuplicateList] = defaultdict(list)\n for duplicate_record in self.filtered:\n for original_record, score in duplicate_record.duplicates:\n buckets[_to_hashable(original_record)].append((duplicate_record.record, float(score)))\n\n result: list[SelectedWithDuplicates[Record]] = []\n for selected in self.selected:\n # Get the list of duplicates for the selected record\n raw_list = buckets.get(_to_hashable(selected), [])\n # Ensure we don't have duplicates in the list\n # Use full-record canonical JSON for dicts so that unhashable values are handled correctly\n deduped = {\n (\n json.dumps(rec, sort_keys=True, separators=(\",\", \":\"), ensure_ascii=False)\n if isinstance(rec, dict)\n else rec\n ): (rec, score)\n for rec, score in raw_list\n }\n result.append(SelectedWithDuplicates(record=selected, duplicates=list(deduped.values())))\n\n return result", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 4987}, "tests/test_semhash.py::147": {"resolved_imports": ["semhash/__init__.py", "semhash/datamodels.py", "semhash/utils.py"], "used_names": ["Encoder", "SemHash"], "enclosing_function": "test_self_find_representative", "extracted_code": "# Source: semhash/__init__.py\nfrom pyversity import Strategy\n\nfrom semhash.semhash import SemHash\n\n__all__ = [\"SemHash\", \"Strategy\"]\n\nfrom semhash.semhash import SemHash\n\n__all__ = [\"SemHash\", \"Strategy\"]\n\n\n# Source: semhash/utils.py\nclass Encoder(Protocol):\n \"\"\"An encoder protocol for SemHash. Supports text, images, or any encodable data.\"\"\"\n\n def encode(\n self,\n inputs: Sequence[Any] | Any,\n **kwargs: Any,\n ) -> np.ndarray:\n \"\"\"\n Encode a list of inputs into embeddings.\n\n :param inputs: A list of inputs to encode (strings, images, etc.).\n :param **kwargs: Additional keyword arguments.\n :return: The embeddings of the inputs.\n \"\"\"\n ...", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 722}, "tests/test_utils.py::118": {"resolved_imports": ["semhash/records.py", "semhash/utils.py"], "used_names": ["remove_exact_duplicates"], "enclosing_function": "test_remove_exact_duplicates", "extracted_code": "# Source: semhash/records.py\ndef remove_exact_duplicates(\n records: Sequence[dict[str, Any]],\n columns: Sequence[str],\n reference_records: list[list[dict[str, Any]]] | None = None,\n) -> tuple[list[dict[str, Any]], list[tuple[dict[str, Any], list[dict[str, Any]]]]]:\n \"\"\"\n Remove exact duplicates based on the hashable representation of each record.\n\n If reference_records is None, the function will only check for duplicates within the records list.\n\n :param records: A list of records to check for exact duplicates.\n :param columns: Columns to unpack.\n :param reference_records: A list of records to compare against. These are already unpacked\n :return: A list of deduplicated records and a list of duplicates.\n \"\"\"\n deduplicated: list[dict[str, Any]] = []\n duplicates: list[tuple[dict[str, Any], list[dict[str, Any]]]] = []\n\n column_set = set(columns)\n\n # Build seen set from reference_records (cross-dataset mode) or empty (single-dataset mode)\n seen: defaultdict[frozendict[str, Any], list[dict[str, Any]]] = defaultdict(list)\n if reference_records is not None:\n for record_set in reference_records:\n key = to_frozendict(record_set[0], column_set)\n seen[key] = list(record_set)\n\n for record in records:\n frozen_record = to_frozendict(record, column_set)\n if duplicated_records := seen.get(frozen_record):\n duplicates.append((record, duplicated_records))\n else:\n deduplicated.append(record)\n # Single-dataset mode: track this record for future comparisons\n if reference_records is None:\n seen[frozen_record].append(record)\n\n return deduplicated, duplicates", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 1725}, "tests/test_datamodels.py::106": {"resolved_imports": ["semhash/datamodels.py"], "used_names": ["DeduplicationResult", "DuplicateRecord", "SelectedWithDuplicates"], "enclosing_function": "test_selected_with_duplicates_strings", "extracted_code": "# Source: semhash/datamodels.py\nclass DuplicateRecord(Generic[Record]):\n \"\"\"\n A single record with its duplicates.\n\n Attributes\n ----------\n record: The original record being deduplicated.\n exact: Whether the record was identified as an exact match.\n duplicates: List of tuples consisting of duplicate records and their associated scores.\n\n \"\"\"\n\n record: Record\n exact: bool\n duplicates: DuplicateList = field(default_factory=list)\n\n def _rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n self.duplicates = [(d, score) for d, score in self.duplicates if score >= threshold]\n\nclass SelectedWithDuplicates(Generic[Record]):\n \"\"\"\n A record that has been selected along with its duplicates.\n\n Attributes\n ----------\n record: The original record being selected.\n duplicates: List of tuples consisting of duplicate records and their associated scores.\n\n \"\"\"\n\n record: Record\n duplicates: DuplicateList = field(default_factory=list)\n\nclass DeduplicationResult(Generic[Record]):\n \"\"\"\n Deduplication result.\n\n Attributes\n ----------\n selected: List of deduplicated records after removing duplicates.\n filtered: List of DuplicateRecord objects containing details about duplicates of an original record.\n threshold: The similarity threshold used for deduplication.\n columns: Columns used for deduplication.\n\n \"\"\"\n\n selected: list[Record] = field(default_factory=list)\n filtered: list[DuplicateRecord] = field(default_factory=list)\n threshold: float = field(default=0.9)\n columns: Sequence[str] | None = field(default=None)\n\n @property\n def duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return 1.0 - len(self.selected) / denom\n return 0.0\n\n @property\n def exact_duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped due to an exact match.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return len([dup for dup in self.filtered if dup.exact]) / denom\n return 0.0\n\n def get_least_similar_from_duplicates(self, n: int = 1) -> list[tuple[Record, Record, float]]:\n \"\"\"\n Return the N least similar duplicate pairs.\n\n :param n: The number of least similar pairs to return.\n :return: A list of tuples consisting of (original_record, duplicate_record, score).\n \"\"\"\n all_pairs = [(dup.record, d, score) for dup in self.filtered for d, score in dup.duplicates]\n sorted_pairs = sorted(all_pairs, key=lambda x: x[2]) # Sort by score\n return sorted_pairs[:n]\n\n def rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n if self.threshold > threshold:\n raise ValueError(\"Threshold is smaller than the given value.\")\n # Invalidate cached property before modifying data\n self.__dict__.pop(\"selected_with_duplicates\", None)\n # Rethreshold duplicates and move records without duplicates to selected\n for dup in list(self.filtered):\n dup._rethreshold(threshold)\n if not dup.duplicates:\n self.filtered.remove(dup)\n self.selected.append(dup.record)\n self.threshold = threshold\n\n @cached_property\n def selected_with_duplicates(self) -> list[SelectedWithDuplicates[Record]]:\n \"\"\"\n For every kept record, return the duplicates that were removed along with their similarity scores.\n\n :return: A list of tuples where each tuple contains a kept record\n and a list of its duplicates with their similarity scores.\n \"\"\"\n\n def _to_hashable(record: Record) -> frozendict[str, str] | str:\n \"\"\"Convert a record to a hashable representation.\"\"\"\n if isinstance(record, dict) and self.columns is not None:\n # Convert dict to frozendict for immutability and hashability\n return to_frozendict(record, set(self.columns))\n return str(record)\n\n # Build a mapping from original-record to [(duplicate, score), …]\n buckets: defaultdict[Hashable, DuplicateList] = defaultdict(list)\n for duplicate_record in self.filtered:\n for original_record, score in duplicate_record.duplicates:\n buckets[_to_hashable(original_record)].append((duplicate_record.record, float(score)))\n\n result: list[SelectedWithDuplicates[Record]] = []\n for selected in self.selected:\n # Get the list of duplicates for the selected record\n raw_list = buckets.get(_to_hashable(selected), [])\n # Ensure we don't have duplicates in the list\n # Use full-record canonical JSON for dicts so that unhashable values are handled correctly\n deduped = {\n (\n json.dumps(rec, sort_keys=True, separators=(\",\", \":\"), ensure_ascii=False)\n if isinstance(rec, dict)\n else rec\n ): (rec, score)\n for rec, score in raw_list\n }\n result.append(SelectedWithDuplicates(record=selected, duplicates=list(deduped.values())))\n\n return result", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 5374}, "tests/test_semhash.py::175": {"resolved_imports": ["semhash/__init__.py", "semhash/datamodels.py", "semhash/utils.py"], "used_names": ["Encoder", "SemHash", "pytest"], "enclosing_function": "test_filter_outliers", "extracted_code": "# Source: semhash/__init__.py\nfrom pyversity import Strategy\n\nfrom semhash.semhash import SemHash\n\n__all__ = [\"SemHash\", \"Strategy\"]\n\nfrom semhash.semhash import SemHash\n\n__all__ = [\"SemHash\", \"Strategy\"]\n\n\n# Source: semhash/utils.py\nclass Encoder(Protocol):\n \"\"\"An encoder protocol for SemHash. Supports text, images, or any encodable data.\"\"\"\n\n def encode(\n self,\n inputs: Sequence[Any] | Any,\n **kwargs: Any,\n ) -> np.ndarray:\n \"\"\"\n Encode a list of inputs into embeddings.\n\n :param inputs: A list of inputs to encode (strings, images, etc.).\n :param **kwargs: Additional keyword arguments.\n :return: The embeddings of the inputs.\n \"\"\"\n ...", "n_imports_parsed": 5, "n_files_resolved": 3, "n_chars_extracted": 722}, "tests/test_datamodels.py::241": {"resolved_imports": ["semhash/datamodels.py"], "used_names": ["FilterResult"], "enclosing_function": "test_filter_result_empty", "extracted_code": "# Source: semhash/datamodels.py\nclass FilterResult(Generic[Record]):\n \"\"\"\n Result of filtering operations.\n\n Attributes\n ----------\n selected: List of records that passed the filter criteria.\n filtered: List of records that were filtered out.\n scores_selected: List of scores for the selected records.\n scores_filtered: List of scores for the filtered records.\n\n \"\"\"\n\n selected: list[Record]\n filtered: list[Record]\n scores_selected: list[float] = field(default_factory=list)\n scores_filtered: list[float] = field(default_factory=list)\n\n @property\n def filter_ratio(self) -> float:\n \"\"\"Return the percentage of records filtered out.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return len(self.filtered) / denom\n return 0.0\n\n @property\n def selected_ratio(self) -> float:\n \"\"\"Return the percentage of records selected.\"\"\"\n return 1 - self.filter_ratio", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 977}, "tests/test_datamodels.py::126": {"resolved_imports": ["semhash/datamodels.py"], "used_names": ["DeduplicationResult", "DuplicateRecord"], "enclosing_function": "test_selected_with_duplicates_dicts", "extracted_code": "# Source: semhash/datamodels.py\nclass DuplicateRecord(Generic[Record]):\n \"\"\"\n A single record with its duplicates.\n\n Attributes\n ----------\n record: The original record being deduplicated.\n exact: Whether the record was identified as an exact match.\n duplicates: List of tuples consisting of duplicate records and their associated scores.\n\n \"\"\"\n\n record: Record\n exact: bool\n duplicates: DuplicateList = field(default_factory=list)\n\n def _rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n self.duplicates = [(d, score) for d, score in self.duplicates if score >= threshold]\n\nclass DeduplicationResult(Generic[Record]):\n \"\"\"\n Deduplication result.\n\n Attributes\n ----------\n selected: List of deduplicated records after removing duplicates.\n filtered: List of DuplicateRecord objects containing details about duplicates of an original record.\n threshold: The similarity threshold used for deduplication.\n columns: Columns used for deduplication.\n\n \"\"\"\n\n selected: list[Record] = field(default_factory=list)\n filtered: list[DuplicateRecord] = field(default_factory=list)\n threshold: float = field(default=0.9)\n columns: Sequence[str] | None = field(default=None)\n\n @property\n def duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return 1.0 - len(self.selected) / denom\n return 0.0\n\n @property\n def exact_duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped due to an exact match.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return len([dup for dup in self.filtered if dup.exact]) / denom\n return 0.0\n\n def get_least_similar_from_duplicates(self, n: int = 1) -> list[tuple[Record, Record, float]]:\n \"\"\"\n Return the N least similar duplicate pairs.\n\n :param n: The number of least similar pairs to return.\n :return: A list of tuples consisting of (original_record, duplicate_record, score).\n \"\"\"\n all_pairs = [(dup.record, d, score) for dup in self.filtered for d, score in dup.duplicates]\n sorted_pairs = sorted(all_pairs, key=lambda x: x[2]) # Sort by score\n return sorted_pairs[:n]\n\n def rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n if self.threshold > threshold:\n raise ValueError(\"Threshold is smaller than the given value.\")\n # Invalidate cached property before modifying data\n self.__dict__.pop(\"selected_with_duplicates\", None)\n # Rethreshold duplicates and move records without duplicates to selected\n for dup in list(self.filtered):\n dup._rethreshold(threshold)\n if not dup.duplicates:\n self.filtered.remove(dup)\n self.selected.append(dup.record)\n self.threshold = threshold\n\n @cached_property\n def selected_with_duplicates(self) -> list[SelectedWithDuplicates[Record]]:\n \"\"\"\n For every kept record, return the duplicates that were removed along with their similarity scores.\n\n :return: A list of tuples where each tuple contains a kept record\n and a list of its duplicates with their similarity scores.\n \"\"\"\n\n def _to_hashable(record: Record) -> frozendict[str, str] | str:\n \"\"\"Convert a record to a hashable representation.\"\"\"\n if isinstance(record, dict) and self.columns is not None:\n # Convert dict to frozendict for immutability and hashability\n return to_frozendict(record, set(self.columns))\n return str(record)\n\n # Build a mapping from original-record to [(duplicate, score), …]\n buckets: defaultdict[Hashable, DuplicateList] = defaultdict(list)\n for duplicate_record in self.filtered:\n for original_record, score in duplicate_record.duplicates:\n buckets[_to_hashable(original_record)].append((duplicate_record.record, float(score)))\n\n result: list[SelectedWithDuplicates[Record]] = []\n for selected in self.selected:\n # Get the list of duplicates for the selected record\n raw_list = buckets.get(_to_hashable(selected), [])\n # Ensure we don't have duplicates in the list\n # Use full-record canonical JSON for dicts so that unhashable values are handled correctly\n deduped = {\n (\n json.dumps(rec, sort_keys=True, separators=(\",\", \":\"), ensure_ascii=False)\n if isinstance(rec, dict)\n else rec\n ): (rec, score)\n for rec, score in raw_list\n }\n result.append(SelectedWithDuplicates(record=selected, duplicates=list(deduped.values())))\n\n return result", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 4987}, "tests/test_datamodels.py::23": {"resolved_imports": ["semhash/datamodels.py"], "used_names": ["DeduplicationResult", "DuplicateRecord"], "enclosing_function": "test_deduplication_scoring_exact", "extracted_code": "# Source: semhash/datamodels.py\nclass DuplicateRecord(Generic[Record]):\n \"\"\"\n A single record with its duplicates.\n\n Attributes\n ----------\n record: The original record being deduplicated.\n exact: Whether the record was identified as an exact match.\n duplicates: List of tuples consisting of duplicate records and their associated scores.\n\n \"\"\"\n\n record: Record\n exact: bool\n duplicates: DuplicateList = field(default_factory=list)\n\n def _rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n self.duplicates = [(d, score) for d, score in self.duplicates if score >= threshold]\n\nclass DeduplicationResult(Generic[Record]):\n \"\"\"\n Deduplication result.\n\n Attributes\n ----------\n selected: List of deduplicated records after removing duplicates.\n filtered: List of DuplicateRecord objects containing details about duplicates of an original record.\n threshold: The similarity threshold used for deduplication.\n columns: Columns used for deduplication.\n\n \"\"\"\n\n selected: list[Record] = field(default_factory=list)\n filtered: list[DuplicateRecord] = field(default_factory=list)\n threshold: float = field(default=0.9)\n columns: Sequence[str] | None = field(default=None)\n\n @property\n def duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return 1.0 - len(self.selected) / denom\n return 0.0\n\n @property\n def exact_duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped due to an exact match.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return len([dup for dup in self.filtered if dup.exact]) / denom\n return 0.0\n\n def get_least_similar_from_duplicates(self, n: int = 1) -> list[tuple[Record, Record, float]]:\n \"\"\"\n Return the N least similar duplicate pairs.\n\n :param n: The number of least similar pairs to return.\n :return: A list of tuples consisting of (original_record, duplicate_record, score).\n \"\"\"\n all_pairs = [(dup.record, d, score) for dup in self.filtered for d, score in dup.duplicates]\n sorted_pairs = sorted(all_pairs, key=lambda x: x[2]) # Sort by score\n return sorted_pairs[:n]\n\n def rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n if self.threshold > threshold:\n raise ValueError(\"Threshold is smaller than the given value.\")\n # Invalidate cached property before modifying data\n self.__dict__.pop(\"selected_with_duplicates\", None)\n # Rethreshold duplicates and move records without duplicates to selected\n for dup in list(self.filtered):\n dup._rethreshold(threshold)\n if not dup.duplicates:\n self.filtered.remove(dup)\n self.selected.append(dup.record)\n self.threshold = threshold\n\n @cached_property\n def selected_with_duplicates(self) -> list[SelectedWithDuplicates[Record]]:\n \"\"\"\n For every kept record, return the duplicates that were removed along with their similarity scores.\n\n :return: A list of tuples where each tuple contains a kept record\n and a list of its duplicates with their similarity scores.\n \"\"\"\n\n def _to_hashable(record: Record) -> frozendict[str, str] | str:\n \"\"\"Convert a record to a hashable representation.\"\"\"\n if isinstance(record, dict) and self.columns is not None:\n # Convert dict to frozendict for immutability and hashability\n return to_frozendict(record, set(self.columns))\n return str(record)\n\n # Build a mapping from original-record to [(duplicate, score), …]\n buckets: defaultdict[Hashable, DuplicateList] = defaultdict(list)\n for duplicate_record in self.filtered:\n for original_record, score in duplicate_record.duplicates:\n buckets[_to_hashable(original_record)].append((duplicate_record.record, float(score)))\n\n result: list[SelectedWithDuplicates[Record]] = []\n for selected in self.selected:\n # Get the list of duplicates for the selected record\n raw_list = buckets.get(_to_hashable(selected), [])\n # Ensure we don't have duplicates in the list\n # Use full-record canonical JSON for dicts so that unhashable values are handled correctly\n deduped = {\n (\n json.dumps(rec, sort_keys=True, separators=(\",\", \":\"), ensure_ascii=False)\n if isinstance(rec, dict)\n else rec\n ): (rec, score)\n for rec, score in raw_list\n }\n result.append(SelectedWithDuplicates(record=selected, duplicates=list(deduped.values())))\n\n return result", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 4987}, "tests/test_utils.py::16": {"resolved_imports": ["semhash/records.py", "semhash/utils.py"], "used_names": ["make_hashable"], "enclosing_function": "test_make_hashable", "extracted_code": "# Source: semhash/utils.py\ndef make_hashable(value: Any) -> Any:\n \"\"\"\n Convert a value to a hashable representation for use as dict keys.\n\n Strings and other hashable types are returned as-is.\n Non-hashable types (like PIL images, numpy arrays) are hashed to a string.\n\n :param value: The value to make hashable.\n :return: A hashable representation of the value.\n \"\"\"\n # Fast path: most values are strings or already hashable\n if isinstance(value, (str, int, float, bool, type(None))):\n return value\n # Handle objects with tobytes() (PIL Image, numpy array, etc.)\n if hasattr(value, \"tobytes\"):\n return hashlib.md5(value.tobytes()).hexdigest()\n # Fallback: try to hash, otherwise stringify\n try:\n hash(value)\n return value\n except TypeError:\n return str(value)", "n_imports_parsed": 5, "n_files_resolved": 2, "n_chars_extracted": 837}, "tests/test_datamodels.py::13": {"resolved_imports": ["semhash/datamodels.py"], "used_names": ["DeduplicationResult", "DuplicateRecord"], "enclosing_function": "test_deduplication_scoring", "extracted_code": "# Source: semhash/datamodels.py\nclass DuplicateRecord(Generic[Record]):\n \"\"\"\n A single record with its duplicates.\n\n Attributes\n ----------\n record: The original record being deduplicated.\n exact: Whether the record was identified as an exact match.\n duplicates: List of tuples consisting of duplicate records and their associated scores.\n\n \"\"\"\n\n record: Record\n exact: bool\n duplicates: DuplicateList = field(default_factory=list)\n\n def _rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n self.duplicates = [(d, score) for d, score in self.duplicates if score >= threshold]\n\nclass DeduplicationResult(Generic[Record]):\n \"\"\"\n Deduplication result.\n\n Attributes\n ----------\n selected: List of deduplicated records after removing duplicates.\n filtered: List of DuplicateRecord objects containing details about duplicates of an original record.\n threshold: The similarity threshold used for deduplication.\n columns: Columns used for deduplication.\n\n \"\"\"\n\n selected: list[Record] = field(default_factory=list)\n filtered: list[DuplicateRecord] = field(default_factory=list)\n threshold: float = field(default=0.9)\n columns: Sequence[str] | None = field(default=None)\n\n @property\n def duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return 1.0 - len(self.selected) / denom\n return 0.0\n\n @property\n def exact_duplicate_ratio(self) -> float:\n \"\"\"Return the percentage of records dropped due to an exact match.\"\"\"\n if denom := len(self.selected) + len(self.filtered):\n return len([dup for dup in self.filtered if dup.exact]) / denom\n return 0.0\n\n def get_least_similar_from_duplicates(self, n: int = 1) -> list[tuple[Record, Record, float]]:\n \"\"\"\n Return the N least similar duplicate pairs.\n\n :param n: The number of least similar pairs to return.\n :return: A list of tuples consisting of (original_record, duplicate_record, score).\n \"\"\"\n all_pairs = [(dup.record, d, score) for dup in self.filtered for d, score in dup.duplicates]\n sorted_pairs = sorted(all_pairs, key=lambda x: x[2]) # Sort by score\n return sorted_pairs[:n]\n\n def rethreshold(self, threshold: float) -> None:\n \"\"\"Rethreshold the duplicates.\"\"\"\n if self.threshold > threshold:\n raise ValueError(\"Threshold is smaller than the given value.\")\n # Invalidate cached property before modifying data\n self.__dict__.pop(\"selected_with_duplicates\", None)\n # Rethreshold duplicates and move records without duplicates to selected\n for dup in list(self.filtered):\n dup._rethreshold(threshold)\n if not dup.duplicates:\n self.filtered.remove(dup)\n self.selected.append(dup.record)\n self.threshold = threshold\n\n @cached_property\n def selected_with_duplicates(self) -> list[SelectedWithDuplicates[Record]]:\n \"\"\"\n For every kept record, return the duplicates that were removed along with their similarity scores.\n\n :return: A list of tuples where each tuple contains a kept record\n and a list of its duplicates with their similarity scores.\n \"\"\"\n\n def _to_hashable(record: Record) -> frozendict[str, str] | str:\n \"\"\"Convert a record to a hashable representation.\"\"\"\n if isinstance(record, dict) and self.columns is not None:\n # Convert dict to frozendict for immutability and hashability\n return to_frozendict(record, set(self.columns))\n return str(record)\n\n # Build a mapping from original-record to [(duplicate, score), …]\n buckets: defaultdict[Hashable, DuplicateList] = defaultdict(list)\n for duplicate_record in self.filtered:\n for original_record, score in duplicate_record.duplicates:\n buckets[_to_hashable(original_record)].append((duplicate_record.record, float(score)))\n\n result: list[SelectedWithDuplicates[Record]] = []\n for selected in self.selected:\n # Get the list of duplicates for the selected record\n raw_list = buckets.get(_to_hashable(selected), [])\n # Ensure we don't have duplicates in the list\n # Use full-record canonical JSON for dicts so that unhashable values are handled correctly\n deduped = {\n (\n json.dumps(rec, sort_keys=True, separators=(\",\", \":\"), ensure_ascii=False)\n if isinstance(rec, dict)\n else rec\n ): (rec, score)\n for rec, score in raw_list\n }\n result.append(SelectedWithDuplicates(record=selected, duplicates=list(deduped.values())))\n\n return result", "n_imports_parsed": 2, "n_files_resolved": 1, "n_chars_extracted": 4987}}}
oracle_context_cache/MolecularAI__aizynthfinder.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/MongoEngine__mongoengine.json ADDED
The diff for this file is too large to render. See raw diff
 
oracle_context_cache/MrPowers__chispa.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"repo": "MrPowers/chispa", "n_pairs": 54, "version": "v2_function_scoped", "contexts": {"tests/test_column_comparer.py::32": {"resolved_imports": ["chispa/column_comparer.py"], "used_names": ["assert_approx_column_equality", "spark"], "enclosing_function": "it_works_with_no_mismatches", "extracted_code": "# Source: chispa/column_comparer.py\ndef assert_approx_column_equality(df: DataFrame, col_name1: str, col_name2: str, precision: float) -> None:\n rows = df.select(col_name1, col_name2).collect()\n col_name_1_elements = [x[0] for x in rows]\n col_name_2_elements = [x[1] for x in rows]\n all_rows_equal = True\n zipped = list(zip(col_name_1_elements, col_name_2_elements))\n t = PrettyTable([col_name1, col_name2])\n for elements in zipped:\n first = blue(str(elements[0]))\n second = blue(str(elements[1]))\n # when one is None and the other isn't, they're not equal\n if (elements[0] is None) != (elements[1] is None):\n all_rows_equal = False\n t.add_row([str(elements[0]), str(elements[1])])\n # when both are None, they're equal\n elif elements[0] is None and elements[1] is None:\n t.add_row([first, second])\n # when the diff is less than the threshhold, they're approximately equal\n elif abs(elements[0] - elements[1]) < precision:\n t.add_row([first, second])\n # otherwise, they're not equal\n else:\n all_rows_equal = False\n t.add_row([str(elements[0]), str(elements[1])])\n if all_rows_equal is False:\n raise ColumnsNotEqualError(\"\\n\" + t.get_string())", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 1308}, "tests/test_column_comparer.py::25": {"resolved_imports": ["chispa/column_comparer.py"], "used_names": ["assert_column_equality", "spark"], "enclosing_function": "it_works_with_integer_values", "extracted_code": "# Source: chispa/column_comparer.py\ndef assert_column_equality(df: DataFrame, col_name1: str, col_name2: str) -> None:\n rows = df.select(col_name1, col_name2).collect()\n col_name_1_elements = [x[0] for x in rows]\n col_name_2_elements = [x[1] for x in rows]\n if col_name_1_elements != col_name_2_elements:\n zipped = list(zip(col_name_1_elements, col_name_2_elements))\n t = PrettyTable([col_name1, col_name2])\n for elements in zipped:\n if elements[0] == elements[1]:\n t.add_row([blue(str(elements[0])), blue(str(elements[1]))])\n else:\n t.add_row([str(elements[0]), str(elements[1])])\n raise ColumnsNotEqualError(\"\\n\" + t.get_string())", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 724}, "tests/test_column_comparer.py::20": {"resolved_imports": ["chispa/column_comparer.py"], "used_names": ["assert_column_equality", "spark"], "enclosing_function": "it_doesnt_throw_without_mismatch", "extracted_code": "# Source: chispa/column_comparer.py\ndef assert_column_equality(df: DataFrame, col_name1: str, col_name2: str) -> None:\n rows = df.select(col_name1, col_name2).collect()\n col_name_1_elements = [x[0] for x in rows]\n col_name_2_elements = [x[1] for x in rows]\n if col_name_1_elements != col_name_2_elements:\n zipped = list(zip(col_name_1_elements, col_name_2_elements))\n t = PrettyTable([col_name1, col_name2])\n for elements in zipped:\n if elements[0] == elements[1]:\n t.add_row([blue(str(elements[0])), blue(str(elements[1]))])\n else:\n t.add_row([str(elements[0]), str(elements[1])])\n raise ColumnsNotEqualError(\"\\n\" + t.get_string())", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 724}, "tests/test_column_comparer.py::14": {"resolved_imports": ["chispa/column_comparer.py"], "used_names": ["ColumnsNotEqualError", "assert_column_equality", "pytest", "spark"], "enclosing_function": "it_throws_error_with_data_mismatch", "extracted_code": "# Source: chispa/column_comparer.py\nclass ColumnsNotEqualError(Exception):\n \"\"\"The columns are not equal\"\"\"\n\n pass\n\ndef assert_column_equality(df: DataFrame, col_name1: str, col_name2: str) -> None:\n rows = df.select(col_name1, col_name2).collect()\n col_name_1_elements = [x[0] for x in rows]\n col_name_2_elements = [x[1] for x in rows]\n if col_name_1_elements != col_name_2_elements:\n zipped = list(zip(col_name_1_elements, col_name_2_elements))\n t = PrettyTable([col_name1, col_name2])\n for elements in zipped:\n if elements[0] == elements[1]:\n t.add_row([blue(str(elements[0])), blue(str(elements[1]))])\n else:\n t.add_row([str(elements[0]), str(elements[1])])\n raise ColumnsNotEqualError(\"\\n\" + t.get_string())", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 810}, "tests/test_dataframe_comparer.py::179": {"resolved_imports": ["chispa/dataframe_comparer.py", "chispa/schema_comparer.py"], "used_names": ["are_dfs_equal", "spark"], "enclosing_function": "it_returns_true_when_dfs_are_same", "extracted_code": "", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 0}, "tests/test_dataframe_comparer.py::29": {"resolved_imports": ["chispa/dataframe_comparer.py", "chispa/schema_comparer.py"], "used_names": ["assert_df_equality", "spark"], "enclosing_function": "it_can_work_with_different_row_orders", "extracted_code": "# Source: chispa/dataframe_comparer.py\ndef assert_df_equality(\n df1: DataFrame,\n df2: DataFrame,\n ignore_nullable: bool = False,\n transforms: list[Callable] | None = None, # type: ignore[type-arg]\n allow_nan_equality: bool = False,\n ignore_column_order: bool = False,\n ignore_row_order: bool = False,\n underline_cells: bool = False,\n ignore_metadata: bool = False,\n ignore_columns: list[str] | None = None,\n formats: FormattingConfig | None = None,\n) -> None:\n if not formats:\n formats = FormattingConfig()\n elif not isinstance(formats, FormattingConfig):\n formats = FormattingConfig._from_arbitrary_dataclass(formats)\n\n if transforms is None:\n transforms = []\n if ignore_column_order:\n transforms.append(lambda df: df.select(sorted(df.columns)))\n if ignore_columns:\n transforms.append(lambda df: df.drop(*ignore_columns))\n if ignore_row_order:\n transforms.append(lambda df: df.sort(df.columns))\n\n df1 = reduce(lambda acc, fn: fn(acc), transforms, df1)\n df2 = reduce(lambda acc, fn: fn(acc), transforms, df2)\n\n assert_schema_equality(df1.schema, df2.schema, ignore_nullable, ignore_metadata)\n\n if allow_nan_equality:\n assert_generic_rows_equality(\n df1.collect(),\n df2.collect(),\n are_rows_equal_enhanced,\n {\"allow_nan_equality\": True},\n underline_cells=underline_cells,\n formats=formats,\n )\n else:\n assert_basic_rows_equality(\n df1.collect(),\n df2.collect(),\n underline_cells=underline_cells,\n formats=formats,\n )", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 1661}, "tests/test_dataframe_comparer.py::237": {"resolved_imports": ["chispa/dataframe_comparer.py", "chispa/schema_comparer.py"], "used_names": ["assert_approx_df_equality", "spark"], "enclosing_function": "it_can_ignore_columns", "extracted_code": "# Source: chispa/dataframe_comparer.py\ndef assert_approx_df_equality(\n df1: DataFrame,\n df2: DataFrame,\n precision: float,\n ignore_nullable: bool = False,\n transforms: list[Callable] | None = None, # type: ignore[type-arg]\n allow_nan_equality: bool = False,\n ignore_column_order: bool = False,\n ignore_row_order: bool = False,\n ignore_columns: list[str] | None = None,\n formats: FormattingConfig | None = None,\n) -> None:\n if not formats:\n formats = FormattingConfig()\n elif not isinstance(formats, FormattingConfig):\n formats = FormattingConfig._from_arbitrary_dataclass(formats)\n\n if transforms is None:\n transforms = []\n if ignore_column_order:\n transforms.append(lambda df: df.select(sorted(df.columns)))\n if ignore_columns:\n transforms.append(lambda df: df.drop(*ignore_columns))\n if ignore_row_order:\n transforms.append(lambda df: df.sort(df.columns))\n\n df1 = reduce(lambda acc, fn: fn(acc), transforms, df1)\n df2 = reduce(lambda acc, fn: fn(acc), transforms, df2)\n\n assert_schema_equality(df1.schema, df2.schema, ignore_nullable)\n\n if precision != 0:\n assert_generic_rows_equality(\n df1.collect(),\n df2.collect(),\n are_rows_approx_equal,\n {\"precision\": precision, \"allow_nan_equality\": allow_nan_equality},\n formats=formats,\n )\n elif allow_nan_equality:\n assert_generic_rows_equality(\n df1.collect(), df2.collect(), are_rows_equal_enhanced, {\"allow_nan_equality\": True}, formats=formats\n )\n else:\n assert_basic_rows_equality(df1.collect(), df2.collect(), formats=formats)", "n_imports_parsed": 8, "n_files_resolved": 2, "n_chars_extracted": 1688}, "tests/test_deprecated.py::20": {"resolved_imports": ["chispa/dataframe_comparer.py", "chispa/rows_comparer.py", "chispa/bcolors.py", "chispa/default_formats.py", "chispa/formatting/__init__.py"], "used_names": ["DefaultFormats", "warnings"], "enclosing_function": "test_default_formats_deprecation_warning", "extracted_code": "# Source: chispa/default_formats.py\nclass DefaultFormats:\n \"\"\"\n This class is now deprecated and should be removed in a future release.\n \"\"\"\n\n mismatched_rows: list[str] = field(default_factory=lambda: [\"red\"])\n matched_rows: list[str] = field(default_factory=lambda: [\"blue\"])\n mismatched_cells: list[str] = field(default_factory=lambda: [\"red\", \"underline\"])\n matched_cells: list[str] = field(default_factory=lambda: [\"blue\"])\n\n def __post_init__(self) -> None:\n warnings.warn(\n \"DefaultFormats is deprecated. Use `chispa.formatting.FormattingConfig` instead.\", DeprecationWarning\n )", "n_imports_parsed": 9, "n_files_resolved": 5, "n_chars_extracted": 634}, "tests/test_deprecated.py::68": {"resolved_imports": ["chispa/dataframe_comparer.py", "chispa/rows_comparer.py", "chispa/bcolors.py", "chispa/default_formats.py", "chispa/formatting/__init__.py"], "used_names": ["FormattingConfig", "dataclass", "pytest"], "enclosing_function": "test_invalid_value_in_default_formats", "extracted_code": "# Source: chispa/formatting/__init__.py\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 9, "n_files_resolved": 5, "n_chars_extracted": 488}, "tests/test_deprecated.py::31": {"resolved_imports": ["chispa/dataframe_comparer.py", "chispa/rows_comparer.py", "chispa/bcolors.py", "chispa/default_formats.py", "chispa/formatting/__init__.py"], "used_names": ["DataFramesNotEqualError", "DefaultFormats", "assert_basic_rows_equality", "pytest", "spark"], "enclosing_function": "test_that_default_formats_still_works", "extracted_code": "# Source: chispa/dataframe_comparer.py\nclass DataFramesNotEqualError(Exception):\n \"\"\"The DataFrames are not equal\"\"\"\n\n pass\n\n\n# Source: chispa/rows_comparer.py\ndef assert_basic_rows_equality(\n rows1: list[Row], rows2: list[Row], underline_cells: bool = False, formats: FormattingConfig | None = None\n) -> None:\n if not formats:\n formats = FormattingConfig()\n elif not isinstance(formats, FormattingConfig):\n formats = FormattingConfig._from_arbitrary_dataclass(formats)\n\n if rows1 != rows2:\n t = PrettyTable([\"df1\", \"df2\"])\n zipped = list(zip_longest(rows1, rows2))\n all_rows_equal = True\n\n for r1, r2 in zipped:\n if r1 is None and r2 is not None:\n t.add_row([None, format_string(str(r2), formats.mismatched_rows)])\n all_rows_equal = False\n elif r1 is not None and r2 is None:\n t.add_row([format_string(str(r1), formats.mismatched_rows), None])\n all_rows_equal = False\n else:\n r_zipped = list(zip_longest(r1.__fields__, r2.__fields__))\n r1_string = []\n r2_string = []\n for r1_field, r2_field in r_zipped:\n if r1[r1_field] != r2[r2_field]:\n all_rows_equal = False\n r1_string.append(format_string(f\"{r1_field}={r1[r1_field]}\", formats.mismatched_cells))\n r2_string.append(format_string(f\"{r2_field}={r2[r2_field]}\", formats.mismatched_cells))\n else:\n r1_string.append(format_string(f\"{r1_field}={r1[r1_field]}\", formats.matched_cells))\n r2_string.append(format_string(f\"{r2_field}={r2[r2_field]}\", formats.matched_cells))\n r1_res = \", \".join(r1_string)\n r2_res = \", \".join(r2_string)\n\n t.add_row([r1_res, r2_res])\n if all_rows_equal is False:\n raise chispa.DataFramesNotEqualError(\"\\n\" + t.get_string())\n\n\n# Source: chispa/default_formats.py\nclass DefaultFormats:\n \"\"\"\n This class is now deprecated and should be removed in a future release.\n \"\"\"\n\n mismatched_rows: list[str] = field(default_factory=lambda: [\"red\"])\n matched_rows: list[str] = field(default_factory=lambda: [\"blue\"])\n mismatched_cells: list[str] = field(default_factory=lambda: [\"red\", \"underline\"])\n matched_cells: list[str] = field(default_factory=lambda: [\"blue\"])\n\n def __post_init__(self) -> None:\n warnings.warn(\n \"DefaultFormats is deprecated. Use `chispa.formatting.FormattingConfig` instead.\", DeprecationWarning\n )", "n_imports_parsed": 9, "n_files_resolved": 5, "n_chars_extracted": 2667}, "tests/test_deprecated.py::22": {"resolved_imports": ["chispa/dataframe_comparer.py", "chispa/rows_comparer.py", "chispa/bcolors.py", "chispa/default_formats.py", "chispa/formatting/__init__.py"], "used_names": ["DefaultFormats", "warnings"], "enclosing_function": "test_default_formats_deprecation_warning", "extracted_code": "# Source: chispa/default_formats.py\nclass DefaultFormats:\n \"\"\"\n This class is now deprecated and should be removed in a future release.\n \"\"\"\n\n mismatched_rows: list[str] = field(default_factory=lambda: [\"red\"])\n matched_rows: list[str] = field(default_factory=lambda: [\"blue\"])\n mismatched_cells: list[str] = field(default_factory=lambda: [\"red\", \"underline\"])\n matched_cells: list[str] = field(default_factory=lambda: [\"blue\"])\n\n def __post_init__(self) -> None:\n warnings.warn(\n \"DefaultFormats is deprecated. Use `chispa.formatting.FormattingConfig` instead.\", DeprecationWarning\n )", "n_imports_parsed": 9, "n_files_resolved": 5, "n_chars_extracted": 634}, "tests/test_deprecated.py::80": {"resolved_imports": ["chispa/dataframe_comparer.py", "chispa/rows_comparer.py", "chispa/bcolors.py", "chispa/default_formats.py", "chispa/formatting/__init__.py"], "used_names": ["blue", "pytest"], "enclosing_function": "test_blue_deprecation", "extracted_code": "# Source: chispa/bcolors.py\ndef blue(s: str) -> str:\n warnings.warn(\"The `blue` function is deprecated and will be removed in a future version.\", DeprecationWarning)\n return bcolors.LightBlue + str(s) + bcolors.LightRed", "n_imports_parsed": 9, "n_files_resolved": 5, "n_chars_extracted": 225}, "tests/test_deprecated.py::30": {"resolved_imports": ["chispa/dataframe_comparer.py", "chispa/rows_comparer.py", "chispa/bcolors.py", "chispa/default_formats.py", "chispa/formatting/__init__.py"], "used_names": ["DataFramesNotEqualError", "DefaultFormats", "assert_basic_rows_equality", "pytest", "spark"], "enclosing_function": "test_that_default_formats_still_works", "extracted_code": "# Source: chispa/dataframe_comparer.py\nclass DataFramesNotEqualError(Exception):\n \"\"\"The DataFrames are not equal\"\"\"\n\n pass\n\n\n# Source: chispa/rows_comparer.py\ndef assert_basic_rows_equality(\n rows1: list[Row], rows2: list[Row], underline_cells: bool = False, formats: FormattingConfig | None = None\n) -> None:\n if not formats:\n formats = FormattingConfig()\n elif not isinstance(formats, FormattingConfig):\n formats = FormattingConfig._from_arbitrary_dataclass(formats)\n\n if rows1 != rows2:\n t = PrettyTable([\"df1\", \"df2\"])\n zipped = list(zip_longest(rows1, rows2))\n all_rows_equal = True\n\n for r1, r2 in zipped:\n if r1 is None and r2 is not None:\n t.add_row([None, format_string(str(r2), formats.mismatched_rows)])\n all_rows_equal = False\n elif r1 is not None and r2 is None:\n t.add_row([format_string(str(r1), formats.mismatched_rows), None])\n all_rows_equal = False\n else:\n r_zipped = list(zip_longest(r1.__fields__, r2.__fields__))\n r1_string = []\n r2_string = []\n for r1_field, r2_field in r_zipped:\n if r1[r1_field] != r2[r2_field]:\n all_rows_equal = False\n r1_string.append(format_string(f\"{r1_field}={r1[r1_field]}\", formats.mismatched_cells))\n r2_string.append(format_string(f\"{r2_field}={r2[r2_field]}\", formats.mismatched_cells))\n else:\n r1_string.append(format_string(f\"{r1_field}={r1[r1_field]}\", formats.matched_cells))\n r2_string.append(format_string(f\"{r2_field}={r2[r2_field]}\", formats.matched_cells))\n r1_res = \", \".join(r1_string)\n r2_res = \", \".join(r2_string)\n\n t.add_row([r1_res, r2_res])\n if all_rows_equal is False:\n raise chispa.DataFramesNotEqualError(\"\\n\" + t.get_string())\n\n\n# Source: chispa/default_formats.py\nclass DefaultFormats:\n \"\"\"\n This class is now deprecated and should be removed in a future release.\n \"\"\"\n\n mismatched_rows: list[str] = field(default_factory=lambda: [\"red\"])\n matched_rows: list[str] = field(default_factory=lambda: [\"blue\"])\n mismatched_cells: list[str] = field(default_factory=lambda: [\"red\", \"underline\"])\n matched_cells: list[str] = field(default_factory=lambda: [\"blue\"])\n\n def __post_init__(self) -> None:\n warnings.warn(\n \"DefaultFormats is deprecated. Use `chispa.formatting.FormattingConfig` instead.\", DeprecationWarning\n )", "n_imports_parsed": 9, "n_files_resolved": 5, "n_chars_extracted": 2667}, "tests/test_deprecated.py::86": {"resolved_imports": ["chispa/dataframe_comparer.py", "chispa/rows_comparer.py", "chispa/bcolors.py", "chispa/default_formats.py", "chispa/formatting/__init__.py"], "used_names": ["pytest", "underline_text"], "enclosing_function": "test_underline_text_deprecation", "extracted_code": "# Source: chispa/bcolors.py\ndef underline_text(input_text: str) -> str:\n \"\"\"\n Takes an input string and returns a white, underlined string (based on PrettyTable formatting)\n \"\"\"\n warnings.warn(\n \"The `underline_text` function is deprecated and will be removed in a future version.\", DeprecationWarning\n )\n return bcolors.White + bcolors.Underline + input_text + bcolors.NC + bcolors.LightRed", "n_imports_parsed": 9, "n_files_resolved": 5, "n_chars_extracted": 416}, "tests/test_readme_examples.py::88": {"resolved_imports": ["chispa/column_comparer.py", "chispa/dataframe_comparer.py", "chispa/rows_comparer.py", "chispa/schema_comparer.py"], "used_names": ["assert_df_equality"], "enclosing_function": "ignore_row_order", "extracted_code": "# Source: chispa/dataframe_comparer.py\ndef assert_df_equality(\n df1: DataFrame,\n df2: DataFrame,\n ignore_nullable: bool = False,\n transforms: list[Callable] | None = None, # type: ignore[type-arg]\n allow_nan_equality: bool = False,\n ignore_column_order: bool = False,\n ignore_row_order: bool = False,\n underline_cells: bool = False,\n ignore_metadata: bool = False,\n ignore_columns: list[str] | None = None,\n formats: FormattingConfig | None = None,\n) -> None:\n if not formats:\n formats = FormattingConfig()\n elif not isinstance(formats, FormattingConfig):\n formats = FormattingConfig._from_arbitrary_dataclass(formats)\n\n if transforms is None:\n transforms = []\n if ignore_column_order:\n transforms.append(lambda df: df.select(sorted(df.columns)))\n if ignore_columns:\n transforms.append(lambda df: df.drop(*ignore_columns))\n if ignore_row_order:\n transforms.append(lambda df: df.sort(df.columns))\n\n df1 = reduce(lambda acc, fn: fn(acc), transforms, df1)\n df2 = reduce(lambda acc, fn: fn(acc), transforms, df2)\n\n assert_schema_equality(df1.schema, df2.schema, ignore_nullable, ignore_metadata)\n\n if allow_nan_equality:\n assert_generic_rows_equality(\n df1.collect(),\n df2.collect(),\n are_rows_equal_enhanced,\n {\"allow_nan_equality\": True},\n underline_cells=underline_cells,\n formats=formats,\n )\n else:\n assert_basic_rows_equality(\n df1.collect(),\n df2.collect(),\n underline_cells=underline_cells,\n formats=formats,\n )", "n_imports_parsed": 7, "n_files_resolved": 4, "n_chars_extracted": 1661}, "tests/test_readme_examples.py::172": {"resolved_imports": ["chispa/column_comparer.py", "chispa/dataframe_comparer.py", "chispa/rows_comparer.py", "chispa/schema_comparer.py"], "used_names": ["assert_approx_column_equality"], "enclosing_function": "test_approx_col_equality_same", "extracted_code": "# Source: chispa/column_comparer.py\ndef assert_approx_column_equality(df: DataFrame, col_name1: str, col_name2: str, precision: float) -> None:\n rows = df.select(col_name1, col_name2).collect()\n col_name_1_elements = [x[0] for x in rows]\n col_name_2_elements = [x[1] for x in rows]\n all_rows_equal = True\n zipped = list(zip(col_name_1_elements, col_name_2_elements))\n t = PrettyTable([col_name1, col_name2])\n for elements in zipped:\n first = blue(str(elements[0]))\n second = blue(str(elements[1]))\n # when one is None and the other isn't, they're not equal\n if (elements[0] is None) != (elements[1] is None):\n all_rows_equal = False\n t.add_row([str(elements[0]), str(elements[1])])\n # when both are None, they're equal\n elif elements[0] is None and elements[1] is None:\n t.add_row([first, second])\n # when the diff is less than the threshhold, they're approximately equal\n elif abs(elements[0] - elements[1]) < precision:\n t.add_row([first, second])\n # otherwise, they're not equal\n else:\n all_rows_equal = False\n t.add_row([str(elements[0]), str(elements[1])])\n if all_rows_equal is False:\n raise ColumnsNotEqualError(\"\\n\" + t.get_string())", "n_imports_parsed": 7, "n_files_resolved": 4, "n_chars_extracted": 1308}, "tests/test_readme_examples.py::67": {"resolved_imports": ["chispa/column_comparer.py", "chispa/dataframe_comparer.py", "chispa/rows_comparer.py", "chispa/schema_comparer.py"], "used_names": ["assert_df_equality"], "enclosing_function": "test_remove_non_word_characters_long", "extracted_code": "# Source: chispa/dataframe_comparer.py\ndef assert_df_equality(\n df1: DataFrame,\n df2: DataFrame,\n ignore_nullable: bool = False,\n transforms: list[Callable] | None = None, # type: ignore[type-arg]\n allow_nan_equality: bool = False,\n ignore_column_order: bool = False,\n ignore_row_order: bool = False,\n underline_cells: bool = False,\n ignore_metadata: bool = False,\n ignore_columns: list[str] | None = None,\n formats: FormattingConfig | None = None,\n) -> None:\n if not formats:\n formats = FormattingConfig()\n elif not isinstance(formats, FormattingConfig):\n formats = FormattingConfig._from_arbitrary_dataclass(formats)\n\n if transforms is None:\n transforms = []\n if ignore_column_order:\n transforms.append(lambda df: df.select(sorted(df.columns)))\n if ignore_columns:\n transforms.append(lambda df: df.drop(*ignore_columns))\n if ignore_row_order:\n transforms.append(lambda df: df.sort(df.columns))\n\n df1 = reduce(lambda acc, fn: fn(acc), transforms, df1)\n df2 = reduce(lambda acc, fn: fn(acc), transforms, df2)\n\n assert_schema_equality(df1.schema, df2.schema, ignore_nullable, ignore_metadata)\n\n if allow_nan_equality:\n assert_generic_rows_equality(\n df1.collect(),\n df2.collect(),\n are_rows_equal_enhanced,\n {\"allow_nan_equality\": True},\n underline_cells=underline_cells,\n formats=formats,\n )\n else:\n assert_basic_rows_equality(\n df1.collect(),\n df2.collect(),\n underline_cells=underline_cells,\n formats=formats,\n )", "n_imports_parsed": 7, "n_files_resolved": 4, "n_chars_extracted": 1661}, "tests/test_readme_examples.py::165": {"resolved_imports": ["chispa/column_comparer.py", "chispa/dataframe_comparer.py", "chispa/rows_comparer.py", "chispa/schema_comparer.py"], "used_names": ["DataFramesNotEqualError", "assert_basic_rows_equality", "pytest"], "enclosing_function": "it_shows_assert_basic_rows_equality", "extracted_code": "# Source: chispa/dataframe_comparer.py\nclass DataFramesNotEqualError(Exception):\n \"\"\"The DataFrames are not equal\"\"\"\n\n pass\n\n\n# Source: chispa/rows_comparer.py\ndef assert_basic_rows_equality(\n rows1: list[Row], rows2: list[Row], underline_cells: bool = False, formats: FormattingConfig | None = None\n) -> None:\n if not formats:\n formats = FormattingConfig()\n elif not isinstance(formats, FormattingConfig):\n formats = FormattingConfig._from_arbitrary_dataclass(formats)\n\n if rows1 != rows2:\n t = PrettyTable([\"df1\", \"df2\"])\n zipped = list(zip_longest(rows1, rows2))\n all_rows_equal = True\n\n for r1, r2 in zipped:\n if r1 is None and r2 is not None:\n t.add_row([None, format_string(str(r2), formats.mismatched_rows)])\n all_rows_equal = False\n elif r1 is not None and r2 is None:\n t.add_row([format_string(str(r1), formats.mismatched_rows), None])\n all_rows_equal = False\n else:\n r_zipped = list(zip_longest(r1.__fields__, r2.__fields__))\n r1_string = []\n r2_string = []\n for r1_field, r2_field in r_zipped:\n if r1[r1_field] != r2[r2_field]:\n all_rows_equal = False\n r1_string.append(format_string(f\"{r1_field}={r1[r1_field]}\", formats.mismatched_cells))\n r2_string.append(format_string(f\"{r2_field}={r2[r2_field]}\", formats.mismatched_cells))\n else:\n r1_string.append(format_string(f\"{r1_field}={r1[r1_field]}\", formats.matched_cells))\n r2_string.append(format_string(f\"{r2_field}={r2[r2_field]}\", formats.matched_cells))\n r1_res = \", \".join(r1_string)\n r2_res = \", \".join(r2_string)\n\n t.add_row([r1_res, r2_res])\n if all_rows_equal is False:\n raise chispa.DataFramesNotEqualError(\"\\n\" + t.get_string())", "n_imports_parsed": 7, "n_files_resolved": 4, "n_chars_extracted": 2030}, "tests/test_readme_examples.py::38": {"resolved_imports": ["chispa/column_comparer.py", "chispa/dataframe_comparer.py", "chispa/rows_comparer.py", "chispa/schema_comparer.py"], "used_names": ["assert_column_equality"], "enclosing_function": "test_removes_non_word_characters_short", "extracted_code": "# Source: chispa/column_comparer.py\ndef assert_column_equality(df: DataFrame, col_name1: str, col_name2: str) -> None:\n rows = df.select(col_name1, col_name2).collect()\n col_name_1_elements = [x[0] for x in rows]\n col_name_2_elements = [x[1] for x in rows]\n if col_name_1_elements != col_name_2_elements:\n zipped = list(zip(col_name_1_elements, col_name_2_elements))\n t = PrettyTable([col_name1, col_name2])\n for elements in zipped:\n if elements[0] == elements[1]:\n t.add_row([blue(str(elements[0])), blue(str(elements[1]))])\n else:\n t.add_row([str(elements[0]), str(elements[1])])\n raise ColumnsNotEqualError(\"\\n\" + t.get_string())", "n_imports_parsed": 7, "n_files_resolved": 4, "n_chars_extracted": 724}, "tests/test_readme_examples.py::51": {"resolved_imports": ["chispa/column_comparer.py", "chispa/dataframe_comparer.py", "chispa/rows_comparer.py", "chispa/schema_comparer.py"], "used_names": ["ColumnsNotEqualError", "assert_column_equality", "pytest"], "enclosing_function": "test_remove_non_word_characters_nice_error", "extracted_code": "# Source: chispa/column_comparer.py\nclass ColumnsNotEqualError(Exception):\n \"\"\"The columns are not equal\"\"\"\n\n pass\n\ndef assert_column_equality(df: DataFrame, col_name1: str, col_name2: str) -> None:\n rows = df.select(col_name1, col_name2).collect()\n col_name_1_elements = [x[0] for x in rows]\n col_name_2_elements = [x[1] for x in rows]\n if col_name_1_elements != col_name_2_elements:\n zipped = list(zip(col_name_1_elements, col_name_2_elements))\n t = PrettyTable([col_name1, col_name2])\n for elements in zipped:\n if elements[0] == elements[1]:\n t.add_row([blue(str(elements[0])), blue(str(elements[1]))])\n else:\n t.add_row([str(elements[0]), str(elements[1])])\n raise ColumnsNotEqualError(\"\\n\" + t.get_string())", "n_imports_parsed": 7, "n_files_resolved": 4, "n_chars_extracted": 810}, "tests/test_readme_examples.py::203": {"resolved_imports": ["chispa/column_comparer.py", "chispa/dataframe_comparer.py", "chispa/rows_comparer.py", "chispa/schema_comparer.py"], "used_names": ["SchemasNotEqualError", "assert_df_equality", "pytest"], "enclosing_function": "test_schema_mismatch_message", "extracted_code": "# Source: chispa/dataframe_comparer.py\ndef assert_df_equality(\n df1: DataFrame,\n df2: DataFrame,\n ignore_nullable: bool = False,\n transforms: list[Callable] | None = None, # type: ignore[type-arg]\n allow_nan_equality: bool = False,\n ignore_column_order: bool = False,\n ignore_row_order: bool = False,\n underline_cells: bool = False,\n ignore_metadata: bool = False,\n ignore_columns: list[str] | None = None,\n formats: FormattingConfig | None = None,\n) -> None:\n if not formats:\n formats = FormattingConfig()\n elif not isinstance(formats, FormattingConfig):\n formats = FormattingConfig._from_arbitrary_dataclass(formats)\n\n if transforms is None:\n transforms = []\n if ignore_column_order:\n transforms.append(lambda df: df.select(sorted(df.columns)))\n if ignore_columns:\n transforms.append(lambda df: df.drop(*ignore_columns))\n if ignore_row_order:\n transforms.append(lambda df: df.sort(df.columns))\n\n df1 = reduce(lambda acc, fn: fn(acc), transforms, df1)\n df2 = reduce(lambda acc, fn: fn(acc), transforms, df2)\n\n assert_schema_equality(df1.schema, df2.schema, ignore_nullable, ignore_metadata)\n\n if allow_nan_equality:\n assert_generic_rows_equality(\n df1.collect(),\n df2.collect(),\n are_rows_equal_enhanced,\n {\"allow_nan_equality\": True},\n underline_cells=underline_cells,\n formats=formats,\n )\n else:\n assert_basic_rows_equality(\n df1.collect(),\n df2.collect(),\n underline_cells=underline_cells,\n formats=formats,\n )\n\n\n# Source: chispa/schema_comparer.py\nclass SchemasNotEqualError(Exception):\n \"\"\"The schemas are not equal\"\"\"\n\n pass", "n_imports_parsed": 7, "n_files_resolved": 4, "n_chars_extracted": 1784}, "tests/test_row_comparer.py::10": {"resolved_imports": ["chispa/row_comparer.py"], "used_names": ["Row", "are_rows_equal"], "enclosing_function": "test_are_rows_equal", "extracted_code": "# Source: chispa/row_comparer.py\ndef are_rows_equal(r1: Row, r2: Row) -> bool:\n return r1 == r2", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 98}, "tests/test_row_comparer.py::9": {"resolved_imports": ["chispa/row_comparer.py"], "used_names": ["Row", "are_rows_equal"], "enclosing_function": "test_are_rows_equal", "extracted_code": "# Source: chispa/row_comparer.py\ndef are_rows_equal(r1: Row, r2: Row) -> bool:\n return r1 == r2", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 98}, "tests/test_rows_comparer.py::32": {"resolved_imports": ["chispa/dataframe_comparer.py", "chispa/rows_comparer.py"], "used_names": ["assert_basic_rows_equality", "spark"], "enclosing_function": "it_works_when_rows_are_the_same", "extracted_code": "# Source: chispa/rows_comparer.py\ndef assert_basic_rows_equality(\n rows1: list[Row], rows2: list[Row], underline_cells: bool = False, formats: FormattingConfig | None = None\n) -> None:\n if not formats:\n formats = FormattingConfig()\n elif not isinstance(formats, FormattingConfig):\n formats = FormattingConfig._from_arbitrary_dataclass(formats)\n\n if rows1 != rows2:\n t = PrettyTable([\"df1\", \"df2\"])\n zipped = list(zip_longest(rows1, rows2))\n all_rows_equal = True\n\n for r1, r2 in zipped:\n if r1 is None and r2 is not None:\n t.add_row([None, format_string(str(r2), formats.mismatched_rows)])\n all_rows_equal = False\n elif r1 is not None and r2 is None:\n t.add_row([format_string(str(r1), formats.mismatched_rows), None])\n all_rows_equal = False\n else:\n r_zipped = list(zip_longest(r1.__fields__, r2.__fields__))\n r1_string = []\n r2_string = []\n for r1_field, r2_field in r_zipped:\n if r1[r1_field] != r2[r2_field]:\n all_rows_equal = False\n r1_string.append(format_string(f\"{r1_field}={r1[r1_field]}\", formats.mismatched_cells))\n r2_string.append(format_string(f\"{r2_field}={r2[r2_field]}\", formats.mismatched_cells))\n else:\n r1_string.append(format_string(f\"{r1_field}={r1[r1_field]}\", formats.matched_cells))\n r2_string.append(format_string(f\"{r2_field}={r2[r2_field]}\", formats.matched_cells))\n r1_res = \", \".join(r1_string)\n r2_res = \", \".join(r2_string)\n\n t.add_row([r1_res, r2_res])\n if all_rows_equal is False:\n raise chispa.DataFramesNotEqualError(\"\\n\" + t.get_string())", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 1898}, "tests/test_rows_comparer.py::16": {"resolved_imports": ["chispa/dataframe_comparer.py", "chispa/rows_comparer.py"], "used_names": ["DataFramesNotEqualError", "assert_basic_rows_equality", "pytest", "spark"], "enclosing_function": "it_throws_with_row_mismatches", "extracted_code": "# Source: chispa/dataframe_comparer.py\nclass DataFramesNotEqualError(Exception):\n \"\"\"The DataFrames are not equal\"\"\"\n\n pass\n\n\n# Source: chispa/rows_comparer.py\ndef assert_basic_rows_equality(\n rows1: list[Row], rows2: list[Row], underline_cells: bool = False, formats: FormattingConfig | None = None\n) -> None:\n if not formats:\n formats = FormattingConfig()\n elif not isinstance(formats, FormattingConfig):\n formats = FormattingConfig._from_arbitrary_dataclass(formats)\n\n if rows1 != rows2:\n t = PrettyTable([\"df1\", \"df2\"])\n zipped = list(zip_longest(rows1, rows2))\n all_rows_equal = True\n\n for r1, r2 in zipped:\n if r1 is None and r2 is not None:\n t.add_row([None, format_string(str(r2), formats.mismatched_rows)])\n all_rows_equal = False\n elif r1 is not None and r2 is None:\n t.add_row([format_string(str(r1), formats.mismatched_rows), None])\n all_rows_equal = False\n else:\n r_zipped = list(zip_longest(r1.__fields__, r2.__fields__))\n r1_string = []\n r2_string = []\n for r1_field, r2_field in r_zipped:\n if r1[r1_field] != r2[r2_field]:\n all_rows_equal = False\n r1_string.append(format_string(f\"{r1_field}={r1[r1_field]}\", formats.mismatched_cells))\n r2_string.append(format_string(f\"{r2_field}={r2[r2_field]}\", formats.mismatched_cells))\n else:\n r1_string.append(format_string(f\"{r1_field}={r1[r1_field]}\", formats.matched_cells))\n r2_string.append(format_string(f\"{r2_field}={r2[r2_field]}\", formats.matched_cells))\n r1_res = \", \".join(r1_string)\n r2_res = \", \".join(r2_string)\n\n t.add_row([r1_res, r2_res])\n if all_rows_equal is False:\n raise chispa.DataFramesNotEqualError(\"\\n\" + t.get_string())", "n_imports_parsed": 4, "n_files_resolved": 2, "n_chars_extracted": 2030}, "tests/test_schema_comparer.py::26": {"resolved_imports": ["chispa/schema_comparer.py"], "used_names": ["IntegerType", "StringType", "StructField", "StructType", "assert_schema_equality"], "enclosing_function": "it_does_nothing_when_equal", "extracted_code": "# Source: chispa/schema_comparer.py\ndef assert_schema_equality(\n s1: StructType, s2: StructType, ignore_nullable: bool = False, ignore_metadata: bool = False\n) -> None:\n if not ignore_nullable and not ignore_metadata:\n assert_basic_schema_equality(s1, s2)\n else:\n assert_schema_equality_full(s1, s2, ignore_nullable, ignore_metadata)", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 356}, "tests/test_schema_comparer.py::400": {"resolved_imports": ["chispa/schema_comparer.py"], "used_names": ["ArrayType", "DoubleType", "IntegerType", "StringType", "StructField", "StructType", "are_schemas_equal_ignore_nullable"], "enclosing_function": "it_returns_true_when_only_nullable_flag_is_different", "extracted_code": "# Source: chispa/schema_comparer.py\ndef are_schemas_equal_ignore_nullable(s1: StructType, s2: StructType, ignore_metadata: bool = False) -> bool:\n if len(s1) != len(s2):\n return False\n zipped = list(zip_longest(s1, s2))\n for sf1, sf2 in zipped:\n if not are_structfields_equal(sf1, sf2, True, ignore_metadata):\n return False\n return True", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 373}, "tests/test_schema_comparer.py::415": {"resolved_imports": ["chispa/schema_comparer.py"], "used_names": ["ArrayType", "DoubleType", "IntegerType", "StructField", "StructType", "are_schemas_equal_ignore_nullable"], "enclosing_function": "it_returns_false_when_the_element_type_is_different_within_array", "extracted_code": "# Source: chispa/schema_comparer.py\ndef are_schemas_equal_ignore_nullable(s1: StructType, s2: StructType, ignore_metadata: bool = False) -> bool:\n if len(s1) != len(s2):\n return False\n zipped = list(zip_longest(s1, s2))\n for sf1, sf2 in zipped:\n if not are_structfields_equal(sf1, sf2, True, ignore_metadata):\n return False\n return True", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 373}, "tests/test_structfield_comparer.py::12": {"resolved_imports": ["chispa/structfield_comparer.py"], "used_names": ["IntegerType", "StructField", "are_structfields_equal"], "enclosing_function": "it_returns_true_when_structfields_are_the_same", "extracted_code": "# Source: chispa/structfield_comparer.py\nfrom __future__ import annotations\n\nfrom chispa.schema_comparer import are_structfields_equal\n\n__all__ = (\"are_structfields_equal\",)\n\nfrom chispa.schema_comparer import are_structfields_equal\n\n__all__ = (\"are_structfields_equal\",)", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 271}, "tests/test_structfield_comparer.py::17": {"resolved_imports": ["chispa/structfield_comparer.py"], "used_names": ["IntegerType", "StructField", "are_structfields_equal"], "enclosing_function": "it_returns_false_when_column_names_are_different", "extracted_code": "# Source: chispa/structfield_comparer.py\nfrom __future__ import annotations\n\nfrom chispa.schema_comparer import are_structfields_equal\n\n__all__ = (\"are_structfields_equal\",)\n\nfrom chispa.schema_comparer import are_structfields_equal\n\n__all__ = (\"are_structfields_equal\",)", "n_imports_parsed": 3, "n_files_resolved": 1, "n_chars_extracted": 271}, "tests/formatting/test_formats.py::91": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Format"], "enclosing_function": "test_format_from_dict_empty", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formats.py::13": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Color", "Format", "Style"], "enclosing_function": "test_format_from_dict_valid", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formats.py::19": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Format", "pytest"], "enclosing_function": "test_format_from_dict_invalid_color", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formats.py::14": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Color", "Format", "Style"], "enclosing_function": "test_format_from_dict_valid", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formats.py::85": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Format", "pytest"], "enclosing_function": "test_format_from_list_non_string_elements", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formats.py::33": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Format", "pytest"], "enclosing_function": "test_format_from_dict_invalid_style", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formats.py::21": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Format", "pytest"], "enclosing_function": "test_format_from_dict_invalid_color", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formats.py::61": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Format", "pytest"], "enclosing_function": "test_format_from_list_invalid_color", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formats.py::73": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Format", "pytest"], "enclosing_function": "test_format_from_list_invalid_style", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formatting_config.py::13": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Color", "FormattingConfig"], "enclosing_function": "test_default_mismatched_rows", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formatting_config.py::12": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Color", "FormattingConfig"], "enclosing_function": "test_default_mismatched_rows", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formatting_config.py::18": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Color", "FormattingConfig"], "enclosing_function": "test_default_matched_rows", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formatting_config.py::54": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Color", "FormattingConfig", "Style"], "enclosing_function": "test_custom_matched_cells", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formatting_config.py::36": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Color", "FormattingConfig", "Style"], "enclosing_function": "test_custom_mismatched_rows", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formatting_config.py::59": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["FormattingConfig", "pytest"], "enclosing_function": "test_invalid_color", "extracted_code": "# Source: chispa/formatting/__init__.py\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 488}, "tests/formatting/test_formatting_config.py::42": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Color", "FormattingConfig"], "enclosing_function": "test_custom_matched_rows", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formatting_config.py::48": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Color", "FormattingConfig", "Style"], "enclosing_function": "test_custom_mismatched_cells", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formatting_config.py::49": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Color", "FormattingConfig", "Style"], "enclosing_function": "test_custom_mismatched_cells", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formatting_config.py::25": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Color", "FormattingConfig", "Style"], "enclosing_function": "test_default_mismatched_cells", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formatting_config.py::55": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Color", "FormattingConfig", "Style"], "enclosing_function": "test_custom_matched_cells", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formatting_config.py::37": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["Color", "FormattingConfig", "Style"], "enclosing_function": "test_custom_mismatched_rows", "extracted_code": "# Source: chispa/formatting/__init__.py\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 779}, "tests/formatting/test_formatting_config.py::72": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["FormattingConfig", "pytest"], "enclosing_function": "test_invalid_style", "extracted_code": "# Source: chispa/formatting/__init__.py\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 488}, "tests/formatting/test_formatting_config.py::61": {"resolved_imports": ["chispa/formatting/__init__.py"], "used_names": ["FormattingConfig", "pytest"], "enclosing_function": "test_invalid_color", "extracted_code": "# Source: chispa/formatting/__init__.py\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")", "n_imports_parsed": 4, "n_files_resolved": 1, "n_chars_extracted": 488}, "tests/formatting/test_terminal_string_formatter.py::11": {"resolved_imports": ["chispa/formatting/__init__.py", "chispa/formatting/format_string.py", "chispa/formatting/formats.py"], "used_names": ["Color", "Format", "RESET", "Style", "format_string"], "enclosing_function": "test_format_with_enum_inputs", "extracted_code": "# Source: chispa/formatting/__init__.py\nfrom __future__ import annotations\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\n\nfrom chispa.formatting.format_string import blue, format_string\nfrom chispa.formatting.formats import RESET, Color, Format, Style\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\nfrom chispa.formatting.formatting_config import FormattingConfig\n\n__all__ = (\"RESET\", \"Color\", \"Format\", \"FormattingConfig\", \"Style\", \"blue\", \"format_string\")\n\n\n# Source: chispa/formatting/formats.py\nclass Color(str, Enum):\n \"\"\"\n Enum for terminal colors.\n Each color is represented by its corresponding ANSI escape code.\n \"\"\"\n\n BLACK = \"\\033[30m\"\n RED = \"\\033[31m\"\n GREEN = \"\\033[32m\"\n YELLOW = \"\\033[33m\"\n BLUE = \"\\033[34m\"\n PURPLE = \"\\033[35m\"\n CYAN = \"\\033[36m\"\n LIGHT_GRAY = \"\\033[37m\"\n DARK_GRAY = \"\\033[90m\"\n LIGHT_RED = \"\\033[91m\"\n LIGHT_GREEN = \"\\033[92m\"\n LIGHT_YELLOW = \"\\033[93m\"\n LIGHT_BLUE = \"\\033[94m\"\n LIGHT_PURPLE = \"\\033[95m\"\n LIGHT_CYAN = \"\\033[96m\"\n WHITE = \"\\033[97m\"\n\nclass Style(str, Enum):\n \"\"\"\n Enum for text styles.\n Each style is represented by its corresponding ANSI escape code.\n \"\"\"\n\n BOLD = \"\\033[1m\"\n UNDERLINE = \"\\033[4m\"\n BLINK = \"\\033[5m\"\n INVERT = \"\\033[7m\"\n HIDE = \"\\033[8m\"\n\nclass Format:\n \"\"\"\n Data class to represent text formatting with color and style.\n\n Attributes:\n color (Color | None): The color for the text.\n style (list[Style] | None): A list of styles for the text.\n \"\"\"\n\n color: Color | None = None\n style: list[Style] | None = None\n\n @classmethod\n def from_dict(cls, format_dict: dict[str, str | list[str]]) -> Format:\n \"\"\"\n Create a Format instance from a dictionary.\n\n Args:\n format_dict (dict): A dictionary with keys 'color' and/or 'style'.\n \"\"\"\n if not isinstance(format_dict, dict):\n raise ValueError(\"Input must be a dictionary\")\n\n valid_keys = {\"color\", \"style\"}\n invalid_keys = set(format_dict) - valid_keys\n if invalid_keys:\n raise ValueError(f\"Invalid keys in format dictionary: {invalid_keys}. Valid keys are {valid_keys}\")\n\n if isinstance(format_dict.get(\"color\"), list):\n raise TypeError(\"The value for key 'color' should be a string, not a list!\")\n color = cls._get_color_enum(format_dict.get(\"color\")) # type: ignore[arg-type]\n\n style = format_dict.get(\"style\")\n if isinstance(style, str):\n styles = [cls._get_style_enum(style)]\n elif isinstance(style, list):\n styles = [cls._get_style_enum(s) for s in style]\n else:\n styles = None\n\n return cls(color=color, style=styles) # type: ignore[arg-type]\n\n @classmethod\n def from_list(cls, values: list[str]) -> Format:\n \"\"\"\n Create a Format instance from a list of strings.\n\n Args:\n values (list[str]): A list of strings representing colors and styles.\n \"\"\"\n if not all(isinstance(value, str) for value in values):\n raise ValueError(\"All elements in the list must be strings\")\n\n color = None\n styles = []\n valid_colors = [c.name.lower() for c in Color]\n valid_styles = [s.name.lower() for s in Style]\n\n for value in values:\n if value in valid_colors:\n color = Color[value.upper()]\n elif value in valid_styles:\n styles.append(Style[value.upper()])\n else:\n raise ValueError(\n f\"Invalid value: {value}. Valid values are colors: {valid_colors} and styles: {valid_styles}\"\n )\n\n return cls(color=color, style=styles if styles else None)\n\n @staticmethod\n def _get_color_enum(color: Color | str | None) -> Color | None:\n if isinstance(color, Color):\n return color\n elif isinstance(color, str):\n try:\n return Color[color.upper()]\n except KeyError:\n valid_colors = [c.name.lower() for c in Color]\n raise ValueError(f\"Invalid color name: {color}. Valid color names are {valid_colors}\")\n return None\n\n @staticmethod\n def _get_style_enum(style: Style | str | None) -> Style | None:\n if isinstance(style, Style):\n return style\n elif isinstance(style, str):\n try:\n return Style[style.upper()]\n except KeyError:\n valid_styles = [f.name.lower() for f in Style]\n raise ValueError(f\"Invalid style name: {style}. Valid style names are {valid_styles}\")\n return None", "n_imports_parsed": 3, "n_files_resolved": 3, "n_chars_extracted": 5048}}}