(package)
return reader(spec.name)
Return the package's loader if it's a ResourceReader.
Return the package's loader if it's a ResourceReader.
Return the package s loader if it s a ResourceReader .
def get_resource_reader(package):
    # 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.
    spec = package.__spec__
    reader = getattr(spec.loader, 'get_resource_reader', None)  # type: ignore
    if reader is None:
        return None
    return reader(spec.name)
def get_resource_reader ( package ) : # type: (types.ModuleType) -> Optional[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. spec = package . __spec__ reader = getattr ( spec . loader , 'get_resource_reader' , None ) # type: ignore if reader is None : return None return reader ( spec . name )