MCPcopy Index your code
hub / github.com/python/cpython / ZipInfo

Class ZipInfo

Lib/zipfile/__init__.py:423–689  ·  view source on GitHub ↗

Class with attributes describing each file in the ZIP archive.

Source from the content-addressed store, hash-verified

421
422
423class ZipInfo:
424 """Class with attributes describing each file in the ZIP archive."""
425
426 __slots__ = (
427 'orig_filename',
428 'filename',
429 'date_time',
430 'compress_type',
431 'compress_level',
432 'comment',
433 'extra',
434 'create_system',
435 'create_version',
436 'extract_version',
437 'reserved',
438 'flag_bits',
439 'volume',
440 'internal_attr',
441 'external_attr',
442 'header_offset',
443 'CRC',
444 'compress_size',
445 'file_size',
446 '_raw_time',
447 '_end_offset',
448 )
449
450 def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)):
451 self.orig_filename = filename # Original file name in archive
452
453 # Terminate the file name at the first null byte and
454 # ensure paths always use forward slashes as the directory separator.
455 filename = _sanitize_filename(filename)
456
457 self.filename = filename # Normalized file name
458 self.date_time = date_time # year, month, day, hour, min, sec
459
460 if date_time[0] < 1980:
461 raise ValueError('ZIP does not support timestamps before 1980')
462
463 # Standard values:
464 self.compress_type = ZIP_STORED # Type of compression for the file
465 self.compress_level = None # Level for the compressor
466 self.comment = b"" # Comment for each file
467 self.extra = b"" # ZIP extra data
468 if sys.platform == 'win32':
469 self.create_system = 0 # System which created ZIP archive
470 else:
471 # Assume everything else is unix-y
472 self.create_system = 3 # System which created ZIP archive
473 self.create_version = DEFAULT_VERSION # Version which created ZIP archive
474 self.extract_version = DEFAULT_VERSION # Version needed to extract archive
475 self.reserved = 0 # Must be zero
476 self.flag_bits = 0 # ZIP flag bits
477 self.volume = 0 # Volume number of file header
478 self.internal_attr = 0 # Internal attributes
479 self.external_attr = 0 # External file attributes
480 self.compress_size = 0 # Size of the compressed file

Callers 6

writeZipMethod · 0.90
testZip64LargeFileMethod · 0.90
_RealGetContentsMethod · 0.85
openMethod · 0.85
writestrMethod · 0.85
mkdirMethod · 0.85

Calls

no outgoing calls

Tested by 2

writeZipMethod · 0.72
testZip64LargeFileMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…