MCPcopy Index your code
hub / github.com/RustPython/RustPython / collect_original_methods

Function collect_original_methods

scripts/update_lib/cmd_quick.py:49–73  ·  view source on GitHub ↗

Collect original test methods from lib path before patching. Returns: - For file: set of (class_name, method_name) or None if file doesn't exist - For directory: dict mapping file path to set of methods, or None if dir doesn't exist

(
    lib_path: pathlib.Path,
)

Source from the content-addressed store, hash-verified

47
48
49def collect_original_methods(
50 lib_path: pathlib.Path,
51) -> set[tuple[str, str]] | dict[pathlib.Path, set[tuple[str, str]]] | None:
52 """
53 Collect original test methods from lib path before patching.
54
55 Returns:
56 - For file: set of (class_name, method_name) or None if file doesn't exist
57 - For directory: dict mapping file path to set of methods, or None if dir doesn't exist
58 """
59 from update_lib.cmd_auto_mark import extract_test_methods
60
61 if not lib_path.exists():
62 return None
63
64 if lib_path.is_file():
65 content = safe_read_text(lib_path)
66 return extract_test_methods(content) if content else set()
67 else:
68 result = {}
69 for lib_file in get_test_files(lib_path):
70 content = safe_read_text(lib_file)
71 if content:
72 result[lib_file.resolve()] = extract_test_methods(content)
73 return result
74
75
76def quick(

Callers 3

quickFunction · 0.85

Calls 7

safe_read_textFunction · 0.90
extract_test_methodsFunction · 0.90
get_test_filesFunction · 0.90
setFunction · 0.85
existsMethod · 0.45
is_fileMethod · 0.45
resolveMethod · 0.45

Tested by 2