Lines Matching defs:parent
328 to use when loading the module. `parent` is the name of the
329 package the module is in. The parent is derived from the name.
406 def parent(self):
407 """The name of the module's parent."""
533 module.__package__ = spec.parent
653 # on spec.parent here.
714 The module is not added to its parent.
1080 # The parent import may have already imported this module.
1087 # we would have used if the parent module hadn't
1111 raise ImportError('attempted relative import with no known parent '
1122 parent = name.rpartition('.')[0]
1124 if parent:
1125 if parent not in sys.modules:
1126 _call_with_frames_removed(import_, parent)
1130 parent_module = sys.modules[parent]
1134 msg = (_ERR_MSG + '; {!r} is not a package').format(name, parent)
1143 # Temporarily add child we are currently importing to parent's
1151 if parent:
1152 # Set the module as an attribute on its parent.
1153 parent_module = sys.modules[parent]
1157 msg = f"Cannot set an attribute on {parent!r} for child module {child!r}"
1254 if spec is not None and package != spec.parent:
1255 _warnings.warn("__package__ != __spec__.parent "
1256 f"({package!r} != {spec.parent!r})",
1260 return spec.parent