Ejemplo n.º 1
0
def resolve_uri(uri):
    from pyramid.path import PkgResourcesAssetDescriptor
    pkg_name, path = uri.split(":", 1)
    a = PkgResourcesAssetDescriptor(pkg_name, path)
    absolute = a.abspath()  # this is sometimes not absolute :-/
    absolute = os.path.abspath(absolute)  # so we make it absolute
    return absolute
Ejemplo n.º 2
0
def resole_uri(uri):
    from pyramid.path import PkgResourcesAssetDescriptor
    pkg_name,path=uri.split(":",1)
    a = PkgResourcesAssetDescriptor(pkg_name,path)
    absolute = a.abspath() #this is sometimes not absolute :-/
    absolute = os.path.abspath(absolute) #so we make it absolute
    return absolute
Ejemplo n.º 3
0
 def _hash_asset(self, asset: AssetDescriptor) -> str:
     hash_ = sha256()
     with cast(BinaryIO, asset.stream()) as stream:
         for block in iter(lambda: stream.read(4096), b""):
             hash_.update(block)
     return hash_.hexdigest()