Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
ZipInfo Class Reference

Public Member Functions

def __init__
 
def FileHeader
 

Data Fields

 filename
 
 date_time
 
 compress_type
 
 comment
 
 extra
 
 create_system
 
 create_version
 
 extract_version
 
 reserved
 
 flag_bits
 
 volume
 
 internal_attr
 
 external_attr
 

Detailed Description

Class with attributes describing each file in the ZIP archive.

Definition at line 91 of file zipfile.py.

Constructor & Destructor Documentation

def __init__ (   self,
  filename = "NoName",
  date_time = (1980,1 
)

Definition at line 94 of file zipfile.py.

94 
95  def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)):
96  self.filename = _normpath(filename) # Name of the file in the archive
97  self.date_time = date_time # year, month, day, hour, min, sec
98  # Standard values:
99  self.compress_type = ZIP_STORED # Type of compression for the file
100  self.comment = "" # Comment for each file
101  self.extra = "" # ZIP extra data
102  self.create_system = 0 # System which created ZIP archive
103  self.create_version = 20 # Version which created ZIP archive
104  self.extract_version = 20 # Version needed to extract archive
105  self.reserved = 0 # Must be zero
106  self.flag_bits = 0 # ZIP flag bits
107  self.volume = 0 # Volume number of file header
108  self.internal_attr = 0 # Internal attributes
109  self.external_attr = 0 # External file attributes
110  # Other attributes are set by class ZipFile:
111  # header_offset Byte offset to the file header
112  # file_offset Byte offset to the start of the file data
113  # CRC CRC-32 of the uncompressed file
114  # compress_size Size of the compressed file
115  # file_size Size of the uncompressed file

Member Function Documentation

def FileHeader (   self)
Return the per-file header as a string.

Definition at line 116 of file zipfile.py.

References ZipInfo.compress_type, ZipInfo.date_time, ZipInfo.extra, ZipInfo.extract_version, NetrcParseError.filename, GzipFile.filename, ZipInfo.filename, ParsingError.filename, MissingSectionHeaderError.filename, HTTPError.filename, ErrorDuringImport.filename, InteractiveConsole.filename, MiniFieldStorage.filename, FieldStorage.filename, ZipInfo.flag_bits, and ZipInfo.reserved.

117  def FileHeader(self):
118  """Return the per-file header as a string."""
119  dt = self.date_time
120  dosdate = (dt[0] - 1980) << 9 | dt[1] << 5 | dt[2]
121  dostime = dt[3] << 11 | dt[4] << 5 | (dt[5] // 2)
122  if self.flag_bits & 0x08:
123  # Set these to zero because we write them after the file data
124  CRC = compress_size = file_size = 0
125  else:
126  CRC = self.CRC
127  compress_size = self.compress_size
128  file_size = self.file_size
129  header = struct.pack(structFileHeader, stringFileHeader,
130  self.extract_version, self.reserved, self.flag_bits,
131  self.compress_type, dostime, dosdate, CRC,
132  compress_size, file_size,
133  len(self.filename), len(self.extra))
134  return header + self.filename + self.extra
135 
136 
137 # This is used to ensure paths in generated ZIP files always use
138 # forward slashes as the directory separator, as required by the
# ZIP format specification.

Field Documentation

comment

Definition at line 99 of file zipfile.py.

compress_type

Definition at line 98 of file zipfile.py.

create_system

Definition at line 101 of file zipfile.py.

create_version

Definition at line 102 of file zipfile.py.

date_time

Definition at line 96 of file zipfile.py.

external_attr

Definition at line 108 of file zipfile.py.

extra

Definition at line 100 of file zipfile.py.

extract_version

Definition at line 103 of file zipfile.py.

filename

Definition at line 95 of file zipfile.py.

flag_bits

Definition at line 105 of file zipfile.py.

internal_attr

Definition at line 107 of file zipfile.py.

reserved

Definition at line 104 of file zipfile.py.

volume

Definition at line 106 of file zipfile.py.


The documentation for this class was generated from the following file: