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

Method _patchheader

Lib/wave.py:673–688  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

671 self._headerwritten = True
672
673 def _patchheader(self):
674 assert self._headerwritten
675 if self._datawritten == self._datalength:
676 return
677 curpos = self._file.tell()
678 header_overhead = 36 + (12 if self._needs_fact_chunk() else 0)
679 self._file.seek(self._form_length_pos, 0)
680 self._file.write(struct.pack('<L', header_overhead + self._datawritten))
681 if self._fact_sample_count_pos is not None:
682 self._file.seek(self._fact_sample_count_pos, 0)
683 nframes = self._datawritten // (self._nchannels * self._sampwidth)
684 self._file.write(struct.pack('<L', nframes))
685 self._file.seek(self._data_length_pos, 0)
686 self._file.write(struct.pack('<L', self._datawritten))
687 self._file.seek(curpos, 0)
688 self._datalength = self._datawritten
689
690
691def open(f, mode=None):

Callers 2

writeframesMethod · 0.95
closeMethod · 0.95

Calls 5

_needs_fact_chunkMethod · 0.95
tellMethod · 0.45
seekMethod · 0.45
writeMethod · 0.45
packMethod · 0.45

Tested by

no test coverage detected