ForbidUpdate

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph "cluster_abjad.system" { graph [label="abjad.system"]; node [color=1]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjad/system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; "abjad.system.ContextManager.ContextManager" [URL="../api/abjad/system/ContextManager.html#abjad.system.ContextManager.ContextManager", label="Context\nManager", shape=oval, style=bold, target=_top]; "abjad.system.ForbidUpdate.ForbidUpdate" [URL="../api/abjad/system/ForbidUpdate.html#abjad.system.ForbidUpdate.ForbidUpdate", color=black, fontcolor=white, label="Forbid\nUpdate", target=_top]; "abjad.system.AbjadObject.AbjadObject" -> "abjad.system.ContextManager.ContextManager"; "abjad.system.ContextManager.ContextManager" -> "abjad.system.ForbidUpdate.ForbidUpdate"; } subgraph cluster_builtins { graph [label=builtins]; node [color=2]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

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

A context manager for forbidding score updates.

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

Attributes Summary

__enter__ Enters context manager.
__exit__ Exits context manager.
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.

Special methods

__enter__()

Enters context manager.

Returns context manager.

__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).__repr__()

Gets interpreter representation of Abjad object.

Returns string.


Read-only properties

component

Gets component.

Set to component or none.

Returns component or none.

update_on_enter

Is true when context manager should update offsets on enter.

Set to true, false or none.

Returns true, false or none.

update_on_exit

Is true when context manager should update offsets on exit.

Set to true, false or none.

Returns true, false or none.