MCPcopy Index your code
hub / github.com/python/mypy / normalize_file_output

Function normalize_file_output

mypy/test/helpers.py:510–521  ·  view source on GitHub ↗

Normalize file output for comparison.

(content: list[str], current_abs_path: str)

Source from the content-addressed store, hash-verified

508
509
510def normalize_file_output(content: list[str], current_abs_path: str) -> list[str]:
511 """Normalize file output for comparison."""
512 timestamp_regex = re.compile(r"\d{10}")
513 result = [x.replace(current_abs_path, "$PWD") for x in content]
514 version = mypy.version.__version__
515 result = [re.sub(r"\b" + re.escape(version) + r"\b", "$VERSION", x) for x in result]
516 # We generate a new mypy.version when building mypy wheels that
517 # lacks base_version, so handle that case.
518 base_version = getattr(mypy.version, "base_version", version)
519 result = [re.sub(r"\b" + re.escape(base_version) + r"\b", "$VERSION", x) for x in result]
520 result = [timestamp_regex.sub("$TIMESTAMP", x) for x in result]
521 return result
522
523
524def normalize_report_meta(content: list[str]) -> list[str]:

Callers 1

check_test_output_filesFunction · 0.85

Calls 2

getattrFunction · 0.85
replaceMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…