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

Method __setitem__

mingus/containers/bar.py:229–246  ·  view source on GitHub ↗

Enable the use of [] = notation on Bars. The value should be a NoteContainer, or a string/list/Note understood by the NoteContainer.

(self, index, value)

Source from the content-addressed store, hash-verified

227 return self.bar[index]
228
229 def __setitem__(self, index, value):
230 """Enable the use of [] = notation on Bars.
231
232 The value should be a NoteContainer, or a string/list/Note
233 understood by the NoteContainer.
234 """
235 if hasattr(value, "notes"):
236 pass
237 elif hasattr(value, "name"):
238 value = NoteContainer(value)
239 elif isinstance(value, six.string_types):
240 value = NoteContainer(value)
241 elif isinstance(value, list):
242 res = NoteContainer()
243 for x in value:
244 res + x
245 value = res
246 self.bar[index][2] = value
247
248 def __repr__(self):
249 """Enable str() and repr() for Bars."""

Callers

nothing calls this directly

Calls 1

NoteContainerClass · 0.90

Tested by

no test coverage detected