Lines Matching defs:package
329 package the module is in. The parent is derived from the name.
331 `is_package` determines if the module is considered a package or
611 # Namespace package.
669 # Not a namespace package.
688 # A namespace package so do nothing.
1016 """Return True if the frozen module is a package."""
1035 def _resolve_name(name, package, level):
1037 bits = package.rsplit('.', level - 1)
1039 raise ImportError('attempted relative import beyond top-level package')
1101 def _sanity_check(name, package, level):
1108 if not isinstance(package, str):
1110 elif not package:
1112 'package')
1134 msg = (_ERR_MSG + '; {!r} is not a package').format(name, parent)
1192 def _gcd_import(name, package=None, level=0):
1193 """Import and return the module based on its name, the package the call is
1201 _sanity_check(name, package, level)
1203 name = _resolve_name(name, package, level)
1216 # If a package was imported, try to import stuff from fromlist.
1251 package = globals.get('__package__')
1253 if package is not None:
1254 if spec is not None and package != spec.parent:
1256 f"({package!r} != {spec.parent!r})",
1258 return package
1262 _warnings.warn("can't resolve package from __spec__ or __package__, "
1265 package = globals['__name__']
1267 package = package.rpartition('.')[0]
1268 return package
1278 argument represents the package location to import from in a relative
1286 package = _calc___package__(globals_)
1287 module = _gcd_import(name, package, level)