(self, file, align=True, bigendian=True, inclheader=False)
| 105 | |
| 106 | class _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.""" |
nothing calls this directly
no test coverage detected