MCPcopy Index your code
hub / github.com/ipython/ipython / __init__

Method __init__

IPython/lib/display.py:113–131  ·  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

111 _read_flags = 'rb'
112
113 def __init__(self, data=None, filename=None, url=None, embed=None, rate=None, autoplay=False, normalize=True, *,
114 element_id=None):
115 if filename is None and url is None and data is None:
116 raise ValueError("No audio data found. Expecting filename, url, or data.")
117 if embed is False and url is None:
118 raise ValueError("No url found. Expecting url when embed=False")
119
120 if url is not None and embed is not True:
121 self.embed = False
122 else:
123 self.embed = True
124 self.autoplay = autoplay
125 self.element_id = element_id
126 super(Audio, self).__init__(data=data, url=url, filename=filename)
127
128 if self.data is not None and not isinstance(self.data, bytes):
129 if rate is None:
130 raise ValueError("rate must be specified when data is a numpy array or list of audio samples.")
131 self.data = Audio._make_wav(data, rate, normalize)
132
133 def reload(self):
134 """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