MCPcopy Create free account
hub / github.com/bspaans/python-mingus / __setitem__

Method __setitem__

mingus/containers/track.py:208–219  ·  view source on GitHub ↗

Enable the '[] =' notation for Tracks. Throw an UnexpectedObjectError if the value being set is not a mingus.containers.Bar object.

(self, index, value)

Source from the content-addressed store, hash-verified

206 return self.bars[index]
207
208 def __setitem__(self, index, value):
209 """Enable the '[] =' notation for Tracks.
210
211 Throw an UnexpectedObjectError if the value being set is not a
212 mingus.containers.Bar object.
213 """
214 if not hasattr(value, "bar"):
215 raise UnexpectedObjectError(
216 "Unexpected object '%s', "
217 "expecting a mingus.containers.Barobject" % value
218 )
219 self.bars[index] = value
220
221 def __repr__(self):
222 """Return a string representing the class."""

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected