MCPcopy Index your code
hub / github.com/python/cpython / any_missing_maybe

Method any_missing_maybe

Lib/modulefinder.py:547–591  ·  view source on GitHub ↗

Return two lists, one with modules that are certainly missing and one with modules that *may* be missing. The latter names could either be submodules *or* just global names in the package. The reason it can't always be determined is that it's impossible to tell which

(self)

Source from the content-addressed store, hash-verified

545 return missing + maybe
546
547 def any_missing_maybe(self):
548 """Return two lists, one with modules that are certainly missing
549 and one with modules that *may* be missing. The latter names could
550 either be submodules *or* just global names in the package.
551
552 The reason it can't always be determined is that it's impossible to
553 tell which names are imported when "from module import *" is done
554 with an extension module, short of actually importing it.
555 """
556 missing = []
557 maybe = []
558 for name in self.badmodules:
559 if name in self.excludes:
560 continue
561 i = name.rfind(".")
562 if i < 0:
563 missing.append(name)
564 continue
565 subname = name[i+1:]
566 pkgname = name[:i]
567 pkg = self.modules.get(pkgname)
568 if pkg is not None:
569 if pkgname in self.badmodules[name]:
570 # The package tried to import this module itself and
571 # failed. It's definitely missing.
572 missing.append(name)
573 elif subname in pkg.globalnames:
574 # It's a global in the package: definitely not missing.
575 pass
576 elif pkg.starimports:
577 # It could be missing, but the package did an "import *"
578 # from a non-Python module, so we simply can't be sure.
579 maybe.append(name)
580 else:
581 # It's not a global in the package, the package didn't
582 # do funny star imports, it's very likely to be missing.
583 # The symbol could be inserted into the package from the
584 # outside, but since that's not good style we simply list
585 # it missing.
586 missing.append(name)
587 else:
588 missing.append(name)
589 missing.sort()
590 maybe.sort()
591 return missing, maybe
592
593 def replace_paths_in_code(self, co):
594 new_filename = original_filename = os.path.normpath(co.co_filename)

Callers 3

reportMethod · 0.95
any_missingMethod · 0.95
_do_testMethod · 0.80

Calls 4

rfindMethod · 0.45
appendMethod · 0.45
getMethod · 0.45
sortMethod · 0.45

Tested by 1

_do_testMethod · 0.64