MCPcopy Index your code
hub / github.com/python-openxml/python-docx / PhysPkgReader

Class PhysPkgReader

src/docx/opc/phys_pkg.py:10–25  ·  view source on GitHub ↗

Factory for physical package reader objects.

Source from the content-addressed store, hash-verified

8
9
10class PhysPkgReader:
11 """Factory for physical package reader objects."""
12
13 def __new__(cls, pkg_file):
14 # if `pkg_file` is a string, treat it as a path
15 if isinstance(pkg_file, str):
16 if os.path.isdir(pkg_file):
17 reader_cls = _DirPkgReader
18 elif is_zipfile(pkg_file):
19 reader_cls = _ZipPkgReader
20 else:
21 raise PackageNotFoundError("Package not found at '%s'" % pkg_file)
22 else: # assume it's a stream and pass it to Zip reader to sort out
23 reader_cls = _ZipPkgReader
24
25 return super(PhysPkgReader, cls).__new__(reader_cls)
26
27
28class PhysPkgWriter:

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…