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

Method __init__

Lib/wave.py:294–305  ·  view source on GitHub ↗
(self, f)

Source from the content-addressed store, hash-verified

292 raise Error('fmt chunk and/or data chunk missing')
293
294 def __init__(self, f):
295 self._i_opened_the_file = None
296 if isinstance(f, (bytes, str, os.PathLike)):
297 f = builtins.open(f, 'rb')
298 self._i_opened_the_file = f
299 # else, assume it is an open file object already
300 try:
301 self.initfp(f)
302 except:
303 if self._i_opened_the_file:
304 f.close()
305 raise
306
307 def __del__(self):
308 self.close()

Callers

nothing calls this directly

Calls 3

initfpMethod · 0.95
openMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected