Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed plural Selector.by_leaves() to singular Selector.by_leaf(). #714

Merged
merged 1 commit into from
Jul 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion abjad/demos/bartok/make_bartok_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def make_bartok_score():
dynamic = Dynamic('mp')
attach(dynamic, lower_measures[1][3])
score.add_final_bar_line()
selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
upper_leaves = selector(upper_staff)
lower_leaves = selector(lower_staff)
beam = Beam()
Expand Down
2 changes: 1 addition & 1 deletion abjad/demos/ferneyhough/make_nested_tuplet.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def make_nested_tuplet(
outer_tuplet = scoretools.Tuplet.from_duration_and_ratio(
tuplet_duration, outer_tuplet_proportions)
inner_tuplet_proportions = inner_tuplet_subdivision_count * [1]
selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
last_leaf = selector(outer_tuplet)[-1]
right_logical_tie = inspect_(last_leaf).get_logical_tie()
right_logical_tie.to_tuplet(inner_tuplet_proportions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ Preparing for deployment

.. abjad::

selector = selectortools.Selector().by_leaves().by_run(Note)[:-1].flatten()
selector = selectortools.Selector().by_leaf().by_run(Note)[:-1].flatten()

.. abjad::

Expand All @@ -403,7 +403,7 @@ Preparing for deployment

.. abjad::

selector = selector.by_leaves()
selector = selector.by_leaf()
for x in selector(staff):
x

Expand Down Expand Up @@ -530,7 +530,7 @@ via rotation:
for i, logical_tie in enumerate(iterate(staff).by_logical_tie(pitched=True)):
for note in logical_tie:
note.written_pitch = pitches[i]
selector = selectortools.Selector().by_leaves().by_run(Note)[:-1].flatten()
selector = selectortools.Selector().by_leaf().by_run(Note)[:-1].flatten()
for i, leaf in enumerate(selector(staff)):
attach(annotations[i], leaf)
attach(OscillationSpanner(), staff)
Expand Down
4 changes: 2 additions & 2 deletions abjad/tools/agenttools/IterationAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ def by_logical_voice(

::

>>> selector = select().by_leaves(flatten=True)
>>> selector = select().by_leaf(flatten=True)
>>> leaves = selector(staff)
>>> leaf = leaves[0]
>>> signature = inspect_(leaf).get_parentage().logical_voice
Expand Down Expand Up @@ -882,7 +882,7 @@ def by_logical_voice_from_component(

::

>>> selector = select().by_leaves(flatten=True)
>>> selector = select().by_leaf(flatten=True)
>>> leaves = selector(staff)
>>> leaf = leaves[0]
>>> for x in iterate(leaf).by_logical_voice_from_component(Note):
Expand Down
10 changes: 5 additions & 5 deletions abjad/tools/agenttools/MutationAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def extract(self, scale_contents=False):
>>> staff.append(Tuplet((3, 2), "c'4 e'4"))
>>> staff.append(Tuplet((3, 2), "d'4 f'4"))
>>> hairpin = spannertools.Hairpin('p < f')
>>> selector = select().by_leaves(flatten=True)
>>> selector = select().by_leaf(flatten=True)
>>> leaves = selector(staff)
>>> attach(hairpin, leaves)
>>> show(staff) # doctest: +SKIP
Expand Down Expand Up @@ -202,7 +202,7 @@ def extract(self, scale_contents=False):
>>> staff.append(Tuplet((3, 2), "c'4 e'4"))
>>> staff.append(Tuplet((3, 2), "d'4 f'4"))
>>> hairpin = spannertools.Hairpin('p < f')
>>> selector = select().by_leaves(flatten=True)
>>> selector = select().by_leaf(flatten=True)
>>> leaves = selector(staff)
>>> attach(hairpin, leaves)
>>> show(staff) # doctest: +SKIP
Expand Down Expand Up @@ -418,7 +418,7 @@ def replace(self, recipients):
>>> tuplet_2 = Tuplet((2, 3), "d'4 e'4 f'4")
>>> staff = Staff([tuplet_1, tuplet_2])
>>> hairpin = spannertools.Hairpin('p < f')
>>> selector = select().by_leaves(flatten=True)
>>> selector = select().by_leaf(flatten=True)
>>> leaves = selector(staff)
>>> attach(hairpin, leaves)
>>> slur = spannertools.Slur()
Expand Down Expand Up @@ -2441,7 +2441,7 @@ def split(
>>> staff = Staff()
>>> staff.append(Tuplet((2, 3), "c'4 d' e'"))
>>> staff.append(Tuplet((2, 3), "c'4 d' e'"))
>>> selector = select().by_leaves(flatten=True)
>>> selector = select().by_leaf(flatten=True)
>>> leaves = selector(staff)
>>> slur = spannertools.Slur()
>>> attach(slur, leaves)
Expand Down Expand Up @@ -2712,7 +2712,7 @@ def swap(self, container):
>>> staff = Staff()
>>> staff.append(Measure((3, 4), "c'4 d'4 e'4"))
>>> staff.append(Measure((3, 4), "d'4 e'4 f'4"))
>>> selector = select().by_leaves(flatten=True)
>>> selector = select().by_leaf(flatten=True)
>>> leaves = selector(staff)
>>> hairpin = spannertools.Hairpin('p < f')
>>> attach(hairpin, leaves)
Expand Down
2 changes: 1 addition & 1 deletion abjad/tools/metertools/MetricAccentKernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def count_offsets_in_expr(expr):
::

>>> MetricAccentKernel = metertools.MetricAccentKernel
>>> selector = select().by_leaves(flatten=True)
>>> selector = select().by_leaf(flatten=True)
>>> leaves = selector(score)
>>> counter = MetricAccentKernel.count_offsets_in_expr(leaves)
>>> for offset, count in sorted(counter.items()):
Expand Down
2 changes: 1 addition & 1 deletion abjad/tools/rhythmmakertools/GalleryMaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _add_class_name_header(self, rhythm_maker, score_block):
@staticmethod
def _add_final_bar_line(score):
score.add_final_bar_line()
selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(score)
leaves = leaves[-1:]
last_leaf = leaves[0]
Expand Down
2 changes: 1 addition & 1 deletion abjad/tools/scoretools/Container.py
Original file line number Diff line number Diff line change
Expand Up @@ -1644,7 +1644,7 @@ def reverse(self):
#
# ::
#
# >>> selector = select().by_leaves(flatten=True)
# >>> selector = select().by_leaf(flatten=True)
# >>> selector(container)
# Selection(Note("c'8"), Note("d'8"), Rest('r8'), Note("e'8"))
#
Expand Down
2 changes: 1 addition & 1 deletion abjad/tools/scoretools/get_next_measure_from_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_next_measure_from_component(component):
::

>>> staff = Staff("abj: | 2/8 c'8 d'8 || 2/8 e'8 f'8 |")
>>> selector = select().by_leaves(flatten=True)
>>> selector = select().by_leaf(flatten=True)
>>> leaves = selector(staff)
>>> scoretools.get_previous_measure_from_component(leaves[0])
Measure((2, 8), "c'8 d'8")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_previous_measure_from_component(component):
::

>>> staff = Staff("abj: | 2/8 c'8 d'8 || 2/8 e'8 f'8 |")
>>> selector = select().by_leaves(flatten=True)
>>> selector = select().by_leaf(flatten=True)
>>> leaves = selector(staff)
>>> scoretools.get_previous_measure_from_component(leaves[0])
Measure((2, 8), "c'8 d'8")
Expand Down
2 changes: 1 addition & 1 deletion abjad/tools/selectiontools/Parentage.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def score_index(self):

::

>>> selector = select().by_leaves(flatten=True)
>>> selector = select().by_leaf(flatten=True)
>>> leaves = selector(score)
>>> for leaf in leaves:
... parentage = inspect_(leaf).get_parentage()
Expand Down
2 changes: 1 addition & 1 deletion abjad/tools/selectiontools/Selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def _copy(self, n=1, include_enclosing_containers=False):

::

>>> selector = select().by_leaves(flatten=True)
>>> selector = select().by_leaf(flatten=True)
>>> leaves = selector(staff)
>>> leaves = leaves[1:5]
>>> new_staff = leaves._copy(include_enclosing_containers=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from abjad import *
Component = scoretools.Component
Selection = selectiontools.Selection
selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)


def test_selectiontools_Selection__all_are_components_in_same_logical_voice_01():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_selectiontools_Selection__attach_tie_spanner_to_leaf_pair_01():
'''
)

selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(voice)
leaves[1:3]._attach_tie_spanner_to_leaf_pair()

Expand Down Expand Up @@ -60,7 +60,7 @@ def test_selectiontools_Selection__attach_tie_spanner_to_leaf_pair_02():
'''
)

selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(voice)
leaves[1:3]._attach_tie_spanner_to_leaf_pair()

Expand All @@ -83,7 +83,7 @@ def test_selectiontools_Selection__attach_tie_spanner_to_leaf_pair_03():
'''

voice = Voice("c'8 c'8 c'8 c'8")
selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(voice)
leaves[1:3]._attach_tie_spanner_to_leaf_pair()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_selectiontools_Selection__withdraw_from_crossing_spanners_03():
'''
)

selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(voice)
leaves[2:3]._withdraw_from_crossing_spanners()
assert not inspect_(voice).is_well_formed()
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_selectiontools_Selection_partition_by_durations_01():
)


selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
parts = leaves.partition_by_durations(
[1.5],
Expand All @@ -53,7 +53,7 @@ def test_selectiontools_Selection_partition_by_durations_01():
'''

assert len(parts) == 2
selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
assert parts[0] == list(leaves[:3])
assert parts[1] == list(leaves[3:6])
Expand Down Expand Up @@ -91,7 +91,7 @@ def test_selectiontools_Selection_partition_by_durations_02():
'''
)

selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
parts = leaves.partition_by_durations(
[1.5],
Expand All @@ -110,7 +110,7 @@ def test_selectiontools_Selection_partition_by_durations_02():
'''

assert len(parts) == 3
selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
assert parts[0] == list(leaves[:3])
assert parts[1] == list(leaves[3:6])
Expand Down Expand Up @@ -146,7 +146,7 @@ def test_selectiontools_Selection_partition_by_durations_03():
'''
)

selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
parts = leaves.partition_by_durations(
[Duration(3, 8)],
Expand All @@ -165,7 +165,7 @@ def test_selectiontools_Selection_partition_by_durations_03():
'''

assert len(parts) == 3
selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
assert parts[0] == list(leaves[:3])
assert parts[1] == list(leaves[3:6])
Expand Down Expand Up @@ -204,7 +204,7 @@ def test_selectiontools_Selection_partition_by_durations_04():
'''
)

selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
parts = leaves.partition_by_durations(
[1.5],
Expand All @@ -217,7 +217,7 @@ def test_selectiontools_Selection_partition_by_durations_04():
"[[Note(c'', 8), Note(b', 8), Note(a', 8)]]"

assert len(parts) == 1
selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
assert parts[0] == list(leaves[:3])

Expand Down Expand Up @@ -251,7 +251,7 @@ def test_selectiontools_Selection_partition_by_durations_05():
'''
)

selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
parts = leaves.partition_by_durations(
[Duration(3, 8)],
Expand All @@ -264,7 +264,7 @@ def test_selectiontools_Selection_partition_by_durations_05():
"[[Note(c'', 8), Note(b', 8), Note(a', 8)]]"

assert len(parts) == 1
selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
assert parts[0] == list(leaves[:3])

Expand Down Expand Up @@ -299,7 +299,7 @@ def test_selectiontools_Selection_partition_by_durations_06():
'''
)

selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
parts = leaves.partition_by_durations(
[Duration(3, 16), Duration(1, 16)],
Expand All @@ -318,7 +318,7 @@ def test_selectiontools_Selection_partition_by_durations_06():
'''

assert len(parts) == 5
selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
assert parts[0] == list(leaves[:2])
assert parts[1] == list(leaves[2:3])
Expand Down Expand Up @@ -359,7 +359,7 @@ def test_selectiontools_Selection_partition_by_durations_07():
'''
)

selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
parts = leaves.partition_by_durations(
[0.75],
Expand All @@ -382,7 +382,7 @@ def test_selectiontools_Selection_partition_by_durations_07():
'''

assert len(parts) == 7
selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
assert parts[0] == list(leaves[:1])
assert parts[1] == list(leaves[1:2])
Expand Down Expand Up @@ -422,7 +422,7 @@ def test_selectiontools_Selection_partition_by_durations_08():
'''
)

selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
parts = leaves.partition_by_durations(
[Duration(3, 16)],
Expand All @@ -445,7 +445,7 @@ def test_selectiontools_Selection_partition_by_durations_08():
'''

assert len(parts) == 7
selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
assert parts[0] == list(leaves[:1])
assert parts[1] == list(leaves[1:2])
Expand All @@ -463,7 +463,7 @@ def test_selectiontools_Selection_partition_by_durations_09():
tempo = Tempo(Duration(1, 4), 60)
attach(tempo, staff, scope=Staff)

selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
parts = leaves.partition_by_durations(
[0.75],
Expand All @@ -476,7 +476,7 @@ def test_selectiontools_Selection_partition_by_durations_09():
"[[Note(c', 8)]]"

assert len(parts) == 1
selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
assert parts[0] == list(leaves[:1])

Expand All @@ -485,7 +485,7 @@ def test_selectiontools_Selection_partition_by_durations_10():

staff = Staff("abj: | 2/8 c'8 d'8 || 2/8 e'8 f'8 |"
"| 2/8 g'8 a'8 || 2/8 b'8 c''8 |")
selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
parts = leaves.partition_by_durations(
[Duration(3, 16)],
Expand All @@ -498,6 +498,6 @@ def test_selectiontools_Selection_partition_by_durations_10():
"[[Note(c', 8)]]"

assert len(parts) == 1
selector = select().by_leaves(flatten=True)
selector = select().by_leaf(flatten=True)
leaves = selector(staff)
assert parts[0] == list(leaves[:1])
Loading