(
self, id: str, pkg_dir: str
)
| 344 | return version >= min_version and (max_version is None or version <= max_version) |
| 345 | |
| 346 | def _find_module_non_stub_helper( |
| 347 | self, id: str, pkg_dir: str |
| 348 | ) -> OnePackageDir | ModuleNotFoundReason: |
| 349 | plausible_match = False |
| 350 | dir_path = pkg_dir |
| 351 | components = id.split(".") |
| 352 | for index, component in enumerate(components): |
| 353 | dir_path = os_path_join(dir_path, component) |
| 354 | if self.fscache.isfile(os_path_join(dir_path, "py.typed")): |
| 355 | return os.path.join(pkg_dir, *components[:-1]), index == 0 |
| 356 | elif not plausible_match and ( |
| 357 | self.fscache.isdir(dir_path) or self.fscache.isfile(dir_path + ".py") |
| 358 | ): |
| 359 | plausible_match = True |
| 360 | # If this is not a directory then we can't traverse further into it |
| 361 | if not self.fscache.isdir(dir_path): |
| 362 | break |
| 363 | if plausible_match: |
| 364 | if self.options: |
| 365 | module_specific_options = self.options.clone_for_module(id) |
| 366 | if module_specific_options.follow_untyped_imports: |
| 367 | return os.path.join(pkg_dir, *components[:-1]), False |
| 368 | return ModuleNotFoundReason.FOUND_WITHOUT_TYPE_HINTS |
| 369 | else: |
| 370 | return ModuleNotFoundReason.NOT_FOUND |
| 371 | |
| 372 | def _update_ns_ancestors(self, components: list[str], match: tuple[str, bool]) -> None: |
| 373 | path, verify = match |
no test coverage detected