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

Function fix_win_path

mypy/test/data.py:568–579  ·  view source on GitHub ↗

r"""Changes Windows paths to Linux paths in error messages. E.g. foo\bar.py -> foo/bar.py.

(line: str)

Source from the content-addressed store, hash-verified

566
567
568def fix_win_path(line: str) -> str:
569 r"""Changes Windows paths to Linux paths in error messages.
570
571 E.g. foo\bar.py -> foo/bar.py.
572 """
573 line = line.replace(root_dir, root_dir.replace("\\", "/"))
574 m = re.match(r"^([\S/]+):(\d+:)?(\s+.*)", line)
575 if not m:
576 return line
577 else:
578 filename, lineno, message = m.groups()
579 return "{}:{}{}".format(filename.replace("\\", "/"), lineno or "", message)
580
581
582def fix_cobertura_filename(line: str) -> str:

Callers 1

parse_test_caseFunction · 0.85

Calls 2

replaceMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…