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

Method __init__

Lib/zipfile/__init__.py:450–485  ·  view source on GitHub ↗
(self, filename="NoName", date_time=(1980,1,1,0,0,0))

Source from the content-addressed store, hash-verified

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
481 self.file_size = 0 # Size of the uncompressed file
482 self._end_offset = None # Start of the next local header or central directory
483 # Other attributes are set by class ZipFile:
484 # header_offset Byte offset to the file header
485 # CRC CRC-32 of the uncompressed file
486
487 # Maintain backward compatibility with the old protected attribute name.
488 @property

Callers

nothing calls this directly

Calls 1

_sanitize_filenameFunction · 0.85

Tested by

no test coverage detected