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

Method maybe_swap_for_shadow_path

mypy/build.py:1157–1173  ·  view source on GitHub ↗
(self, path: str)

Source from the content-addressed store, hash-verified

1155 return self.cache_enabled and self.options.use_fine_grained_cache
1156
1157 def maybe_swap_for_shadow_path(self, path: str) -> str:
1158 if not self.shadow_map:
1159 return path
1160
1161 path = normpath(path, self.options)
1162
1163 previously_checked = path in self.shadow_equivalence_map
1164 if not previously_checked:
1165 for source, shadow in self.shadow_map.items():
1166 if self.fscache.samefile(path, source):
1167 self.shadow_equivalence_map[path] = shadow
1168 break
1169 else:
1170 self.shadow_equivalence_map[path] = None
1171
1172 shadow_file = self.shadow_equivalence_map.get(path)
1173 return shadow_file if shadow_file else path
1174
1175 def get_stat(self, path: str) -> os.stat_result | None:
1176 return self.fscache.stat_or_none(self.maybe_swap_for_shadow_path(path))

Callers 2

get_statMethod · 0.95
get_sourceMethod · 0.80

Calls 4

normpathFunction · 0.85
samefileMethod · 0.80
itemsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected