Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
overlay.py38 linesDownload Raw Back to compat
1"""2Expose zipp.Path as .zipfile.Path.3 4Includes everything else in ``zipfile`` to match future usage. Just5use:6 7>>> from zipp.compat.overlay import zipfile8 9in place of ``import zipfile``.10 11Relative imports are supported too.12 13>>> from zipp.compat.overlay.zipfile import ZipInfo14 15The ``zipfile`` object added to ``sys.modules`` needs to be16hashable (#126).17 18>>> _ = hash(sys.modules['zipp.compat.overlay.zipfile'])19"""20 21import importlib22import sys23import types24 25import zipp26 27 28class HashableNamespace(types.SimpleNamespace):29    def __hash__(self):30        return hash(tuple(vars(self)))31 32 33zipfile = HashableNamespace(**vars(importlib.import_module('zipfile')))34zipfile.Path = zipp.Path35zipfile._path = zipp36 37sys.modules[__name__ + '.zipfile'] = zipfile  # type: ignore[assignment]38 
codekingpro/portable-devtools · Team Ai