MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / __init__

Method __init__

tools/python-3.11.9-amd64/Lib/wave.py:104–127  ·  view source on GitHub ↗
(self, file, align=True, bigendian=True, inclheader=False)

Source from the content-addressed store, hash-verified

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