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

Method stat_or_none

mypy/fscache.py:65–80  ·  view source on GitHub ↗
(self, path: str)

Source from the content-addressed store, hash-verified

63 self.fake_package_cache: set[str] = set()
64
65 def stat_or_none(self, path: str) -> os.stat_result | None:
66 if path in self.stat_or_none_cache:
67 return self.stat_or_none_cache[path]
68
69 st = None
70 try:
71 st = os.stat(path)
72 except OSError:
73 if self.init_under_package_root(path):
74 try:
75 st = self._fake_init(path)
76 except OSError:
77 pass
78
79 self.stat_or_none_cache[path] = st
80 return st
81
82 def init_under_package_root(self, path: str) -> bool:
83 """Is this path an __init__.py under a package root?

Callers 8

isfileMethod · 0.95
isdirMethod · 0.95
existsMethod · 0.95
readMethod · 0.95
samefileMethod · 0.95
get_statMethod · 0.80
_find_changedMethod · 0.80

Calls 2

_fake_initMethod · 0.95

Tested by

no test coverage detected