=
# type: (Package) -> Traversable
"""
Get a Traversable resource from a package
"""
return
# type: (types.ModuleType) -> Optional[ResourceReader]
"""
Return the package's loader if it's a ResourceReader.
"""
# We can't use
# a issubclass() check here because apparently abc.'s __subclasscheck__()
# hook wants to create a weak reference to the object, but
# zipimport.zipimporter does not support weak references, resulting in a
# TypeError. That seems terrible.
=
= # type: ignore
return None
return # type: ignore
# type: (Package) -> types.ModuleType
return
# type: (Package) -> types.ModuleType
"""Take a package name or module object and return the module.
Raise an exception if the resolved module is not a package.
"""
=
return
"""
Return a Traversable object for the given package.
"""
=
=
return
# Not using tempfile.NamedTemporaryFile as it leads to deeper 'try'
# blocks due to the need to close the temporary file to work on Windows
# properly.
, =
del
yield
pass
"""
Given a Traversable object, return that object as a
path on the local file system in a context manager.
"""
return
"""
Degenerate behavior for pathlib.Path objects.
"""
yield