From 2f95f91fa87cf6bbe0769fa7952dcd9e9c2d67b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trevor=20Ba=C4=8Da?= Date: Thu, 23 Jun 2016 10:21:23 -0500 Subject: [PATCH] Changed plural Selector.by_leaves() to singular Selector.by_leaf(). CHNAGE. This closes #698. CHANGE MANAGEMENT. Change should be communicated clearly to user base. --- abjad/demos/bartok/make_bartok_score.py | 2 +- abjad/demos/ferneyhough/make_nested_tuplet.py | 2 +- .../creating_annotation_aware_spanners.rst | 6 +- abjad/tools/agenttools/IterationAgent.py | 4 +- abjad/tools/agenttools/MutationAgent.py | 10 +-- abjad/tools/metertools/MetricAccentKernel.py | 2 +- abjad/tools/rhythmmakertools/GalleryMaker.py | 2 +- abjad/tools/scoretools/Container.py | 2 +- .../get_next_measure_from_component.py | 2 +- .../get_previous_measure_from_component.py | 2 +- abjad/tools/selectiontools/Parentage.py | 2 +- abjad/tools/selectiontools/Selection.py | 2 +- ...ll_are_components_in_same_logical_voice.py | 2 +- ...ection__attach_tie_spanner_to_leaf_pair.py | 6 +- ...ection__withdraw_from_crossing_spanners.py | 2 +- ...ntools_Selection_partition_by_durations.py | 40 +++++----- ...VerticalMoment_previous_vertical_moment.py | 2 +- .../selectortools/CountsSelectorCallback.py | 2 +- .../LogicalMeasureSelectorCallback.py | 8 +- abjad/tools/selectortools/Selector.py | 78 ++++++++++--------- .../selectortools/select_pitched_runs.py | 2 +- abjad/tools/spannertools/BowContactSpanner.py | 2 +- .../tools/spannertools/MeasuredComplexBeam.py | 6 +- .../test/test_spannertools_Beam___init__.py | 2 +- ...t_spannertools_Spanner__get_my_nth_leaf.py | 2 +- .../tools/systemtools/BenchmarkScoreMaker.py | 2 +- ...rageFormatManager_get_import_statements.py | 2 +- .../test/test_topleveltools_set_.py | 2 +- 28 files changed, 102 insertions(+), 96 deletions(-) diff --git a/abjad/demos/bartok/make_bartok_score.py b/abjad/demos/bartok/make_bartok_score.py index 3c684747c76..df1def94ab6 100644 --- a/abjad/demos/bartok/make_bartok_score.py +++ b/abjad/demos/bartok/make_bartok_score.py @@ -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() diff --git a/abjad/demos/ferneyhough/make_nested_tuplet.py b/abjad/demos/ferneyhough/make_nested_tuplet.py index c00810836a9..5ee66cd2ad9 100644 --- a/abjad/demos/ferneyhough/make_nested_tuplet.py +++ b/abjad/demos/ferneyhough/make_nested_tuplet.py @@ -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) diff --git a/abjad/docs/source/cookbook/creating_annotation_aware_spanners.rst b/abjad/docs/source/cookbook/creating_annotation_aware_spanners.rst index 98206072130..81702290450 100644 --- a/abjad/docs/source/cookbook/creating_annotation_aware_spanners.rst +++ b/abjad/docs/source/cookbook/creating_annotation_aware_spanners.rst @@ -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:: @@ -403,7 +403,7 @@ Preparing for deployment .. abjad:: - selector = selector.by_leaves() + selector = selector.by_leaf() for x in selector(staff): x @@ -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) diff --git a/abjad/tools/agenttools/IterationAgent.py b/abjad/tools/agenttools/IterationAgent.py index f05c765851a..94f17458af3 100644 --- a/abjad/tools/agenttools/IterationAgent.py +++ b/abjad/tools/agenttools/IterationAgent.py @@ -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 @@ -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): diff --git a/abjad/tools/agenttools/MutationAgent.py b/abjad/tools/agenttools/MutationAgent.py index 9c2603d9dd2..dedcc09f3c5 100644 --- a/abjad/tools/agenttools/MutationAgent.py +++ b/abjad/tools/agenttools/MutationAgent.py @@ -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 @@ -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 @@ -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() @@ -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) @@ -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) diff --git a/abjad/tools/metertools/MetricAccentKernel.py b/abjad/tools/metertools/MetricAccentKernel.py index 7273d47081b..e76ae73d1e8 100644 --- a/abjad/tools/metertools/MetricAccentKernel.py +++ b/abjad/tools/metertools/MetricAccentKernel.py @@ -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()): diff --git a/abjad/tools/rhythmmakertools/GalleryMaker.py b/abjad/tools/rhythmmakertools/GalleryMaker.py index d49d1093f57..de1bd5e70f3 100644 --- a/abjad/tools/rhythmmakertools/GalleryMaker.py +++ b/abjad/tools/rhythmmakertools/GalleryMaker.py @@ -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] diff --git a/abjad/tools/scoretools/Container.py b/abjad/tools/scoretools/Container.py index 618fe85c70a..7e75aaa51f9 100644 --- a/abjad/tools/scoretools/Container.py +++ b/abjad/tools/scoretools/Container.py @@ -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")) # diff --git a/abjad/tools/scoretools/get_next_measure_from_component.py b/abjad/tools/scoretools/get_next_measure_from_component.py index 32013122726..103929edaca 100644 --- a/abjad/tools/scoretools/get_next_measure_from_component.py +++ b/abjad/tools/scoretools/get_next_measure_from_component.py @@ -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") diff --git a/abjad/tools/scoretools/get_previous_measure_from_component.py b/abjad/tools/scoretools/get_previous_measure_from_component.py index efca38357ba..4232a98005e 100644 --- a/abjad/tools/scoretools/get_previous_measure_from_component.py +++ b/abjad/tools/scoretools/get_previous_measure_from_component.py @@ -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") diff --git a/abjad/tools/selectiontools/Parentage.py b/abjad/tools/selectiontools/Parentage.py index 77b82824667..6d002594f06 100644 --- a/abjad/tools/selectiontools/Parentage.py +++ b/abjad/tools/selectiontools/Parentage.py @@ -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() diff --git a/abjad/tools/selectiontools/Selection.py b/abjad/tools/selectiontools/Selection.py index 417572b0202..c9c8eb8431c 100644 --- a/abjad/tools/selectiontools/Selection.py +++ b/abjad/tools/selectiontools/Selection.py @@ -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) diff --git a/abjad/tools/selectiontools/test/test_selectiontools_Selection__all_are_components_in_same_logical_voice.py b/abjad/tools/selectiontools/test/test_selectiontools_Selection__all_are_components_in_same_logical_voice.py index 372afd3ffb9..479352eabda 100644 --- a/abjad/tools/selectiontools/test/test_selectiontools_Selection__all_are_components_in_same_logical_voice.py +++ b/abjad/tools/selectiontools/test/test_selectiontools_Selection__all_are_components_in_same_logical_voice.py @@ -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(): diff --git a/abjad/tools/selectiontools/test/test_selectiontools_Selection__attach_tie_spanner_to_leaf_pair.py b/abjad/tools/selectiontools/test/test_selectiontools_Selection__attach_tie_spanner_to_leaf_pair.py index 042323bf08d..745b6f8f73c 100644 --- a/abjad/tools/selectiontools/test/test_selectiontools_Selection__attach_tie_spanner_to_leaf_pair.py +++ b/abjad/tools/selectiontools/test/test_selectiontools_Selection__attach_tie_spanner_to_leaf_pair.py @@ -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() @@ -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() @@ -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() diff --git a/abjad/tools/selectiontools/test/test_selectiontools_Selection__withdraw_from_crossing_spanners.py b/abjad/tools/selectiontools/test/test_selectiontools_Selection__withdraw_from_crossing_spanners.py index e3e0b595dd6..86ca9509858 100644 --- a/abjad/tools/selectiontools/test/test_selectiontools_Selection__withdraw_from_crossing_spanners.py +++ b/abjad/tools/selectiontools/test/test_selectiontools_Selection__withdraw_from_crossing_spanners.py @@ -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() \ No newline at end of file diff --git a/abjad/tools/selectiontools/test/test_selectiontools_Selection_partition_by_durations.py b/abjad/tools/selectiontools/test/test_selectiontools_Selection_partition_by_durations.py index 3930df4adc2..a2ed4db185e 100644 --- a/abjad/tools/selectiontools/test/test_selectiontools_Selection_partition_by_durations.py +++ b/abjad/tools/selectiontools/test/test_selectiontools_Selection_partition_by_durations.py @@ -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], @@ -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]) @@ -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], @@ -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]) @@ -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)], @@ -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]) @@ -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], @@ -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]) @@ -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)], @@ -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]) @@ -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)], @@ -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]) @@ -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], @@ -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]) @@ -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)], @@ -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]) @@ -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], @@ -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]) @@ -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)], @@ -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]) \ No newline at end of file diff --git a/abjad/tools/selectiontools/test/test_selectiontools_VerticalMoment_previous_vertical_moment.py b/abjad/tools/selectiontools/test/test_selectiontools_VerticalMoment_previous_vertical_moment.py index fc27e079e2f..1449b67c135 100644 --- a/abjad/tools/selectiontools/test/test_selectiontools_VerticalMoment_previous_vertical_moment.py +++ b/abjad/tools/selectiontools/test/test_selectiontools_VerticalMoment_previous_vertical_moment.py @@ -27,7 +27,7 @@ def test_selectiontools_VerticalMoment_previous_vertical_moment_01(): >> ''') - selector = select().by_leaves(flatten=True) + selector = select().by_leaf(flatten=True) leaves = selector(score) last_leaf = leaves[-1] vertical_moment = inspect_(last_leaf).get_vertical_moment() diff --git a/abjad/tools/selectortools/CountsSelectorCallback.py b/abjad/tools/selectortools/CountsSelectorCallback.py index f81fd4c3c37..15699c9f240 100644 --- a/abjad/tools/selectortools/CountsSelectorCallback.py +++ b/abjad/tools/selectortools/CountsSelectorCallback.py @@ -34,7 +34,7 @@ class CountsSelectorCallback(AbjadValueObject): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_counts([3]) >>> staff = Staff("c'8 r8 d'8 e'8 r8 f'8 g'8 a'8 b'8 r8 c''8") >>> selector(staff) diff --git a/abjad/tools/selectortools/LogicalMeasureSelectorCallback.py b/abjad/tools/selectortools/LogicalMeasureSelectorCallback.py index 97701ab2e6b..213c8cd8335 100644 --- a/abjad/tools/selectortools/LogicalMeasureSelectorCallback.py +++ b/abjad/tools/selectortools/LogicalMeasureSelectorCallback.py @@ -26,7 +26,7 @@ class LogicalMeasureSelectorCallback(AbjadValueObject): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_logical_measure() >>> for x in selector(staff): ... x @@ -43,7 +43,7 @@ class LogicalMeasureSelectorCallback(AbjadValueObject): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_logical_measure() >>> selector = selector[0] >>> selector(staff) @@ -56,7 +56,7 @@ class LogicalMeasureSelectorCallback(AbjadValueObject): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_logical_measure() >>> selector = selector[-1] >>> selector(staff) @@ -77,7 +77,7 @@ class LogicalMeasureSelectorCallback(AbjadValueObject): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_logical_measure() >>> for x in selector(score): ... x diff --git a/abjad/tools/selectortools/Selector.py b/abjad/tools/selectortools/Selector.py index a50ed6b4fa0..a92786de7c1 100644 --- a/abjad/tools/selectortools/Selector.py +++ b/abjad/tools/selectortools/Selector.py @@ -48,7 +48,8 @@ class Selector(AbjadValueObject): :: - >>> selector = selector.by_leaves() + >>> selector = selectortools.Selector() + >>> selector = selector.by_leaf() >>> selector(staff) Selection(Selection(Note("c'4"), Note("d'8"), Rest('r8'), Note("e'8"), Rest('r16'), Note("f'16"), Note("g'8"), Note("a'4")),) @@ -58,6 +59,8 @@ class Selector(AbjadValueObject): :: + >>> selector = selectortools.Selector() + >>> selector = selector.by_leaf() >>> selector = selector.by_run(Note) >>> selector(staff) Selection(Selection(Note("c'4"), Note("d'8")), Selection(Note("e'8"),), Selection(Note("f'16"), Note("g'8"), Note("a'4"))) @@ -68,6 +71,9 @@ class Selector(AbjadValueObject): :: + >>> selector = selectortools.Selector() + >>> selector = selector.by_leaf() + >>> selector = selector.by_run(Note) >>> selector = selector.get_item(0, apply_to_each=True) >>> selector(staff) Selection(Note("c'4"), Note("e'8"), Note("f'16")) @@ -193,7 +199,7 @@ def append_callback(self, callback): >>> staff = Staff("4 4 r4 2 fs,4") >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.append_callback(CMajorSelectorCallback()) :: @@ -353,7 +359,7 @@ def by_contiguity(self): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.flatten() >>> selector = selector.by_duration('==', (1, 16)) >>> selector = selector.by_contiguity() @@ -423,7 +429,7 @@ def by_contiguity(self): :: - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> for x in selector(staff): ... x ... @@ -496,7 +502,7 @@ def by_counts( :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_counts( ... [3], ... cyclic=False, @@ -538,7 +544,7 @@ def by_counts( :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_counts( ... [3], ... cyclic=True, @@ -582,7 +588,7 @@ def by_counts( :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_counts( ... [3], ... cyclic=True, @@ -627,7 +633,7 @@ def by_counts( :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_counts( ... [3], ... cyclic=True, @@ -674,7 +680,7 @@ def by_counts( :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_counts( ... [1, 2, 3], ... cyclic=True, @@ -725,7 +731,7 @@ def by_counts( :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_counts( ... [1, 2, 3], ... cyclic=True, @@ -789,7 +795,7 @@ def by_duration(self, inequality=None, duration=None, preprolated=None): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_run(Note) >>> selector = selector.by_duration(Duration(2, 8)) @@ -829,7 +835,7 @@ def by_duration(self, inequality=None, duration=None, preprolated=None): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_run(Note) >>> selector = selector.by_duration( ... selectortools.DurationInequality( @@ -875,7 +881,7 @@ def by_duration(self, inequality=None, duration=None, preprolated=None): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_run(Note) >>> selector = selector.by_duration( ... selectortools.DurationInequality( @@ -967,7 +973,7 @@ def by_duration(self, inequality=None, duration=None, preprolated=None): ) return self._append_callback(callback) - def by_leaves(self, flatten=None): + def by_leaf(self, flatten=None): r'''Configures selector by leaves. .. container:: example @@ -996,7 +1002,7 @@ def by_leaves(self, flatten=None): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() :: @@ -1034,7 +1040,7 @@ def by_leaves(self, flatten=None): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves(flatten=True) + >>> selector = selector.by_leaf(flatten=True) :: @@ -1093,7 +1099,7 @@ def by_leaves(self, flatten=None): :: - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selections = selector(staff) >>> for selection in selections: ... selection @@ -1143,7 +1149,7 @@ def by_leaves(self, flatten=None): :: - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selections = selector(staff) >>> for selection in selections: ... selection @@ -1194,7 +1200,7 @@ def by_leaves(self, flatten=None): :: - >>> selector = selector.by_leaves(flatten=True) + >>> selector = selector.by_leaf(flatten=True) >>> selection = selector(staff) >>> for leaf in selection: ... leaf @@ -1233,7 +1239,7 @@ def by_leaves(self, flatten=None): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves(flatten=True) + >>> selector = selector.by_leaf(flatten=True) >>> selection = selector(staff) :: @@ -1264,7 +1270,7 @@ def by_length(self, *args): >>> staff = Staff("c'8 r8 d'8 e'8 r8 f'8 g'8 a'8") >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_run(Note) >>> selector = selector.by_length( ... selectortools.LengthInequality( @@ -1289,7 +1295,7 @@ def by_length(self, *args): >>> staff = Staff("c'8 r8 d'8 e'8 r8 f'8 g'8 a'8") >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_run(Note) >>> selector = selector.by_length( ... selectortools.LengthInequality( @@ -1599,7 +1605,7 @@ def by_pattern( :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves(flatten=True) + >>> selector = selector.by_leaf(flatten=True) >>> pattern = patterntools.select_every([0], period=2) >>> selector = selector.by_pattern(pattern=pattern) @@ -1678,7 +1684,7 @@ def by_pattern( :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves(flatten=True) + >>> selector = selector.by_leaf(flatten=True) >>> pattern = patterntools.select_every([0], period=2) >>> selector = selector.by_pattern(pattern=pattern) @@ -1800,7 +1806,7 @@ def by_pitch( >>> staff = Staff("c'4 d'4 ~ d'4 e'4") >>> staff.extend("r4 4 ~ 2") >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves(flatten=True) + >>> selector = selector.by_leaf(flatten=True) >>> selector = selector.by_pitch(pitches="c'") :: @@ -1821,7 +1827,7 @@ def by_pitch( >>> staff = Staff("c'4 d'4 ~ d'4 e'4") >>> staff.extend("r4 4 ~ 2") >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves(flatten=True) + >>> selector = selector.by_leaf(flatten=True) >>> selector = selector.by_pitch(pitches="c' e'") :: @@ -1876,7 +1882,7 @@ def by_run( >>> staff = Staff(r"c'8 d' r \times 2/3 { e' r f' } g' a' r") >>> selector = selectortools.Selector() >>> prototype = (Note, Chord) - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_run(prototype) :: @@ -2014,7 +2020,7 @@ def flatten(self, depth=-1): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector(staff) Selection(Selection(Note("c'4"), Note("d'4"), Note("d'4"), Note("e'4"), Note("e'4"), Note("e'4"), Rest('r4'), Note("f'4")),) @@ -2069,7 +2075,7 @@ def get_item(self, item, apply_to_each=False): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.flatten() >>> selector = selector.get_item(1) >>> selector(staff) @@ -2277,7 +2283,7 @@ def get_slice(self, start=None, stop=None, apply_to_each=True): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.flatten() >>> selector = selector.get_slice( ... start=-3, @@ -2421,7 +2427,7 @@ def partition_by_ratio(self, ratio): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> result = selector(staff) >>> for selection in result: ... selection @@ -2478,7 +2484,7 @@ def partition_by_ratio(self, ratio): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> result = selector(staff) >>> for selection in result: ... selection @@ -2681,7 +2687,7 @@ def with_next_leaf(self): >>> staff = Staff("c'8 r8 d'8 e'8 r8 f'8 g'8 a'8") >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_run(Note) >>> selector = selector.with_next_leaf() @@ -2706,7 +2712,7 @@ def with_next_leaf(self): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_logical_tie(pitched=True) >>> selector = selector.get_item(-1, apply_to_each=True) >>> selector(staff) @@ -2743,7 +2749,7 @@ def with_previous_leaf(self): >>> staff = Staff("c'8 r8 d'8 e'8 r8 f'8 g'8 a'8") >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_run(Note) >>> selector = selector.with_previous_leaf() @@ -2768,7 +2774,7 @@ def with_previous_leaf(self): :: >>> selector = selectortools.Selector() - >>> selector = selector.by_leaves() + >>> selector = selector.by_leaf() >>> selector = selector.by_logical_tie(pitched=True) >>> selector = selector.get_item(0, apply_to_each=True) >>> selector(staff) diff --git a/abjad/tools/selectortools/select_pitched_runs.py b/abjad/tools/selectortools/select_pitched_runs.py index b74862f1772..f199ca754cc 100644 --- a/abjad/tools/selectortools/select_pitched_runs.py +++ b/abjad/tools/selectortools/select_pitched_runs.py @@ -53,7 +53,7 @@ def select_pitched_runs(expr=None): from abjad.tools import scoretools from abjad.tools import selectortools selector = selectortools.Selector() - selector = selector.by_leaves() + selector = selector.by_leaf() selector = selector.by_run((scoretools.Note, scoretools.Chord)) if expr is None: return selector diff --git a/abjad/tools/spannertools/BowContactSpanner.py b/abjad/tools/spannertools/BowContactSpanner.py index c4a8700938e..75cb62c3a61 100644 --- a/abjad/tools/spannertools/BowContactSpanner.py +++ b/abjad/tools/spannertools/BowContactSpanner.py @@ -19,7 +19,7 @@ class BowContactSpanner(Spanner): :: - >>> selector = select().by_leaves(flatten=True) + >>> selector = select().by_leaf(flatten=True) >>> leaves = selector(staff) >>> attach(indicatortools.BowMotionTechnique('jete'), leaves[0]) >>> attach(indicatortools.BowContactPoint((1, 4)), leaves[0]) diff --git a/abjad/tools/spannertools/MeasuredComplexBeam.py b/abjad/tools/spannertools/MeasuredComplexBeam.py index 418fc1350f9..a0064d07b7b 100644 --- a/abjad/tools/spannertools/MeasuredComplexBeam.py +++ b/abjad/tools/spannertools/MeasuredComplexBeam.py @@ -20,7 +20,7 @@ class MeasuredComplexBeam(ComplexBeam): :: >>> beam = spannertools.MeasuredComplexBeam() - >>> selector = select().by_leaves(flatten=True) + >>> selector = select().by_leaf(flatten=True) >>> leaves = selector(staff) >>> attach(beam, leaves) >>> show(staff) # doctest: +SKIP @@ -133,7 +133,7 @@ def span_beam_count(self): >>> staff = Staff() >>> staff.append(Measure((2, 32), "c'32 d'32")) >>> staff.append(Measure((2, 32), "e'32 f'32")) - >>> selector = select().by_leaves(flatten=True) + >>> selector = select().by_leaf(flatten=True) >>> leaves = selector(staff) >>> beam = spannertools.MeasuredComplexBeam(span_beam_count=1) >>> attach(beam, leaves) @@ -154,7 +154,7 @@ def span_beam_count(self): >>> staff.append(Measure((2, 32), "c'32 d'32")) >>> staff.append(Measure((2, 32), "e'32 f'32")) >>> beam = spannertools.MeasuredComplexBeam(span_beam_count=2) - >>> selector = select().by_leaves(flatten=True) + >>> selector = select().by_leaf(flatten=True) >>> leaves = selector(staff) >>> attach(beam, leaves) >>> show(staff) # doctest: +SKIP diff --git a/abjad/tools/spannertools/test/test_spannertools_Beam___init__.py b/abjad/tools/spannertools/test/test_spannertools_Beam___init__.py index ca3e07d299e..c2faa8a346a 100644 --- a/abjad/tools/spannertools/test/test_spannertools_Beam___init__.py +++ b/abjad/tools/spannertools/test/test_spannertools_Beam___init__.py @@ -731,7 +731,7 @@ def test_spannertools_Beam___init___19(): ''' ) - selector = select().by_leaves(flatten=True) + selector = select().by_leaf(flatten=True) leaves = selector(staff) beam = Beam() statement = 'attach(beam, leaves)' diff --git a/abjad/tools/spannertools/test/test_spannertools_Spanner__get_my_nth_leaf.py b/abjad/tools/spannertools/test/test_spannertools_Spanner__get_my_nth_leaf.py index 87e10e61686..36e1427dde3 100644 --- a/abjad/tools/spannertools/test/test_spannertools_Spanner__get_my_nth_leaf.py +++ b/abjad/tools/spannertools/test/test_spannertools_Spanner__get_my_nth_leaf.py @@ -28,7 +28,7 @@ def test_spannertools_Spanner__get_my_nth_leaf_01(): ''' ) - selector = select().by_leaves(flatten=True) + selector = select().by_leaf(flatten=True) leaves = selector(staff) assert beam._get_my_nth_leaf(0) is leaves[0] diff --git a/abjad/tools/systemtools/BenchmarkScoreMaker.py b/abjad/tools/systemtools/BenchmarkScoreMaker.py index b8f0979042e..3aebdec9eec 100644 --- a/abjad/tools/systemtools/BenchmarkScoreMaker.py +++ b/abjad/tools/systemtools/BenchmarkScoreMaker.py @@ -282,7 +282,7 @@ def make_score_with_indicators_03(self): from abjad.tools import scoretools from abjad.tools import topleveltools staff = scoretools.Staff(200 * scoretools.Note("c'16")) - selector = topleveltools.select().by_leaves(flatten=True) + selector = topleveltools.select().by_leaf(flatten=True) for note in selector(staff): dynamic = indicatortools.Dynamic('f') topleveltools.attach(dynamic, note) diff --git a/abjad/tools/systemtools/test/test_systemtools_StorageFormatManager_get_import_statements.py b/abjad/tools/systemtools/test/test_systemtools_StorageFormatManager_get_import_statements.py index 2b88bc15bca..8997b420cff 100644 --- a/abjad/tools/systemtools/test/test_systemtools_StorageFormatManager_get_import_statements.py +++ b/abjad/tools/systemtools/test/test_systemtools_StorageFormatManager_get_import_statements.py @@ -12,7 +12,7 @@ def test_systemtools_StorageFormatManager_get_import_statements_01(): def test_systemtools_StorageFormatManager_get_import_statements_02(): - subject = selectortools.Selector().by_leaves() + subject = selectortools.Selector().by_leaf() assert manager.get_import_statements(subject) == ( 'from abjad.tools import scoretools', 'from abjad.tools import selectortools', diff --git a/abjad/tools/topleveltools/test/test_topleveltools_set_.py b/abjad/tools/topleveltools/test/test_topleveltools_set_.py index dfa8e03c1a8..cf038508822 100644 --- a/abjad/tools/topleveltools/test/test_topleveltools_set_.py +++ b/abjad/tools/topleveltools/test/test_topleveltools_set_.py @@ -33,7 +33,7 @@ def test_topleveltools_set__02(): staff = Staff("c'8 d'8 e'8 f'8") score = Score([staff]) moment = schemetools.SchemeMoment(24) - leaves = select().by_leaves(flatten=True)(score) + leaves = select().by_leaf(flatten=True)(score) set_(leaves[1]).score.tempo_wholes_per_minute = moment assert format(score) == stringtools.normalize(