예제 #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
예제 #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
예제 #3
0
파일: assets.py 프로젝트: betagouv/zam
 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()