Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/zipp/compat/overlay.py: 92%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""
2Expose zipp.Path as .zipfile.Path.
4Includes everything else in ``zipfile`` to match future usage. Just
5use:
7>>> from zipp.compat.overlay import zipfile
9in place of ``import zipfile``.
11Relative imports are supported too.
13>>> from zipp.compat.overlay.zipfile import ZipInfo
15The ``zipfile`` object added to ``sys.modules`` needs to be
16hashable (#126).
18>>> _ = hash(sys.modules['zipp.compat.overlay.zipfile'])
19"""
21import importlib
22import sys
23import types
25import zipp
28class HashableNamespace(types.SimpleNamespace):
29 def __hash__(self):
30 return hash(tuple(vars(self)))
33zipfile = HashableNamespace(**vars(importlib.import_module('zipfile')))
34zipfile.Path = zipp.Path
35zipfile._path = zipp
37sys.modules[__name__ + '.zipfile'] = zipfile # type: ignore[assignment]