MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / is_zipfile

Function is_zipfile

tools/python-3.11.9-amd64/Lib/zipfile.py:226–240  ·  view source on GitHub ↗

Quickly see if a file is a ZIP file by checking the magic number. The filename argument may be a file or file-like object too.

(filename)

Source from the content-addressed store, hash-verified

224 return False
225
226def is_zipfile(filename):
227 """Quickly see if a file is a ZIP file by checking the magic number.
228
229 The filename argument may be a file or file-like object too.
230 """
231 result = False
232 try:
233 if hasattr(filename, "read"):
234 result = _check_zipfile(fp=filename)
235 else:
236 with open(filename, "rb") as fp:
237 result = _check_zipfile(fp)
238 except OSError:
239 pass
240 return result
241
242def _EndRecData64(fpin, offset, endrec):
243 """

Callers

nothing calls this directly

Calls 2

_check_zipfileFunction · 0.85
openFunction · 0.70

Tested by

no test coverage detected