MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / read_zip

Function read_zip

data/scripts/opencc_resources_zip_diff.py:25–40  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

23
24
25def read_zip(path):
26 entries = {}
27 with zipfile.ZipFile(path) as archive:
28 for info in archive.infolist():
29 if info.is_dir():
30 continue
31 if info.compress_type != zipfile.ZIP_STORED:
32 raise ValueError(
33 f"{path}: {info.filename} uses unsupported compression "
34 f"method {info.compress_type}; expected ZIP_STORED"
35 )
36 entries[info.filename] = {
37 "data": archive.read(info.filename),
38 "size": info.file_size,
39 }
40 return entries
41
42
43def decode_text(name, data):

Callers 1

mainFunction · 0.85

Calls 1

readMethod · 0.45

Tested by

no test coverage detected