SelectorLibrary

class selectortools.SelectorLibrary

Selector library.

>>> import abjad

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_selectortools { graph [label=selectortools]; "abjad.tools.selectortools.SelectorLibrary.SelectorLibrary" [color=black, fontcolor=white, group=1, label=<<B>SelectorLibrary</B>>, shape=box, style="filled, rounded"]; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=1, group=0, label=object, shape=box]; } "builtins.object" -> "abjad.tools.selectortools.SelectorLibrary.SelectorLibrary"; }

Bases

  • builtins.object

Attribute summary

select_first_logical_tie_in_pitched_runs([…]) Selects first logical tie in pitched runs.
select_last_logical_tie_in_pitched_runs([…]) Selects last logical tie in pitched runs.
select_nonfirst_logical_ties_in_pitched_runs([…]) Selects nonfirst logical ties in pitched runs.
select_nonlast_logical_ties_in_pitched_runs([…]) Selects nonlast logical ties in pitched runs.
select_pitched_runs([argument]) Selects pitched runs.

Class & static methods

static SelectorLibrary.select_first_logical_tie_in_pitched_runs(argument=None)

Selects first logical tie in pitched runs.

>>> library = abjad.SelectorLibrary
>>> selector = library.select_first_logical_tie_in_pitched_runs()
>>> f(selector)
abjad.Selector(
    callbacks=(
        abjad.PrototypeSelectorCallback(
            prototype=abjad.Leaf,
            ),
        abjad.RunSelectorCallback(
            prototype=(
                abjad.Note,
                abjad.Chord,
                ),
            ),
        abjad.LogicalTieSelectorCallback(
            flatten=False,
            pitched=False,
            trivial=True,
            ),
        abjad.ItemSelectorCallback(
            item=0,
            apply_to_each=True,
            ),
        ),
    )
>>> string = r"c'4. d'8 ~ \times 2/3 { d'4 r4 e'4 ~ } e'8 f'4."
>>> staff = abjad.Staff(string)
>>> result = selector(staff)
>>> abjad.label(result).color_alternating()
>>> abjad.setting(staff).auto_beaming = False
>>> show(staff) 
>>> for item in result:
...     item
...
LogicalTie([Note("c'4.")])
LogicalTie([Note("e'4"), Note("e'8")])
static SelectorLibrary.select_last_logical_tie_in_pitched_runs(argument=None)

Selects last logical tie in pitched runs.

>>> library = abjad.SelectorLibrary
>>> selector = library.select_last_logical_tie_in_pitched_runs()
>>> f(selector)
abjad.Selector(
    callbacks=(
        abjad.PrototypeSelectorCallback(
            prototype=abjad.Leaf,
            ),
        abjad.RunSelectorCallback(
            prototype=(
                abjad.Note,
                abjad.Chord,
                ),
            ),
        abjad.LogicalTieSelectorCallback(
            flatten=False,
            pitched=False,
            trivial=True,
            ),
        abjad.ItemSelectorCallback(
            item=-1,
            apply_to_each=True,
            ),
        ),
    )
>>> string = r"c'4. d'8 ~ \times 2/3 { d'4 r4 e'4 ~ } e'8 f'4."
>>> staff = abjad.Staff(string)
>>> result = selector(staff)
>>> abjad.label(result).color_alternating()
>>> abjad.setting(staff).auto_beaming = False
>>> show(staff) 
>>> for item in result:
...     item
...
LogicalTie([Note("d'8"), Note("d'4")])
LogicalTie([Note("f'4.")])
static SelectorLibrary.select_nonfirst_logical_ties_in_pitched_runs(argument=None)

Selects nonfirst logical ties in pitched runs.

>>> library = abjad.SelectorLibrary
>>> selector = library.select_nonfirst_logical_ties_in_pitched_runs()
>>> f(selector)
abjad.Selector(
    callbacks=(
        abjad.PrototypeSelectorCallback(
            prototype=abjad.Leaf,
            ),
        abjad.RunSelectorCallback(
            prototype=(
                abjad.Note,
                abjad.Chord,
                ),
            ),
        abjad.LogicalTieSelectorCallback(
            flatten=False,
            pitched=False,
            trivial=True,
            ),
        abjad.SliceSelectorCallback(
            start=1,
            apply_to_each=True,
            ),
        abjad.FlattenSelectorCallback(
            depth=1,
            ),
        ),
    )
>>> staff = abjad.Staff(
...     r"c' d' ~ \times 2/3 { d' e' r } "
...     r"f' g' \times 2/3 { r a' b' ~ } b' c''"
...     )
>>> result = selector(staff)
>>> abjad.label(result).color_alternating()
>>> abjad.setting(staff).auto_beaming = False
>>> show(staff) 
>>> for item in result:
...     item
...
LogicalTie([Note("d'4"), Note("d'4")])
LogicalTie([Note("e'4")])
LogicalTie([Note("g'4")])
LogicalTie([Note("b'4"), Note("b'4")])
LogicalTie([Note("c''4")])
static SelectorLibrary.select_nonlast_logical_ties_in_pitched_runs(argument=None)

Selects nonlast logical ties in pitched runs.

>>> library = abjad.SelectorLibrary
>>> selector = library.select_nonlast_logical_ties_in_pitched_runs()
>>> f(selector)
abjad.Selector(
    callbacks=(
        abjad.PrototypeSelectorCallback(
            prototype=abjad.Leaf,
            ),
        abjad.RunSelectorCallback(
            prototype=(
                abjad.Note,
                abjad.Chord,
                ),
            ),
        abjad.LogicalTieSelectorCallback(
            flatten=False,
            pitched=False,
            trivial=True,
            ),
        abjad.SliceSelectorCallback(
            stop=-1,
            apply_to_each=True,
            ),
        abjad.FlattenSelectorCallback(
            depth=1,
            ),
        ),
    )
>>> staff = abjad.Staff(
...     r"c' d' ~ \times 2/3 { d' e' r } "
...     r"f' g' \times 2/3 { r a' b' ~ } b' c''"
...     )
>>> result = selector(staff)
>>> abjad.label(result).color_alternating()
>>> abjad.setting(staff).auto_beaming = False
>>> show(staff) 
>>> for x in selector(staff):
...     x
...
LogicalTie([Note("c'4")])
LogicalTie([Note("d'4"), Note("d'4")])
LogicalTie([Note("f'4")])
LogicalTie([Note("a'4")])
LogicalTie([Note("b'4"), Note("b'4")])
static SelectorLibrary.select_pitched_runs(argument=None)

Selects pitched runs.

>>> selector = abjad.SelectorLibrary.select_pitched_runs()
>>> f(selector)
abjad.Selector(
    callbacks=(
        abjad.PrototypeSelectorCallback(
            prototype=abjad.Leaf,
            ),
        abjad.RunSelectorCallback(
            prototype=(
                abjad.Note,
                abjad.Chord,
                ),
            ),
        ),
    )
>>> string = r"c'4. d'8 ~ \times 2/3 { d'4 r4 e'4 ~ } e'8 f'4."
>>> staff = abjad.Staff(string)
>>> result = selector(staff)
>>> abjad.label(result).color_alternating()
>>> abjad.setting(staff).auto_beaming = False
>>> show(staff) 
>>> for item in result:
...     item
...
Selection([Note("c'4."), Note("d'8"), Note("d'4")])
Selection([Note("e'4"), Note("e'8"), Note("f'4.")])