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

Function normpath

mypy/build.py:586–598  ·  view source on GitHub ↗

Convert path to absolute; but to relative in bazel mode. (Bazel's distributed cache doesn't like filesystem metadata to end up in output files.)

(path: str, options: Options)

Source from the content-addressed store, hash-verified

584
585
586def normpath(path: str, options: Options) -> str:
587 """Convert path to absolute; but to relative in bazel mode.
588
589 (Bazel's distributed cache doesn't like filesystem metadata to
590 end up in output files.)
591 """
592 # TODO: Could we always use relpath? (A worry in non-bazel
593 # mode would be that a moved file may change its full module
594 # name without changing its size, mtime or hash.)
595 if options.bazel:
596 return os.path.relpath(path)
597 else:
598 return os.path.abspath(path)
599
600
601# NOTE: dependencies + suppressed == all reachable imports;

Callers 3

get_cache_namesFunction · 0.85
validate_metaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…