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

Method __init__

Lib/wave.py:118–141  ·  view source on GitHub ↗
(self, file, align=True, bigendian=True, inclheader=False)

Source from the content-addressed store, hash-verified

116
117class _Chunk:
118 def __init__(self, file, align=True, bigendian=True, inclheader=False):
119 self.closed = False
120 self.align = align # whether to align to word (2-byte) boundaries
121 if bigendian:
122 strflag = '>'
123 else:
124 strflag = '<'
125 self.file = file
126 self.chunkname = file.read(4)
127 if len(self.chunkname) < 4:
128 raise EOFError
129 try:
130 self.chunksize = struct.unpack_from(strflag+'L', file.read(4))[0]
131 except struct.error:
132 raise EOFError from None
133 if inclheader:
134 self.chunksize = self.chunksize - 8 # subtract header
135 self.size_read = 0
136 try:
137 self.offset = self.file.tell()
138 except (AttributeError, OSError):
139 self.seekable = False
140 else:
141 self.seekable = True
142
143 def getname(self):
144 """Return the name (ID) of the current chunk."""

Callers

nothing calls this directly

Calls 2

readMethod · 0.45
tellMethod · 0.45

Tested by

no test coverage detected