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

Method is_package

Lib/importlib/_bootstrap_external.py:730–736  ·  view source on GitHub ↗

Concrete implementation of InspectLoader.is_package by checking if the path returned by get_filename has a filename of '__init__.py'.

(self, fullname)

Source from the content-addressed store, hash-verified

728 SourcelessFileLoader."""
729
730 def is_package(self, fullname):
731 """Concrete implementation of InspectLoader.is_package by checking if
732 the path returned by get_filename has a filename of '__init__.py'."""
733 filename = _path_split(self.get_filename(fullname))[1]
734 filename_base = filename.rsplit('.', 1)[0]
735 tail_name = fullname.rpartition('.')[2]
736 return filename_base == '__init__' and tail_name != '__init__'
737
738 def create_module(self, spec):
739 """Use default semantics for module creation."""

Callers 1

spec_from_file_locationFunction · 0.45

Calls 4

_path_splitFunction · 0.85
get_filenameMethod · 0.45
rsplitMethod · 0.45
rpartitionMethod · 0.45

Tested by

no test coverage detected