ForbidUpdate

class systemtools.ForbidUpdate(component=None, update_on_enter=True, update_on_exit=None)

A context manager for forbidding score updates.

>>> staff = Staff("c'8 d'8 ~ d'2 e'4")
>>> with systemtools.ForbidUpdate(component=staff):
...     for note in staff[:]:
...         pitch_1 = note.written_pitch
...         pitch_2 = pitch_1 + pitchtools.NamedInterval('M3')
...         pitches = [pitch_1, pitch_2]
...         chord = Chord(pitches, note.written_duration)
...         mutate(note).replace(chord)
...
>>> inspect_(staff).is_well_formed()
True
>>> show(staff) 

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.ContextManager.ContextManager" [color=1, group=0, label=ContextManager, shape=oval, style=bold]; "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.abctools.ContextManager.ContextManager"; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_systemtools { graph [label=systemtools]; "abjad.tools.systemtools.ForbidUpdate.ForbidUpdate" [color=black, fontcolor=white, group=2, label=<<B>ForbidUpdate</B>>, shape=box, style="filled, rounded"]; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.ContextManager.ContextManager" -> "abjad.tools.systemtools.ForbidUpdate.ForbidUpdate"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

component Gets component.
update_on_enter Is true when context manager should update offsets on enter.
update_on_exit Is true when context manager should update offsets on exit.
__enter__() Enters context manager.
__eq__(expr) Is true when ID of expr equals ID of Abjad object.
__exit__(exc_type, exc_value, traceback) Exits context manager.
__format__([format_specification]) Formats Abjad object.
__hash__() Hashes Abjad object.
__ne__(expr) Is true when Abjad object does not equal expr.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

ForbidUpdate.component

Gets component.

Set to component or none.

Returns component or none.

ForbidUpdate.update_on_enter

Is true when context manager should update offsets on enter.

Set to true, false or none.

Returns true, false or none.

ForbidUpdate.update_on_exit

Is true when context manager should update offsets on exit.

Set to true, false or none.

Returns true, false or none.

Special methods

ForbidUpdate.__enter__()

Enters context manager.

Returns context manager.

(AbjadObject).__eq__(expr)

Is true when ID of expr equals ID of Abjad object. Otherwise false.

Returns true or false.

ForbidUpdate.__exit__(exc_type, exc_value, traceback)

Exits context manager.

Returns none.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

(AbjadObject).__hash__()

Hashes Abjad object.

Required to be explicitly redefined on Python 3 if __eq__ changes.

Returns integer.

(AbjadObject).__ne__(expr)

Is true when Abjad object does not equal expr. Otherwise false.

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.