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

Method is_module

mypy/build.py:1262–1276  ·  view source on GitHub ↗

Does the given fullname refer to a module? Note: this does not always verify that the module exists and relies on previously executed logic in find_module_and_diagnose().

(self, id: str)

Source from the content-addressed store, hash-verified

1260 return res
1261
1262 def is_module(self, id: str) -> bool:
1263 """Does the given fullname refer to a module?
1264
1265 Note: this does not always verify that the module exists and relies on
1266 previously executed logic in find_module_and_diagnose().
1267 """
1268 if id in self.modules:
1269 # Micro-optimization, if we already found it, it is definitely a module.
1270 return True
1271 if id in self.source_set.source_modules:
1272 # Special case: if a module is passed on command line, we accept it even
1273 # if we would not resolve it using regular mechanisms. This makes behavior
1274 # consistent in cases like `mypy foo-stubs`, where stubs are not installed.
1275 return True
1276 return find_module_simple(id, self) is not None
1277
1278 def parse_file(
1279 self,

Callers 1

Calls 1

find_module_simpleFunction · 0.85

Tested by

no test coverage detected