MCPcopy Index your code
hub / github.com/RustPython/RustPython / __init__

Method __init__

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

Source from the content-addressed store, hash-verified

105
106class _Chunk:
107 def __init__(self, file, align=True, bigendian=True, inclheader=False):
108 self.closed = False
109 self.align = align # whether to align to word (2-byte) boundaries
110 if bigendian:
111 strflag = '>'
112 else:
113 strflag = '<'
114 self.file = file
115 self.chunkname = file.read(4)
116 if len(self.chunkname) < 4:
117 raise EOFError
118 try:
119 self.chunksize = struct.unpack_from(strflag+'L', file.read(4))[0]
120 except struct.error:
121 raise EOFError from None
122 if inclheader:
123 self.chunksize = self.chunksize - 8 # subtract header
124 self.size_read = 0
125 try:
126 self.offset = self.file.tell()
127 except (AttributeError, OSError):
128 self.seekable = False
129 else:
130 self.seekable = True
131
132 def getname(self):
133 """Return the name (ID) of the current chunk."""

Callers

nothing calls this directly

Calls 4

lenFunction · 0.85
unpack_fromMethod · 0.80
readMethod · 0.45
tellMethod · 0.45

Tested by

no test coverage detected