WellformednessManager

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.WellformednessManager.WellformednessManager" [URL="../api/abjad/system/WellformednessManager.html#abjad.system.WellformednessManager.WellformednessManager", color=black, fontcolor=white, label="Wellformedness\nManager", target=_top]; "abjad.system.AbjadObject.AbjadObject" -> "abjad.system.WellformednessManager.WellformednessManager"; } 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.WellformednessManager.WellformednessManager(allow_percussion_clef=None)

Wellformedness manager.

>>> abjad.WellformednessManager()
WellformednessManager()

Attributes Summary

__call__ Calls all wellformedness checks on argument.
allow_percussion_clef Is true when manager allows percussion clef.
check_discontiguous_spanners Checks discontiguous spanners.
check_duplicate_ids Checks duplicate IDs.
check_empty_containers Checks empty containers.
check_misdurated_measures Checks misdurated measures.
check_misfilled_measures Checks misfilled measures.
check_mismatched_enchained_hairpins Checks mismatched enchained hairpins.
check_mispitched_ties Checks mispitched notes.
check_misrepresented_flags Checks misrepresented flags.
check_missing_parents Checks missing parents.
check_nested_measures Checks nested measures.
check_notes_on_wrong_clef Checks notes and chords on wrong clef.
check_out_of_range_notes Checks out-of-range notes.
check_overlapping_beams Checks overlapping beams.
check_overlapping_glissandi Checks overlapping glissandi.
check_overlapping_hairpins Checks overlapping hairpins.
check_overlapping_octavation_spanners Checks overlapping octavation spanners.
check_overlapping_ties Checks overlapping ties.
check_overlapping_trill_spanners Checks overlapping trill spanners.
check_tied_rests Checks tied rests.

Special methods

__call__(argument=None)

Calls all wellformedness checks on argument.

Returns triples.

(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.


Methods

check_discontiguous_spanners(argument=None)

Checks discontiguous spanners.

There are now two different types of spanner. Most spanners demand that spanner components be logical-voice-contiguous. But a few special spanners (like MetronomeMark) do not make such a demand. The check here consults the experimental _contiguity_constraint.

Returns list of discontiguous spanners and nonnegative integer count of all spanners in argument.

check_duplicate_ids(argument=None)

Checks duplicate IDs.

Returns violators and total.

check_empty_containers(argument=None)

Checks empty containers.

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> staff.append(abjad.Container())
>>> abjad.f(staff)
\new Staff
{
    c'4
    d'4
    e'4
    f'4
    {
    }
}
>>> manager = abjad.WellformednessManager()
>>> violators, total = manager.check_empty_containers(staff)
>>> violators
[Container()]

Returns list of empty containers and count of all containers in argument.

check_misdurated_measures(argument=None)

Checks misdurated measures.

Returns violators and total.

check_misfilled_measures(argument=None)

Checks misfilled measures.

Returns violators and total.

check_mismatched_enchained_hairpins(argument=None)

Checks mismatched enchained hairpins.

Checks mismatched enchained hairpins:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> abjad.attach(abjad.Hairpin('p < f'), staff[:2])
>>> abjad.attach(abjad.Hairpin('p > pp'), staff[1:])
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_wellformedness())
0 /	2 discontiguous spanners
0 /	5 duplicate ids
0 /	1 empty containers
0 /	0 misdurated measures
0 /	0 misfilled measures
2 /	2 mismatched enchained hairpins
0 /	0 mispitched ties
0 /	4 misrepresented flags
0 /	5 missing parents
0 /	0 nested measures
0 /	4 notes on wrong clef
0 /	4 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	2 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	0 overlapping ties
0 /	0 overlapping trill spanners
0 /	0 tied rests

Enchained hairpins are fine so long as hairpin ends match.

Returns violators and total.

check_mispitched_ties(argument=None)

Checks mispitched notes.

Checks for mispitched ties attached to notes:

>>> staff = abjad.Staff("c'4 ~ c'")
>>> staff[1].written_pitch = abjad.NamedPitch("d'")
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_wellformedness())
0 /	1 discontiguous spanners
0 /	3 duplicate ids
0 /	1 empty containers
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	0 mismatched enchained hairpins
1 /	1 mispitched ties
0 /	2 misrepresented flags
0 /	3 missing parents
0 /	0 nested measures
0 /	2 notes on wrong clef
0 /	2 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	0 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	1 overlapping ties
0 /	0 overlapping trill spanners
0 /	0 tied rests

Checks for mispitched ties attached to chords:

>>> staff = abjad.Staff("<c' d' bf'>4 ~ <c' d' bf'>")
>>> staff[1].written_pitches = [6, 9]
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_wellformedness())
0 /	1 discontiguous spanners
0 /	3 duplicate ids
0 /	1 empty containers
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	0 mismatched enchained hairpins
1 /	1 mispitched ties
0 /	2 misrepresented flags
0 /	3 missing parents
0 /	0 nested measures
0 /	2 notes on wrong clef
0 /	2 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	0 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	1 overlapping ties
0 /	0 overlapping trill spanners
0 /	0 tied rests

Returns violator ties together with total number of ties.

check_misrepresented_flags(argument=None)

Checks misrepresented flags.

Returns violators and total.

check_missing_parents(argument=None)

Checks missing parents.

Returns violators and total.

check_nested_measures(argument=None)

Checks nested measures.

Returns violators and total.

check_notes_on_wrong_clef(argument=None)

Checks notes and chords on wrong clef.

>>> staff = abjad.Staff("c'8 d'8 e'8 f'8")
>>> clef = abjad.Clef('alto')
>>> abjad.attach(clef, staff[0])
>>> violin = abjad.Violin()
>>> abjad.attach(violin, staff[0])
>>> abjad.show(staff) 
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_wellformedness())
0 /	0 discontiguous spanners
0 /	5 duplicate ids
0 /	1 empty containers
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	0 mismatched enchained hairpins
0 /	0 mispitched ties
0 /	4 misrepresented flags
0 /	5 missing parents
0 /	0 nested measures
4 /	4 notes on wrong clef
0 /	4 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	0 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	0 overlapping ties
0 /	0 overlapping trill spanners
0 /	0 tied rests

Allows percussion clef:

>>> staff = abjad.Staff("c'8 d'8 e'8 f'8")
>>> clef = abjad.Clef('percussion')
>>> abjad.attach(clef, staff[0])
>>> violin = abjad.Violin()
>>> abjad.attach(violin, staff[0])
>>> abjad.show(staff) 
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_wellformedness(
...     allow_percussion_clef=True,
...     ))
0 /	0 discontiguous spanners
0 /	5 duplicate ids
0 /	1 empty containers
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	0 mismatched enchained hairpins
0 /	0 mispitched ties
0 /	4 misrepresented flags
0 /	5 missing parents
0 /	0 nested measures
0 /	4 notes on wrong clef
0 /	4 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	0 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	0 overlapping ties
0 /	0 overlapping trill spanners
0 /	0 tied rests

Forbids percussion clef:

>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_wellformedness(
...     allow_percussion_clef=False,
...     ))
0 /	0 discontiguous spanners
0 /	5 duplicate ids
0 /	1 empty containers
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	0 mismatched enchained hairpins
0 /	0 mispitched ties
0 /	4 misrepresented flags
0 /	5 missing parents
0 /	0 nested measures
4 /	4 notes on wrong clef
0 /	4 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	0 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	0 overlapping ties
0 /	0 overlapping trill spanners
0 /	0 tied rests

Returns true or false.

check_out_of_range_notes(argument=None)

Checks out-of-range notes.

Out of range:

>>> staff = abjad.Staff("c'8 r8 <d fs>8 r8")
>>> violin = abjad.Violin()
>>> abjad.attach(violin, staff[0])
>>> abjad.show(staff) 
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_wellformedness())
0 /	0 discontiguous spanners
0 /	5 duplicate ids
0 /	1 empty containers
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	0 mismatched enchained hairpins
0 /	0 mispitched ties
0 /	4 misrepresented flags
0 /	5 missing parents
0 /	0 nested measures
0 /	4 notes on wrong clef
1 /	2 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	0 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	0 overlapping ties
0 /	0 overlapping trill spanners
0 /	2 tied rests

Returns true or false.

check_overlapping_beams(argument=None)

Checks overlapping beams.

Overlapping beams are well-formed:

>>> staff = abjad.Staff("c'8 d' e' f'")
>>> abjad.attach(abjad.Beam(), staff[:3])
>>> abjad.attach(abjad.Beam(), staff[2:])
>>> abjad.f(staff)
\new Staff
{
    c'8
    [
    d'8
    e'8
    ]
    [
    f'8
    ]
}
>>> manager = abjad.WellformednessManager()
>>> violators, total = manager.check_overlapping_beams(staff)
>>> for beam in sorted(violators):
...     beam
... 
Beam("c'8, d'8, e'8", durations=(), span_beam_count=1)
Beam("e'8, f'8", durations=(), span_beam_count=1)

(Enchained beams are not well-formed either.)

Returns list of overlapping beams and nonnegative integer count of total beams in score.

check_overlapping_glissandi(argument=None)

Checks overlapping glissandi.

Returns violators and total.

check_overlapping_hairpins(argument=None)

Checks overlapping hairpins.

Checks overlapping hairpins:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> abjad.attach(abjad.Hairpin('<'), staff[:])
>>> abjad.attach(abjad.Hairpin('>'), staff[:])
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_wellformedness())
0 /	2 discontiguous spanners
0 /	5 duplicate ids
0 /	1 empty containers
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	2 mismatched enchained hairpins
0 /	0 mispitched ties
0 /	4 misrepresented flags
0 /	5 missing parents
0 /	0 nested measures
0 /	4 notes on wrong clef
0 /	4 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
2 /	2 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	0 overlapping ties
0 /	0 overlapping trill spanners
0 /	0 tied rests

Enchained hairpins are fine so long as hairpin ends match.

Returns violators and total.

check_overlapping_octavation_spanners(argument=None)

Checks overlapping octavation spanners.

Returns violators and total.

check_overlapping_ties(argument=None)

Checks overlapping ties.

Checks overlapping ties:

>>> staff = abjad.Staff("c'4 c' c' c''")
>>> abjad.attach(abjad.Tie(), staff[:2])
>>> tie = abjad.Tie()
>>> tie._ignore_attachment_test = True
>>> tie._ignore_before_attach = True
>>> abjad.attach(tie, staff[1:3])
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_wellformedness())
0 /	2 discontiguous spanners
0 /	5 duplicate ids
0 /	1 empty containers
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	0 mismatched enchained hairpins
0 /	2 mispitched ties
0 /	4 misrepresented flags
0 /	5 missing parents
0 /	0 nested measures
0 /	4 notes on wrong clef
0 /	4 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	0 overlapping hairpins
0 /	0 overlapping octavation spanners
2 /	2 overlapping ties
0 /	0 overlapping trill spanners
0 /	0 tied rests

Returns violators and count of total ties.

check_overlapping_trill_spanners(argument=None)

Checks overlapping trill spanners.

Enchained trill spanners are ok:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> abjad.attach(abjad.TrillSpanner(), staff[:3])
>>> abjad.attach(abjad.TrillSpanner(), staff[2:])
>>> abjad.show(staff) 
>>> abjad.inspect(staff).is_well_formed()
True

Overlapping trill spanners are not well-formed:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> abjad.attach(abjad.TrillSpanner(), staff[:])
>>> abjad.attach(abjad.TrillSpanner(), staff[:])
>>> abjad.show(staff) 
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_wellformedness())
0 /	2 discontiguous spanners
0 /	5 duplicate ids
0 /	1 empty containers
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	0 mismatched enchained hairpins
0 /	0 mispitched ties
0 /	4 misrepresented flags
0 /	5 missing parents
0 /	0 nested measures
0 /	4 notes on wrong clef
0 /	4 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	0 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	0 overlapping ties
2 /	2 overlapping trill spanners
0 /	0 tied rests

Enchained hairpins are fine so long as hairpin ends match.

Returns violators and total.

check_tied_rests(argument=None)

Checks tied rests.

Returns violators and total.


Read-only properties

allow_percussion_clef

Is true when manager allows percussion clef.

Returns true, false or none.