MCPcopy Create free account
hub / github.com/ipython/ipython / __init__

Method __init__

IPython/lib/display.py:97–115  ·  view source on GitHub ↗
(self, data=None, filename=None, url=None, embed=None, rate=None, autoplay=False, normalize=True, *,
                 element_id=None)

Source from the content-addressed store, hash-verified

95 _read_flags = 'rb'
96
97 def __init__(self, data=None, filename=None, url=None, embed=None, rate=None, autoplay=False, normalize=True, *,
98 element_id=None):
99 if filename is None and url is None and data is None:
100 raise ValueError("No audio data found. Expecting filename, url, or data.")
101 if embed is False and url is None:
102 raise ValueError("No url found. Expecting url when embed=False")
103
104 if url is not None and embed is not True:
105 self.embed = False
106 else:
107 self.embed = True
108 self.autoplay = autoplay
109 self.element_id = element_id
110 super(Audio, self).__init__(data=data, url=url, filename=filename)
111
112 if self.data is not None and not isinstance(self.data, bytes):
113 if rate is None:
114 raise ValueError("rate must be specified when data is a numpy array or list of audio samples.")
115 self.data = Audio._make_wav(data, rate, normalize)
116
117 def reload(self):
118 """Reload the raw data from file or URL."""

Callers

nothing calls this directly

Calls 2

_make_wavMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected