diff --git a/abjad/bind.py b/abjad/bind.py index 6d3de069c8..cc69616278 100644 --- a/abjad/bind.py +++ b/abjad/bind.py @@ -130,9 +130,9 @@ def __copy__(self, *arguments) -> "Wrapper": r""" Copies wrapper. - .. container:: example + Preserves annotation flag: - Preserves annotation flag: + .. container:: example >>> old_staff = abjad.Staff("c'4 d'4 e'4 f'4") >>> abjad.annotate(old_staff[0], "bow_direction", abjad.DOWN) @@ -639,9 +639,9 @@ def annotate(component, annotation, indicator) -> None: r""" Annotates ``component`` with ``indicator``. - .. container:: example + Annotates first note in staff: - Annotates first note in staff: + .. container:: example >>> staff = abjad.Staff("c'4 d' e' f'") >>> abjad.annotate(staff[0], "bow_direction", abjad.DOWN) diff --git a/abjad/cyclictuple.py b/abjad/cyclictuple.py index 1e1e942e0b..a121e9d64f 100644 --- a/abjad/cyclictuple.py +++ b/abjad/cyclictuple.py @@ -68,18 +68,18 @@ def __getitem__(self, argument) -> typing.Any: """ Gets item or slice identified by ``argument``. - .. container:: example + Gets slice open at right: - Gets slice open at right: + .. container:: example >>> items = [0, 1, 2, 3, 4, 5] >>> tuple_ = abjad.CyclicTuple(items=items) >>> tuple_[2:] (2, 3, 4, 5) - .. container:: example + Gets slice closed at right: - Gets slice closed at right: + .. container:: example >>> items = [0, 1, 2, 3, 4, 5] >>> tuple_ = abjad.CyclicTuple(items=items) diff --git a/abjad/duration.py b/abjad/duration.py index efb87a2eb7..b7207dfe6a 100644 --- a/abjad/duration.py +++ b/abjad/duration.py @@ -283,9 +283,9 @@ def __ne__(self, argument) -> bool: See https://bugs.python.org/issue4395#msg89533. - .. container:: example + REGRESSION: - REGRESSION: + .. container:: example >>> offset_1 = abjad.Offset(1) >>> offset_2 = abjad.Offset(1, displacement=(-1, 16)) @@ -1024,8 +1024,6 @@ def from_lilypond_duration_string( .. container:: example - Initializes duration from LilyPond duration string: - >>> abjad.Duration.from_lilypond_duration_string('8.') Duration(3, 16) @@ -1042,8 +1040,6 @@ def is_token(argument) -> bool: .. container:: example - Is true when expression is a duration token: - >>> abjad.Duration.is_token('8.') True @@ -1070,9 +1066,9 @@ def to_clock_string(self) -> str: r""" Changes duration to clock string. - .. container:: example + Changes duration to clock string: - Changes duration to clock string: + .. container:: example >>> note = abjad.Note("c'4") >>> duration = abjad.Duration(117) @@ -1296,9 +1292,9 @@ def __eq__(self, argument) -> bool: """ Is true when offset equals ``argument``. - .. container:: example + With equal numerators, denominators and displacement: - With equal numerators, denominators and displacement: + .. container:: example >>> offset_1 = abjad.Offset((1, 4), displacement=(-1, 16)) >>> offset_2 = abjad.Offset((1, 4), displacement=(-1, 16)) @@ -1355,9 +1351,9 @@ def __ge__(self, argument) -> bool: """ Is true when offset is greater than or equal to ``argument``. - .. container:: example + With equal numerators, denominators and displacement: - With equal numerators, denominators and displacement: + .. container:: example >>> offset_1 = abjad.Offset((1, 4), displacement=(-1, 16)) >>> offset_2 = abjad.Offset((1, 4), displacement=(-1, 16)) @@ -1414,9 +1410,9 @@ def __gt__(self, argument) -> bool: """ Is true when offset is greater than ``argument``. - .. container:: example + With equal numerators, denominators and displacement: - With equal numerators, denominators and displacement: + .. container:: example >>> offset_1 = abjad.Offset((1, 4), displacement=(-1, 16)) >>> offset_2 = abjad.Offset((1, 4), displacement=(-1, 16)) @@ -1479,9 +1475,9 @@ def __le__(self, argument) -> bool: """ Is true when offset is less than or equal to ``argument``. - .. container:: example + With equal numerators, denominators and displacement: - With equal numerators, denominators and displacement: + .. container:: example >>> offset_1 = abjad.Offset((1, 4), displacement=(-1, 16)) >>> offset_2 = abjad.Offset((1, 4), displacement=(-1, 16)) @@ -1538,9 +1534,9 @@ def __lt__(self, argument) -> bool: """ Is true when offset is less than ``argument``. - .. container:: example + With equal numerators, denominators and displacement: - With equal numerators, denominators and displacement: + .. container:: example >>> offset_1 = abjad.Offset((1, 4), displacement=(-1, 16)) >>> offset_2 = abjad.Offset((1, 4), displacement=(-1, 16)) diff --git a/abjad/get.py b/abjad/get.py index 2915aa9ebe..daa73ac729 100644 --- a/abjad/get.py +++ b/abjad/get.py @@ -356,9 +356,9 @@ def contents(argument) -> list[_score.Component]: r""" Gets contents. - .. container:: example + REGRESSION. Works with grace notes (and containers): - REGRESSION. Works with grace notes (and containers): + .. container:: example >>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice") >>> container = abjad.BeforeGraceContainer("cs'16") @@ -550,9 +550,9 @@ def descendants(argument) -> list[_score.Component]: r""" Gets descendants. - .. container:: example + REGRESSION. Works with grace notes (and containers): - REGRESSION. Works with grace notes (and containers): + .. container:: example >>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice") >>> container = abjad.BeforeGraceContainer("cs'16") @@ -719,9 +719,9 @@ def duration( r""" Gets duration. - .. container:: example + REGRESSION. Works with grace notes (and containers): - REGRESSION. Works with grace notes (and containers): + .. container:: example >>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice") >>> container = abjad.BeforeGraceContainer("cs'16") @@ -925,9 +925,9 @@ def effective( r""" Gets effective indicator. - .. container:: example + REGRESSION. Works with grace notes (and containers): - REGRESSION. Works with grace notes (and containers): + .. container:: example >>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice") >>> container = abjad.BeforeGraceContainer("cs'16") @@ -1428,9 +1428,9 @@ def effective_staff(argument) -> typing.Optional["_score.Staff"]: r""" Gets effective staff. - .. container:: example + REGRESSION. Works with grace notes (and containers): - REGRESSION. Works with grace notes (and containers): + .. container:: example >>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice") >>> container = abjad.BeforeGraceContainer("cs'16") @@ -1679,9 +1679,9 @@ def grace(argument) -> bool: Grace music defined equal to grace container, after-grace container and contents of those containers. - .. container:: example + REGRESSION. Works with grace notes (and containers): - REGRESSION. Works with grace notes (and containers): + .. container:: example >>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice") >>> container = abjad.BeforeGraceContainer("cs'16") @@ -1779,9 +1779,9 @@ def has_effective_indicator( r""" Is true when ``argument`` has effective indicator. - .. container:: example + REGRESSION. Works with grace notes (and containers): - REGRESSION. Works with grace notes (and containers): + .. container:: example >>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice") >>> container = abjad.BeforeGraceContainer("cs'16") @@ -1932,9 +1932,9 @@ def has_indicator( r""" Is true when ``argument`` has one or more indicators. - .. container:: example + REGRESSION. Works with grace notes (and containers): - REGRESSION. Works with grace notes (and containers): + .. container:: example >>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice") >>> container = abjad.BeforeGraceContainer("cs'16") @@ -2130,9 +2130,9 @@ def indicator( r""" Gets indicator. - .. container:: example + REGRESSION. Works with grace notes (and containers): - REGRESSION. Works with grace notes (and containers): + .. container:: example >>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice") >>> container = abjad.BeforeGraceContainer("cs'16") @@ -2281,9 +2281,9 @@ def indicators( r""" Get indicators. - .. container:: example + REGRESSION. Works with grace notes (and containers): - REGRESSION. Works with grace notes (and containers): + .. container:: example >>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice") >>> container = abjad.BeforeGraceContainer("cs'16") @@ -2717,9 +2717,9 @@ def lineage(argument) -> "Lineage": r""" Gets lineage. - .. container:: example + REGRESSION. Works with grace notes (and containers): - REGRESSION. Works with grace notes (and containers): + .. container:: example >>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice") >>> container = abjad.BeforeGraceContainer("cs'16") @@ -2923,9 +2923,9 @@ def logical_tie(argument) -> "_select.LogicalTie": r""" Gets logical tie. - .. container:: example + REGRESSION. Works with grace notes (and containers): - REGRESSION. Works with grace notes (and containers): + .. container:: example >>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice") >>> container = abjad.BeforeGraceContainer("cs'16") @@ -3114,9 +3114,9 @@ def measure_number(argument) -> int: r""" Gets measure number. - .. container:: example + REGRESSION. Works with grace notes (and containers): - REGRESSION. Works with grace notes (and containers): + .. container:: example >>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice") >>> container = abjad.BeforeGraceContainer("cs'16") @@ -3503,9 +3503,9 @@ def pitches(argument) -> set[_pitch.NamedPitch]: r""" Gets pitches. - .. container:: example + REGRESSION. Works with grace notes (and containers): - REGRESSION. Works with grace notes (and containers): + .. container:: example >>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice") >>> container = abjad.BeforeGraceContainer("cs'16") @@ -3763,9 +3763,9 @@ def timespan(argument, in_seconds: bool = False) -> _timespan.Timespan: r""" Gets timespan. - .. container:: example + REGRESSION. Works with grace notes (and containers): - REGRESSION. Works with grace notes (and containers): + .. container:: example >>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice") >>> container = abjad.BeforeGraceContainer("cs'16") diff --git a/abjad/indicators.py b/abjad/indicators.py index 1566c00b8a..03db509b3a 100644 --- a/abjad/indicators.py +++ b/abjad/indicators.py @@ -851,9 +851,9 @@ def to_pitch(self, staff_position) -> _pitch.NamedPitch: """ Changes ``staff_position`` to pitch. - .. container:: example + Treble clef: - Treble clef: + .. container:: example >>> clef = abjad.Clef("treble") >>> for n in range(-6, 6): @@ -962,9 +962,9 @@ def to_staff_position(self, pitch) -> _pitch.StaffPosition: r""" Changes ``pitch`` to staff position. - .. container:: example + Changes C#5 to absolute staff position: - Changes C#5 to absolute staff position: + .. container:: example >>> pitch = abjad.NamedPitch("C#5") @@ -2772,9 +2772,9 @@ def duration_to_milliseconds(self, duration) -> _duration.Duration: """ Gets millisecond value of ``duration`` under a given metronome mark. - .. container:: example + Dotted sixteenth lasts 1500 msec at quarter equals 60: - Dotted sixteenth lasts 1500 msec at quarter equals 60: + .. container:: example >>> mark = abjad.MetronomeMark((1, 4), 60) >>> mark.duration_to_milliseconds((3, 8)) @@ -2797,9 +2797,9 @@ def make_tempo_equation_markup( r""" Makes tempo equation markup. - .. container:: example + Integer-valued metronome mark: - Integer-valued metronome mark: + .. container:: example >>> markup = abjad.MetronomeMark.make_tempo_equation_markup((1, 4), 90) >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', markup]) diff --git a/abjad/instruments.py b/abjad/instruments.py index 9aa6638bab..521913dc17 100644 --- a/abjad/instruments.py +++ b/abjad/instruments.py @@ -308,9 +308,9 @@ def get_pitch_ranges_by_string_number( """ Gets tuning pitch ranges by string number. - .. container:: example + Violin tuning: - Violin tuning: + .. container:: example >>> pitches = [abjad.NamedPitch(_) for _ in "G3 D4 A4 E5".split()] >>> tuning = abjad.Tuning(tuple(pitches)) @@ -336,9 +336,9 @@ def get_pitches_by_string_number( """ Gets tuning pitches by string number. - .. container:: example + Violin tuning: - Violin tuning: + .. container:: example >>> pitches = [abjad.NamedPitch(_) for _ in "G3 D4 A4 E5".split()] >>> tuning = abjad.Tuning(tuple(pitches)) diff --git a/abjad/io.py b/abjad/io.py index 610a87526d..1f198eb012 100644 --- a/abjad/io.py +++ b/abjad/io.py @@ -899,31 +899,10 @@ def profile( .. container:: example - :: - - >>> string = 'abjad.Staff("c8 c8 c8 c8 c8 c8 c8 c8")' - >>> result = abjad.io.profile(string, global_context=globals()) - >>> print(result) # doctest: +SKIP - Fri Sep 03 12:53:36 2021 - - 62795 function calls (61272 primitive calls) in 0.043 seconds - - Ordered by: cumulative time - List reduced from 453 to 12 due to restriction <12> - - ncalls tottime percall cumtime percall filename:lineno(function) - 1 0.000 0.000 0.043 0.043 {built-in method builtins.exec} - 1 0.000 0.000 0.043 0.043 :1() - 1 0.000 0.000 0.043 0.043 score.py:4989(__init__) - 1 0.000 0.000 0.043 0.043 score.py:3099(__init__) - 2/1 0.000 0.000 0.043 0.043 score.py:918(__init__) - 2/1 0.000 0.000 0.043 0.043 score.py:1343(_initialize_componen - 1 0.000 0.000 0.042 0.042 score.py:1378(_parse_string) - 1 0.000 0.000 0.042 0.042 score.py:57(_parse_lilypond_string - 1 0.000 0.000 0.042 0.042 parse.py:9(parse) - 1 0.000 0.000 0.035 0.035 parser.py:2728(__init__) - 1 0.000 0.000 0.035 0.035 base.py:34(__init__) - 1 0.000 0.000 0.023 0.023 lex.py:862(lex) + >>> string = 'abjad.Staff("c8 c8 c8 c8 c8 c8 c8 c8")' + >>> result = abjad.io.profile(string, global_context=globals()) + + Then print result. Wraps Python's built-in ``cProfile`` module. diff --git a/abjad/iterate.py b/abjad/iterate.py index 2bd27b6812..4ff8589979 100644 --- a/abjad/iterate.py +++ b/abjad/iterate.py @@ -247,9 +247,9 @@ def leaves( r""" Iterates leaves in ``argument``. - .. container:: example + Set ``exclude=`` to exclude leaves with annotation: - Set ``exclude=`` to exclude leaves with annotation: + .. container:: example >>> staff = abjad.Staff() >>> staff.extend("8 8") @@ -490,9 +490,9 @@ def logical_ties( r""" Iterates logical ties in ``argument``. - .. container:: example + Iterates logical ties: - Iterates logical ties: + .. container:: example >>> string = r"c'4 ~ \times 2/3 { c'16 d'8 } e'8 f'4 ~ f'16" >>> staff = abjad.Staff(string) @@ -844,9 +844,9 @@ def pitches(argument) -> typing.Iterator[_pitch.NamedPitch]: r""" Iterates pitches in ``argument``. - .. container:: example + Iterates pitches in container: - Iterates pitches in container: + .. container:: example >>> staff = abjad.Staff("c'8 d'8 e'8 f'8") >>> abjad.beam(staff[:]) @@ -944,9 +944,9 @@ def timeline( r""" Iterates leaves in ``argument`` in timeline order. - .. container:: example + Timeline-iterates leaves: - Timeline-iterates leaves: + .. container:: example >>> score = abjad.Score() >>> score.append(abjad.Staff("c'4 d'4 e'4 f'4")) diff --git a/abjad/label.py b/abjad/label.py index 134b3cb146..9aec049ecf 100644 --- a/abjad/label.py +++ b/abjad/label.py @@ -78,8 +78,6 @@ def color_container(container, color="#red") -> None: .. container:: example - Colors measure: - >>> staff = abjad.Staff("c'8 d'8") >>> abjad.attach(abjad.TimeSignature((2, 8)), staff[0]) >>> abjad.label.color_container(staff, "#red") @@ -124,8 +122,6 @@ def color_leaves(argument, color="#red", *, deactivate=False, tag=None) -> None: .. container:: example - Colors leaves red: - >>> staff = abjad.Staff("cs'8. r8. s8. 8.") >>> abjad.beam(staff[:]) >>> abjad.label.color_leaves(staff, "#red") @@ -161,8 +157,6 @@ def color_note_heads(argument, color_map=pc_number_to_color) -> None: .. container:: example - Colors chord note-heads: - >>> chord = abjad.Chord([12, 14, 18, 21, 23], (1, 4)) >>> pitches = [[-12, -10, 4], [-2, 8, 11, 17], [19, 27, 30, 33, 37]] >>> colors = ["#red", "#blue", "#green"] @@ -838,9 +832,9 @@ def with_indices(argument, direction=_enums.UP, prototype=None) -> None: r""" Labels logical ties in ``argument`` with indices. - .. container:: example + Labels logical tie indices: - Labels logical tie indices: + .. container:: example >>> staff = abjad.Staff("8 4 af'8 ~ af'8 gf'8 ~ gf'4") >>> abjad.label.with_indices(staff) @@ -1046,9 +1040,9 @@ def with_intervals(argument, direction=_enums.UP, prototype=None) -> None: r""" Labels consecutive notes in ``argument`` with intervals. - .. container:: example + Labels consecutive notes with interval names: - Labels consecutive notes with interval names: + .. container:: example >>> pitch_numbers = [0, 25, 11, -4, -14, -13, 9, 10] >>> notes = abjad.makers.make_notes(pitch_numbers, [(1, 4)]) diff --git a/abjad/makers.py b/abjad/makers.py index 9d9b61432b..5172e84b5c 100644 --- a/abjad/makers.py +++ b/abjad/makers.py @@ -698,10 +698,10 @@ def make_notes( Set ``durations`` to a single duration or a list of durations. - .. container:: example + Cycles through ``pitches`` when the length of ``pitches`` is less than the length + of ``durations``: - Cycles through ``pitches`` when the length of ``pitches`` is less than the length - of ``durations``: + .. container:: example >>> pitches = [0] >>> durations = [(1, 16), (1, 8), (1, 8)] @@ -921,9 +921,9 @@ def tuplet_from_duration_and_ratio( r""" Makes tuplet from ``duration`` and ``ratio``. - .. container:: example + Makes tupletted leaves strictly without dots when all ``ratio`` equal ``1``: - Makes tupletted leaves strictly without dots when all ``ratio`` equal ``1``: + .. container:: example >>> tuplet = abjad.makers.tuplet_from_duration_and_ratio( ... abjad.Duration(3, 16), diff --git a/abjad/math.py b/abjad/math.py index 619f96ae05..03f5ca1e4b 100644 --- a/abjad/math.py +++ b/abjad/math.py @@ -582,9 +582,9 @@ def integer_equivalent_number_to_integer(number) -> int | float: """ Changes integer-equivalent ``number`` to integer. - .. container:: example + Returns integer-equivalent number as integer: - Returns integer-equivalent number as integer: + .. container:: example >>> abjad.math.integer_equivalent_number_to_integer(17.0) 17 @@ -607,9 +607,9 @@ def integer_to_base_k_tuple(n, k) -> tuple[int, ...]: """ Changes nonnegative integer ``n`` to base-`k` tuple. - .. container:: example + Gets base-10 digits of 1066: - Gets base-10 digits of 1066: + .. container:: example >>> abjad.math.integer_to_base_k_tuple(1066, 10) (1, 0, 6, 6) @@ -1059,9 +1059,9 @@ def partition_integer_into_canonic_parts( """ Partitions integer ``n`` into canonic parts. - .. container:: example + Returns all parts positive on positive ``n``: - Returns all parts positive on positive ``n``: + .. container:: example >>> for n in range(1, 11): ... print(n, abjad.math.partition_integer_into_canonic_parts(n)) @@ -1147,9 +1147,9 @@ def sign(n) -> int: """ Gets sign of ``n``. - .. container:: example + Returns -1 on negative ``n``: - Returns -1 on negative ``n``: + .. container:: example >>> abjad.math.sign(-96.2) -1 diff --git a/abjad/mutate.py b/abjad/mutate.py index 01b94070bf..7a00cca11d 100644 --- a/abjad/mutate.py +++ b/abjad/mutate.py @@ -741,9 +741,9 @@ def copy(argument, n=1) -> list[_score.Component]: r""" Copies argument. - .. container:: example + Copies explicit clefs: - Copies explicit clefs: + .. container:: example >>> staff = abjad.Staff("c'8 cs'8 d'8 ef'8 e'8 f'8 fs'8 g'8") >>> clef = abjad.Clef('treble') @@ -875,9 +875,9 @@ def eject_contents(container: _score.Container) -> list[_score.Component]: r""" Ejects ``container`` contents. - .. container:: example + Ejects leaves from container: - Ejects leaves from container: + .. container:: example >>> container = abjad.Container("c'4 ~ c'4 d'4 ~ d'4") >>> abjad.show(container) # doctest: +SKIP @@ -1096,9 +1096,9 @@ def fuse(argument) -> _score.Tuplet | list[_score.Leaf]: r""" Fuses ``argument``. - .. container:: example + Fuses in-score leaves: - Fuses in-score leaves: + .. container:: example >>> staff = abjad.Staff("c'8 d'8 e'8 f'8") >>> abjad.show(staff) # doctest: +SKIP @@ -1611,9 +1611,9 @@ def scale(argument, multiplier) -> None: r""" Scales ``argument`` by ``multiplier``. - .. container:: example + Scales note duration by dot-generating multiplier: - Scales note duration by dot-generating multiplier: + .. container:: example >>> staff = abjad.Staff("c'8 ( d'8 e'8 f'8 )") >>> abjad.show(staff) # doctest: +SKIP diff --git a/abjad/parentage.py b/abjad/parentage.py index 46b601a245..da25c2bfe5 100644 --- a/abjad/parentage.py +++ b/abjad/parentage.py @@ -765,9 +765,9 @@ def count(self, prototype=None) -> int: r""" Gets number of ``prototype`` in parentage. - .. container:: example + Gets tuplet count: - Gets tuplet count: + .. container:: example >>> staff = abjad.Staff( ... r"\times 2/3 { c'2 \times 2/3 { d'8 e' f' } } \times 2/3 { c'4 d' e' }" @@ -1254,9 +1254,9 @@ def logical_voice(self) -> dict: r""" Gets logical voice. - .. container:: example + Gets logical voice of note: - Gets logical voice of note: + .. container:: example >>> voice = abjad.Voice("c'4 d'4 e'4 f'4", name="MusicVoice") >>> staff = abjad.Staff([voice], name="Music_Staff") diff --git a/abjad/pcollections.py b/abjad/pcollections.py index e194cbe08d..6cd06e4b89 100644 --- a/abjad/pcollections.py +++ b/abjad/pcollections.py @@ -327,9 +327,9 @@ def get_normal_order(self) -> "PitchClassSegment": """ Gets normal order. - .. container:: example + Gets normal order of empty pitch-class set: - Gets normal order of empty pitch-class set: + .. container:: example >>> pc_set = abjad.PitchClassSet() >>> pc_set.get_normal_order() @@ -385,9 +385,9 @@ def get_prime_form(self, transposition_only=False) -> "PitchClassSet": """ Gets prime form. - .. container:: example + Gets prime form of empty pitch-class set: - Gets prime form of empty pitch-class set: + .. container:: example >>> pc_set = abjad.PitchClassSet() >>> pc_set.get_prime_form() @@ -658,9 +658,9 @@ def __contains__(self, argument) -> bool: """ Is true when pitch range contains ``argument``. - .. container:: example + Closed / closed range: - Closed / closed range: + .. container:: example >>> range_ = abjad.PitchRange("[A0, C8]") @@ -2289,9 +2289,9 @@ def __mul__(self, argument) -> "PitchClassSegment": r""" Multiplies row by ``argument``. - .. container:: example + Multiplies row: - Multiplies row: + .. container:: example >>> row = abjad.TwelveToneRow() >>> lilypond_file = abjad.illustrate(row) @@ -2392,9 +2392,9 @@ def __rmul__(self, argument) -> "PitchClassSegment": r""" Multiplies ``argument`` by row. - .. container:: example + Multiplies integer by row: - Multiplies integer by row: + .. container:: example >>> row = abjad.TwelveToneRow() >>> lilypond_file = abjad.illustrate(row) @@ -2507,9 +2507,9 @@ def count(self, item) -> int: """ Counts ``item`` in row. - .. container:: example + Example row: - Example row: + .. container:: example >>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0] >>> row = abjad.TwelveToneRow(numbers) @@ -2575,9 +2575,9 @@ def invert(self, axis=None) -> "TwelveToneRow": r""" Inverts row about optional ``axis``. - .. container:: example + Example row: - Example row: + .. container:: example >>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0] >>> row = abjad.TwelveToneRow(numbers) @@ -2725,9 +2725,9 @@ def multiply(self, n=1) -> "TwelveToneRow": r""" Multiplies pitch-classes in row by ``n``. - .. container:: example + Example row: - Example row: + .. container:: example >>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0] >>> row = abjad.TwelveToneRow(numbers) @@ -2834,9 +2834,9 @@ def retrograde(self) -> "TwelveToneRow": r""" Gets retrograde of row. - .. container:: example + Example row: - Example row: + .. container:: example >>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0] >>> row = abjad.TwelveToneRow(numbers) @@ -2915,9 +2915,9 @@ def rotate(self, n=0) -> "TwelveToneRow": r""" Rotates row by index ``n``. - .. container:: example + Example row: - Example row: + .. container:: example >>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0] >>> row = abjad.TwelveToneRow(numbers) @@ -3027,9 +3027,9 @@ def transpose(self, n=0) -> "TwelveToneRow": r""" Transposes row by index ``n``. - .. container:: example + Example row: - Example row: + .. container:: example >>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0] >>> row = abjad.TwelveToneRow(numbers) diff --git a/abjad/pitch.py b/abjad/pitch.py index 8b9c1d9ea9..4485bc3f65 100644 --- a/abjad/pitch.py +++ b/abjad/pitch.py @@ -5065,9 +5065,9 @@ def invert(self, axis=None) -> "NamedPitch": """ Inverts named pitch around ``axis``. - .. container:: example + Inverts pitch around middle C explicitly: - Inverts pitch around middle C explicitly: + .. container:: example >>> abjad.NamedPitch("d'").invert("c'") NamedPitch('bf') @@ -5190,9 +5190,9 @@ def transpose(self, n=0) -> "NamedPitch": """ Transposes named pitch by index ``n``. - .. container:: example + Transposes C4 up a minor second: - Transposes C4 up a minor second: + .. container:: example >>> abjad.NamedPitch("c'").transpose(n="m2") NamedPitch("df'") @@ -5615,9 +5615,9 @@ def interpolate(self, stop_pitch, fraction) -> "NumberedPitch": """ Interpolates between numbered pitch and ``stop_pitch`` by ``fraction``. - .. container:: example + Interpolates from C4 to C5: - Interpolates from C4 to C5: + .. container:: example >>> start_pitch = abjad.NumberedPitch(0) >>> stop_pitch = abjad.NumberedPitch(12) @@ -5677,9 +5677,9 @@ def invert(self, axis=None) -> "NumberedPitch": """ Inverts numbered pitch around ``axis``. - .. container:: example + Inverts pitch-class about pitch-class 0 explicitly: - Inverts pitch-class about pitch-class 0 explicitly: + .. container:: example >>> abjad.NumberedPitch(2).invert(0) NumberedPitch(-2) diff --git a/abjad/rhythmtrees.py b/abjad/rhythmtrees.py index 1c546a5206..7f38bd86b6 100644 --- a/abjad/rhythmtrees.py +++ b/abjad/rhythmtrees.py @@ -900,9 +900,9 @@ def parse_rtm_syntax(string: str) -> _score.Container | _score.Leaf | _score.Tup Creates rhythm tree from RTM ``string``; then calls rhythm tree on quarter-note pulse duration. - .. container:: example + A single quarter note: - A single quarter note: + .. container:: example >>> result = abjad.rhythmtrees.parse_rtm_syntax("1") >>> result diff --git a/abjad/score.py b/abjad/score.py index 451dbddb45..cd73b1caf5 100644 --- a/abjad/score.py +++ b/abjad/score.py @@ -1528,9 +1528,9 @@ def append(self, component: Component, *, language: str = "english") -> None: r""" Appends ``component`` to container. - .. container:: example + Appends note to container: - Appends note to container: + .. container:: example >>> container = abjad.Container("c'4 ( d'4 f'4 )") >>> abjad.show(container) # doctest: +SKIP @@ -1575,9 +1575,9 @@ def extend(self, argument, *, language: str = "english") -> None: r""" Extends container with ``argument``. - .. container:: example + Extends container with three notes: - Extends container with three notes: + .. container:: example >>> container = abjad.Container("c'4 ( d'4 f'4 )") >>> abjad.show(container) # doctest: +SKIP @@ -1625,9 +1625,9 @@ def index(self, component) -> int: r""" Returns index of ``component`` in container. - .. container:: example + Gets index of last element in container: - Gets index of last element in container: + .. container:: example >>> container = abjad.Container("c'4 d'4 f'4 e'4") >>> abjad.show(container) # doctest: +SKIP @@ -1663,9 +1663,9 @@ def insert( r""" Inserts ``component`` at index ``i`` in container. - .. container:: example + Inserts note. - Inserts note. + .. container:: example >>> container = abjad.Container([]) >>> container.extend("fs16 cs' e' a'") @@ -1735,9 +1735,9 @@ def pop(self, i: int = -1) -> Component: r""" Pops component from container at index ``i``. - .. container:: example + Pops last element from container: - Pops last element from container: + .. container:: example >>> container = abjad.Container("c'4 ( d'4 f'4 ) e'4") >>> abjad.show(container) # doctest: +SKIP @@ -1781,9 +1781,9 @@ def remove(self, component: Component) -> None: r""" Removes ``component`` from container. - .. container:: example + Removes note from container: - Removes note from container: + .. container:: example >>> container = abjad.Container("c'4 d'4 f'4 e'4") >>> abjad.show(container) # doctest: +SKIP @@ -3928,9 +3928,9 @@ def get(self, pitch) -> NoteHead: r""" Gets note-head by ``pitch``. - .. container:: example + Gets note-head by pitch name: - Gets note-head by pitch name: + .. container:: example >>> chord = abjad.Chord("4") >>> abjad.show(chord) # doctest: +SKIP @@ -5774,9 +5774,9 @@ def append( r""" Appends ``component`` to tuplet. - .. container:: example + Appends note to tuplet: - Appends note to tuplet: + .. container:: example >>> tuplet = abjad.Tuplet((2, 3), "c'4 ( d'4 f'4 )") >>> abjad.show(tuplet) # doctest: +SKIP @@ -5863,9 +5863,9 @@ def augmentation(self) -> bool: r""" Is true when tuplet multiplier is greater than ``1``. - .. container:: example + Augmented tuplet: - Augmented tuplet: + .. container:: example >>> tuplet = abjad.Tuplet((4, 3), "c'8 d'8 e'8") >>> abjad.show(tuplet) # doctest: +SKIP @@ -5903,9 +5903,9 @@ def diminution(self) -> bool: r""" Is true when tuplet multiplier is less than ``1``. - .. container:: example + Augmented tuplet: - Augmented tuplet: + .. container:: example >>> tuplet = abjad.Tuplet((4, 3), "c'8 d'8 e'8") >>> abjad.show(tuplet) # doctest: +SKIP @@ -5945,9 +5945,9 @@ def extend( r""" Extends tuplet with ``argument``. - .. container:: example + Extends tuplet with three notes: - Extends tuplet with three notes: + .. container:: example >>> tuplet = abjad.Tuplet((2, 3), "c'4 ( d'4 f'4 )") >>> abjad.show(tuplet) # doctest: +SKIP @@ -6043,9 +6043,9 @@ def from_duration( r""" Makes tuplet from ``duration`` and ``components``. - .. container:: example + Makes diminution: - Makes diminution: + .. container:: example >>> tuplet = abjad.Tuplet.from_duration((2, 8), "c'8 d' e'") >>> abjad.show(tuplet) # doctest: +SKIP @@ -6236,9 +6236,9 @@ def rewrite_dots(self) -> None: r""" Rewrites dots. - .. container:: example + Rewrites single dots as 3:2 prolation: - Rewrites single dots as 3:2 prolation: + .. container:: example >>> tuplet = abjad.Tuplet((1, 1), "c'8. c'8.") >>> abjad.show(tuplet) # doctest: +SKIP @@ -6393,9 +6393,9 @@ def set_minimum_denominator(self, denominator) -> None: r""" Sets preferred denominator of tuplet to at least ``denominator``. - .. container:: example + Sets preferred denominator of tuplet to ``8`` at least: - Sets preferred denominator of tuplet to ``8`` at least: + .. container:: example >>> tuplet = abjad.Tuplet((3, 5), "c'4 d'8 e'8 f'4 g'2") >>> abjad.show(tuplet) # doctest: +SKIP @@ -6446,9 +6446,9 @@ def toggle_prolation(self) -> None: r""" Changes augmented tuplets to diminished; changes diminished tuplets to augmented. - .. container:: example + Changes augmented tuplet to diminished: - Changes augmented tuplet to diminished: + .. container:: example >>> tuplet = abjad.Tuplet((4, 3), "c'8 d'8 e'8") >>> abjad.show(tuplet) # doctest: +SKIP @@ -6635,9 +6635,9 @@ def trivializable(self) -> bool: r""" Is true when tuplet is trivializable (can be rewritten with a ratio of 1:1). - .. container:: example + Redudant tuplet: - Redudant tuplet: + .. container:: example >>> tuplet = abjad.Tuplet((3, 4), "c'4 c'4") >>> abjad.attach(abjad.TimeSignature((3, 8)), tuplet[0]) diff --git a/abjad/select.py b/abjad/select.py index cba7c6922a..6a9fc59ac6 100644 --- a/abjad/select.py +++ b/abjad/select.py @@ -253,9 +253,9 @@ def chord( r""" Selects chord ``n`` in ``argument``. - .. container:: example + Selects chord -1: - Selects chord -1: + .. container:: example >>> tuplets = [ ... "r16 bf'16 16 c'16 4 ~ 16", @@ -340,9 +340,9 @@ def chords( r""" Selects chords in ``argument``. - .. container:: example + Selects chords: - Selects chords: + .. container:: example >>> tuplets = [ ... "r16 bf'16 16 c'16 4 ~ 16", @@ -455,9 +455,9 @@ def components( r""" Selects components. - .. container:: example + Selects notes: - Selects notes: + .. container:: example >>> staff = abjad.Staff("c'4 d'8 ~ d'16 e'16 ~ e'8 r4 g'8") >>> abjad.setting(staff).autoBeaming = False @@ -682,9 +682,9 @@ def exclude(argument, indices: typing.Sequence[int], period: int | None = None) r""" Excludes items at ``indices`` by ``period``. - .. container:: example + Excludes every other leaf: - Excludes every other leaf: + .. container:: example >>> string = r"c'8 d'8 ~ d'8 e'8 ~ e'8 ~ e'8 r8 f'8" >>> staff = abjad.Staff(string) @@ -837,9 +837,9 @@ def filter(argument, predicate=None) -> list: r""" Filters ``argument`` by ``predicate``. - .. container:: example + Selects runs with duration equal to 2/8: - Selects runs with duration equal to 2/8: + .. container:: example >>> staff = abjad.Staff("c'8 r8 d'8 e'8 r8 f'8 g'8 a'8") >>> abjad.setting(staff).autoBeaming = False @@ -890,9 +890,9 @@ def flatten(argument, depth: int = 1) -> list: r""" Flattens ``argument``. - .. container:: example + Selects first two leaves of each tuplet: - Selects first two leaves of each tuplet: + .. container:: example >>> tuplets = [ ... "r16 bf'16 16 c'16 4 ~ 16", @@ -1081,9 +1081,9 @@ def get( r""" Gets items in ``argument`` at ``indices`` according to ``period``. - .. container:: example + Gets every other leaf: - Gets every other leaf: + .. container:: example >>> string = r"c'8 d'8 ~ d'8 e'8 ~ e'8 ~ e'8 r8 f'8" >>> staff = abjad.Staff(string) @@ -1308,9 +1308,9 @@ def group_by(argument, predicate=None) -> list[list]: r''' Groups items in ``argument`` by ``predicate``. - .. container:: example + Wraps selection in selection when ``predicate`` is none: - Wraps selection in selection when ``predicate`` is none: + .. container:: example >>> staff = abjad.Staff(r""" ... c'8 ~ c'16 c'16 r8 c'16 c'16 @@ -1382,9 +1382,9 @@ def group_by_contiguity(argument) -> list[list]: r''' Groups items in ``argument`` by contiguity. - .. container:: example + Groups pitched leaves by contiguity: - Groups pitched leaves by contiguity: + .. container:: example >>> string = r"c'8 d' r \times 2/3 { e' r f' } g' a' r" >>> staff = abjad.Staff(string) @@ -1689,9 +1689,9 @@ def group_by_duration(argument) -> list[list]: r""" Groups items in ``argument`` by duration. - .. container:: example + Groups logical ties by duration: - Groups logical ties by duration: + .. container:: example >>> string = "c'4 ~ c'16 d' ~ d' d' e'4 ~ e'16 f' ~ f' f'" >>> staff = abjad.Staff(string) @@ -1761,9 +1761,9 @@ def group_by_length(argument) -> list[list]: r""" Groups items in ``argument`` by length. - .. container:: example + Groups logical ties by length: - Groups logical ties by length: + .. container:: example >>> string = "c'4 ~ c'16 d' ~ d' d' e'4 ~ e'16 f' ~ f' f'" >>> staff = abjad.Staff(string) @@ -1833,9 +1833,9 @@ def group_by_measure(argument) -> list[list]: r""" Groups items in ``argument`` by measure. - .. container:: example + Groups leaves by measure: - Groups leaves by measure: + .. container:: example >>> staff = abjad.Staff("c'8 d' e' f' g' a' b' c''") >>> abjad.setting(staff).autoBeaming = False @@ -2194,9 +2194,9 @@ def group_by_pitch(argument) -> list[list]: r""" Groups items in ``argument`` by pitch. - .. container:: example + Groups logical ties by pitches: - Groups logical ties by pitches: + .. container:: example >>> string = "c'4 ~ c'16 d' ~ d' d' e'4 ~ e'16 f' ~ f' f'" >>> staff = abjad.Staff(string) @@ -2277,9 +2277,9 @@ def leaf( r""" Selects leaf ``n` in ``argument``. - .. container:: example + Selects leaf -1: - Selects leaf -1: + .. container:: example >>> tuplets = [ ... "r16 bf'16 16 c'16 4 ~ 16", @@ -3367,9 +3367,9 @@ def logical_ties( r''' Selects logical ties in ``argument``. - .. container:: example + Selects logical ties: - Selects logical ties: + .. container:: example >>> staff = abjad.Staff("c'8 d' ~ { d' e' r f'~ } f' r") >>> abjad.setting(staff).autoBeaming = False @@ -3841,9 +3841,9 @@ def nontrivial(argument) -> list: r""" Selects nontrivial items in ``argument``. - .. container:: example + Selects nontrivial runs: - Selects nontrivial runs: + .. container:: example >>> staff = abjad.Staff("c'8 r8 d'8 e'8 r8 f'8 g'8 a'8") >>> abjad.setting(staff).autoBeaming = False @@ -3900,9 +3900,9 @@ def note( r""" Selects note ``n`` in ``argument``. - .. container:: example + Selects note -1: - Selects note -1: + .. container:: example >>> tuplets = [ ... "r16 bf'16 16 c'16 4 ~ 16", @@ -3987,9 +3987,9 @@ def notes( r""" Selects notes in ``argument``. - .. container:: example + Selects notes: - Selects notes: + .. container:: example >>> tuplets = [ ... "r16 bf'16 16 c'16 4 ~ 16", @@ -4097,9 +4097,9 @@ def partition_by_counts( r""" Partitions items in ``argument`` by ``counts``. - .. container:: example + Partitions leaves into a single part of length 3; truncates overhang: - Partitions leaves into a single part of length 3; truncates overhang: + .. container:: example >>> staff = abjad.Staff("c'8 r8 d'8 e'8 r8 f'8 g'8 a'8") >>> abjad.setting(staff).autoBeaming = False @@ -4578,10 +4578,10 @@ def partition_by_durations( r""" Partitions items in ``argument`` by ``durations``. - .. container:: example + Cyclically partitions leaves into parts equal to exactly 3/8; returns + overhang at end: - Cyclically partitions leaves into parts equal to exactly 3/8; returns - overhang at end: + .. container:: example >>> staff = abjad.Staff([ ... abjad.Container("c'8 d'"), @@ -5434,9 +5434,9 @@ def partition_by_ratio(argument, ratio) -> list[list]: r""" Partitions items in ``argument`` by ``ratio``. - .. container:: example + Partitions leaves by a ratio of 1:1: - Partitions leaves by a ratio of 1:1: + .. container:: example >>> string = r"c'8 d' r \times 2/3 { e' r f' } g' a' r" >>> staff = abjad.Staff(string) @@ -5559,9 +5559,9 @@ def rest( r""" Selects rest ``n`` in ``argument``. - .. container:: example + Selects rest -1: - Selects rest -1: + .. container:: example >>> tuplets = [ ... "r16 bf'16 16 c'16 4 ~ 16", @@ -5646,9 +5646,9 @@ def rests( r""" Selects rests in ``argument``. - .. container:: example + Selects rests: - Selects rests: + .. container:: example >>> tuplets = [ ... "r16 bf'16 16 c'16 4 ~ 16", @@ -5744,9 +5744,9 @@ def run( r""" Selects run ``n`` in ``argument``. - .. container:: example + Selects run -1: - Selects run -1: + .. container:: example >>> tuplets = [ ... "r16 c'16 c'16 c'16 4 ~ 16", @@ -5835,9 +5835,9 @@ def runs( r""" Selects runs in ``argument``. - .. container:: example + Selects runs: - Selects runs: + .. container:: example >>> tuplets = [ ... "r16 c'16 c'16 c'16 4 ~ 16", @@ -6034,9 +6034,9 @@ def top(argument, *, exclude: _typings.Exclude | None = None) -> list[_score.Com r""" Selects top components in ``argument``. - .. container:: example + Selects top components (up from leaves): - Selects top components (up from leaves): + .. container:: example >>> string = r"c'8 d' r \times 2/3 { e' r f' } g' a' r" >>> staff = abjad.Staff(string) @@ -6114,9 +6114,9 @@ def tuplet( r""" Selects tuplet ``n`` in ``argument``. - .. container:: example + Selects tuplet -1: - Selects tuplet -1: + .. container:: example >>> tuplets = [ ... "r16 bf'16 16 c'16 4 ~ 16", @@ -6206,9 +6206,9 @@ def tuplets( r""" Selects tuplets in ``argument``. - .. container:: example + Selects tuplets at every level: - Selects tuplets at every level: + .. container:: example >>> staff = abjad.Staff( ... r"\times 2/3 { c'2 \times 2/3 { d'8 e' f' } } \times 2/3 { c'4 d' e' }" @@ -6395,9 +6395,9 @@ def with_next_leaf(argument, *, grace: bool | None = None) -> list[_score.Leaf]: r""" Extends ``argument`` with next leaf. - .. container:: example + Selects runs (each with next leaf): - Selects runs (each with next leaf): + .. container:: example >>> staff = abjad.Staff("c'8 r8 d'8 e'8 r8 f'8 g'8 a'8") >>> abjad.setting(staff).autoBeaming = False @@ -6677,9 +6677,9 @@ def with_previous_leaf(argument) -> list[_score.Leaf]: r""" Extends ``argument`` with previous leaf. - .. container:: example + Selects runs (each with previous leaf): - Selects runs (each with previous leaf): + .. container:: example >>> staff = abjad.Staff("c'8 r8 d'8 e'8 r8 f'8 g'8 a'8") >>> abjad.setting(staff).autoBeaming = False diff --git a/abjad/sequence.py b/abjad/sequence.py index c64e95db3a..f6108be6cd 100644 --- a/abjad/sequence.py +++ b/abjad/sequence.py @@ -148,9 +148,9 @@ def partition_by_counts( r""" Partitions sequence by ``counts``. - .. container:: example + Partitions sequence once by counts without overhang: - Partitions sequence once by counts without overhang: + .. container:: example >>> sequence = list(range(16)) >>> sequence = abjad.sequence.partition_by_counts( @@ -639,9 +639,9 @@ def partition_by_ratio_of_lengths(sequence, ratio: tuple[int, ...]) -> list: r""" Partitions sequence by ``ratio`` of lengths. - .. container:: example + Partitions sequence by ``1:1:1`` ratio: - Partitions sequence by ``1:1:1`` ratio: + .. container:: example >>> numbers = list(range(10)) >>> ratio = (1, 1, 1) @@ -1096,9 +1096,9 @@ def split(sequence, weights, *, cyclic=False, overhang=False) -> list: r""" Splits sequence by ``weights``. - .. container:: example + Splits sequence cyclically by weights with overhang: - Splits sequence cyclically by weights with overhang: + .. container:: example >>> sequence = list([10, -10, 10, -10]) @@ -1382,9 +1382,9 @@ def is_decreasing(sequence, *, strict=True) -> bool: """ Is true when sequence decreases. - .. container:: example + Is true when sequence is strictly decreasing: - Is true when sequence is strictly decreasing: + .. container:: example >>> abjad.sequence.is_decreasing([5, 4, 3, 2, 1, 0], strict=True) True @@ -1443,9 +1443,9 @@ def is_increasing(sequence, *, strict=True) -> bool: """ Is true when sequence increases. - .. container:: example + Is true when sequence is strictly increasing: - Is true when sequence is strictly increasing: + .. container:: example >>> abjad.sequence.is_increasing([0, 1, 2, 3, 4, 5], strict=True) True @@ -1504,9 +1504,9 @@ def is_permutation(sequence, *, length=None) -> bool: """ Is true when sequence is a permutation. - .. container:: example + Is true when sequence is a permutation: - Is true when sequence is a permutation: + .. container:: example >>> abjad.sequence.is_permutation([4, 5, 0, 3, 2, 1]) True @@ -1524,9 +1524,9 @@ def is_repetition_free(sequence) -> bool: """ Is true when sequence is repetition-free. - .. container:: example + Is true when sequence is repetition-free: - Is true when sequence is repetition-free: + .. container:: example >>> abjad.sequence.is_repetition_free([0, 1, 2, 6, 7, 8]) True @@ -1579,9 +1579,9 @@ def nwise(sequence, n=2, *, cyclic=False, wrapped=False) -> typing.Iterator: """ Iterates ``sequence`` ``n`` at a time. - .. container:: example + Iterates iterable by pairs: - Iterates iterable by pairs: + .. container:: example >>> sequence = list(range(10)) >>> for item in abjad.sequence.nwise(sequence): @@ -2414,9 +2414,9 @@ def zip(sequences, *, cyclic=False, truncate=True) -> list[tuple]: """ Zips sequences in sequence. - .. container:: example + Zips cyclically: - Zips cyclically: + .. container:: example >>> sequence = list([[1, 2, 3], ['a', 'b']]) >>> for item in abjad.sequence.zip(sequence, cyclic=True): diff --git a/abjad/setclass.py b/abjad/setclass.py index bd09772870..9a89ba628c 100644 --- a/abjad/setclass.py +++ b/abjad/setclass.py @@ -1037,9 +1037,9 @@ def __str__(self) -> str: """ Gets string representation. - .. container:: example + Gets string of SG2 set-class with Forte rank: - Gets string of SG2 set-class with Forte rank: + .. container:: example >>> set_class = abjad.SetClass(4, 29) >>> print(set_class) diff --git a/abjad/spanners.py b/abjad/spanners.py index a6af82ab1e..f8143d0615 100644 --- a/abjad/spanners.py +++ b/abjad/spanners.py @@ -1157,9 +1157,9 @@ def hairpin( r""" Attaches hairpin indicators. - .. container:: example + With three-part string descriptor: - With three-part string descriptor: + .. container:: example >>> staff = abjad.Staff("c'4 d' e' f'") >>> abjad.hairpin("p < f", staff[:], direction=abjad.UP) @@ -1545,9 +1545,9 @@ def text_spanner( r""" Attaches text span indicators. - .. container:: example + Single spanner: - Single spanner: + .. container:: example >>> staff = abjad.Staff("c'4 d' e' f'") >>> start_text_span = abjad.StartTextSpan( diff --git a/abjad/string.py b/abjad/string.py index 8e4129c608..f441cd27a3 100644 --- a/abjad/string.py +++ b/abjad/string.py @@ -9,9 +9,9 @@ def capitalize_start(string: str) -> str: """ Capitalizes start of string. - .. container:: example + Capitalizes only ``string[0]``; leaves noninitial characters unchanged: - Capitalizes only ``string[0]``; leaves noninitial characters unchanged: + .. container:: example >>> abjad.string.capitalize_start("violin I") 'Violin I' @@ -351,9 +351,9 @@ def pluralize(string: str, count: int | None = None) -> str: """ Pluralizes English string. - .. container:: example + Changes terminal ``-y`` to ``-ies``: - Changes terminal ``-y`` to ``-ies``: + .. container:: example >>> abjad.string.pluralize('catenary') 'catenaries' diff --git a/abjad/tag.py b/abjad/tag.py index 530d15b0a5..efc3cd2005 100644 --- a/abjad/tag.py +++ b/abjad/tag.py @@ -227,9 +227,9 @@ def activate( r""" Activates ``tag`` in ``text``. - .. container:: example + Writes (deactivated) tag with ``"%@%"`` prefix into LilyPond input: - Writes (deactivated) tag with ``"%@%"`` prefix into LilyPond input: + .. container:: example >>> staff = abjad.Staff("c'4 d' e' f'") >>> markup = abjad.Markup(r"\markup { \with-color #red Allegro }") @@ -380,9 +380,9 @@ def deactivate( r""" Deactivates ``tag`` in ``text``. - .. container:: example + Writes (active) tag into LilyPond input: - Writes (active) tag into LilyPond input: + .. container:: example >>> staff = abjad.Staff("c'4 d' e' f'") >>> string = r"\markup { \with-color #red Allegro }" diff --git a/abjad/timespan.py b/abjad/timespan.py index a8b0e6dc87..1cc6110cc3 100644 --- a/abjad/timespan.py +++ b/abjad/timespan.py @@ -308,9 +308,9 @@ def __contains__(self, argument) -> bool: """ Is true when timespan contains ``argument``. - .. container:: example + Works with offsets: - Works with offsets: + .. container:: example >>> timespan = abjad.Timespan(0, (1, 4)) @@ -486,10 +486,10 @@ def __len__(self) -> int: return 1 def __lt__(self, argument) -> bool: - """ + r""" Is true when ``argument`` start offset is less than timespan start offset. - .. container::: example + .. container:: example >>> timespan_1 = abjad.Timespan(0, 10) >>> timespan_2 = abjad.Timespan(5, 12) @@ -1010,9 +1010,9 @@ def reflect(self, axis=None) -> "Timespan": """ Reflects timespan about ``axis``. - .. container:: example + Reverse timespan about timespan axis: - Reverse timespan about timespan axis: + .. container:: example >>> abjad.Timespan(3, 6).reflect() Timespan(Offset((3, 1)), Offset((6, 1))) @@ -1251,9 +1251,9 @@ def stretch(self, multiplier, anchor=None) -> "Timespan": """ Stretches timespan by ``multiplier`` relative to ``anchor``. - .. container:: example + Stretch relative to timespan start offset: - Stretch relative to timespan start offset: + .. container:: example >>> abjad.Timespan(3, 10).stretch(abjad.Fraction(2)) Timespan(Offset((3, 1)), Offset((17, 1))) @@ -1447,9 +1447,9 @@ def __and__(self, timespan) -> "TimespanList": """ Keeps material that intersects ``timespan``. - .. container:: example + Keeps material that intersects timespan: - Keeps material that intersects timespan: + .. container:: example >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 16), @@ -1810,9 +1810,9 @@ def __invert__(self) -> "TimespanList": """ Inverts timespans. - .. container:: example + Inverts timespans: - Inverts timespans: + .. container:: example >>> timespans = abjad.TimespanList([ ... abjad.Timespan(-2, 8), @@ -1853,9 +1853,9 @@ def __sub__(self, timespan) -> "TimespanList": """ Deletes material that intersects ``timespan``. - .. container:: example + Deletes material that intersects timespan: - Deletes material that intersects timespan: + .. container:: example >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 16), @@ -2366,9 +2366,9 @@ def clip_timespan_durations( """ Clips timespan durations. - .. container:: example + Clips timespan durations: - Clips timespan durations: + .. container:: example >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 1), @@ -2484,9 +2484,9 @@ def compute_logical_and(self) -> "TimespanList": """ Computes logical AND of timespans. - .. container:: example + Computes logical AND: - Computes logical AND: + .. container:: example >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 10), @@ -2556,8 +2556,6 @@ def compute_logical_or(self) -> "TimespanList": .. container:: example - Computes logical OR: - >>> timespans = abjad.TimespanList() >>> timespans = timespans.compute_logical_or() @@ -2566,8 +2564,6 @@ def compute_logical_or(self) -> "TimespanList": .. container:: example - Computes logical OR: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 10), ... ]) @@ -2579,11 +2575,8 @@ def compute_logical_or(self) -> "TimespanList": >>> for _ in timespans: _ Timespan(Offset((0, 1)), Offset((10, 1))) - .. container:: example - Computes logical OR: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 10), ... abjad.Timespan(5, 12), @@ -2596,11 +2589,8 @@ def compute_logical_or(self) -> "TimespanList": >>> for _ in timespans: _ Timespan(Offset((0, 1)), Offset((12, 1))) - .. container:: example - Computes logical OR: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 10), ... abjad.Timespan(5, 12), @@ -2614,11 +2604,8 @@ def compute_logical_or(self) -> "TimespanList": >>> for _ in timespans: _ Timespan(Offset((-2, 1)), Offset((12, 1))) - .. container:: example - Computes logical OR: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(-2, 2), ... abjad.Timespan(10, 20), @@ -2632,7 +2619,6 @@ def compute_logical_or(self) -> "TimespanList": Timespan(Offset((-2, 1)), Offset((2, 1))) Timespan(Offset((10, 1)), Offset((20, 1))) - Operates in place and returns timespan list. """ timespans: list[Timespan] = [] @@ -2653,8 +2639,6 @@ def compute_logical_xor(self) -> "TimespanList": .. container:: example - Computes logical XOR: - >>> timespans = abjad.TimespanList() >>> timespans = timespans.compute_logical_xor() @@ -2663,8 +2647,6 @@ def compute_logical_xor(self) -> "TimespanList": .. container:: example - Computes logical XOR: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 10), ... ]) @@ -2676,11 +2658,8 @@ def compute_logical_xor(self) -> "TimespanList": >>> for _ in timespans: _ Timespan(Offset((0, 1)), Offset((10, 1))) - .. container:: example - Computes logical XOR: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 10), ... abjad.Timespan(5, 12), @@ -2696,8 +2675,6 @@ def compute_logical_xor(self) -> "TimespanList": .. container:: example - Computes logical XOR: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 10), ... abjad.Timespan(5, 12), @@ -2713,11 +2690,8 @@ def compute_logical_xor(self) -> "TimespanList": Timespan(Offset((2, 1)), Offset((5, 1))) Timespan(Offset((10, 1)), Offset((12, 1))) - .. container:: example - Computes logical XOR: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(-2, 2), ... abjad.Timespan(10, 20), @@ -2733,8 +2707,6 @@ def compute_logical_xor(self) -> "TimespanList": .. container:: example - Computes logical XOR: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 10), ... abjad.Timespan(4, 8), @@ -2749,11 +2721,8 @@ def compute_logical_xor(self) -> "TimespanList": Timespan(Offset((0, 1)), Offset((2, 1))) Timespan(Offset((8, 1)), Offset((10, 1))) - .. container:: example - Computes logical XOR: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 10), ... abjad.Timespan(0, 10), @@ -2790,9 +2759,9 @@ def compute_overlap_factor(self, timespan=None) -> fractions.Fraction: """ Computes overlap factor of timespans. - .. container:: example + Example timespan list: - Example timespan list: + .. container:: example >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 10), @@ -2882,8 +2851,6 @@ def compute_overlap_factor_mapping(self) -> dict: .. container:: example - Computes overlap factor mapping: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 10), ... abjad.Timespan(5, 15), @@ -3015,9 +2982,9 @@ def explode(self, inventory_count=None) -> tuple["TimespanList", ...]: Explodes timespans into timespan lists, avoiding overlap, and distributing density as evenly as possible. - .. container:: example + Example timespan list: - Example timespan list: + .. container:: example >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 3), @@ -3145,8 +3112,6 @@ def get_timespan_that_satisfies_time_relation(self, time_relation): .. container:: example - Gets timespan: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 3), ... abjad.Timespan(3, 6), @@ -3187,8 +3152,6 @@ def get_timespans_that_satisfy_time_relation(self, time_relation) -> "TimespanLi .. container:: example - Gets timespans: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 3), ... abjad.Timespan(3, 6), @@ -3246,8 +3209,6 @@ def partition(self, include_tangent_timespans=False) -> tuple["TimespanList", .. .. container:: example - Partitions timespans: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 3), ... abjad.Timespan(3, 6), @@ -3355,9 +3316,9 @@ def reflect(self, axis=None) -> "TimespanList": """ Reflects timespans. - .. container:: example + Reflects timespans about timespan list axis: - Reflects timespans about timespan list axis: + .. container:: example >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 3), @@ -3411,8 +3372,6 @@ def remove_degenerate_timespans(self) -> "TimespanList": .. container:: example - Removes degenerate timespans: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(5, 5), ... abjad.Timespan(5, 10), @@ -3439,8 +3398,6 @@ def repeat_to_stop_offset(self, stop_offset) -> "TimespanList": .. container:: example - Repeats timespans to stop offset: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 3), ... abjad.Timespan(3, 6), @@ -3479,9 +3436,9 @@ def rotate(self, count) -> "TimespanList": """ Rotates by ``count`` contiguous timespans. - .. container:: example + Rotates by one timespan to the left: - Rotates by one timespan to the left: + .. container:: example >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 3), @@ -3554,8 +3511,6 @@ def round_offsets( .. container:: example - Rounds offsets: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 2), ... abjad.Timespan(3, 6), @@ -3573,8 +3528,6 @@ def round_offsets( .. container:: example - Rounds offsets: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 2), ... abjad.Timespan(3, 6), @@ -3592,8 +3545,6 @@ def round_offsets( .. container:: example - Rounds offsets: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 2), ... abjad.Timespan(3, 6), @@ -3614,8 +3565,6 @@ def round_offsets( .. container:: example - Rounds offsets: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 2), ... abjad.Timespan(3, 6), @@ -3651,9 +3600,9 @@ def scale(self, multiplier, anchor=_enums.LEFT) -> "TimespanList": """ Scales timespan by ``multiplier`` relative to ``anchor``. - .. container:: example + Scales timespans relative to timespan list start offset: - Scales timespans relative to timespan list start offset: + .. container:: example >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 3), @@ -3704,8 +3653,6 @@ def split_at_offset(self, offset) -> tuple["TimespanList", "TimespanList"]: .. container:: example - Splits at offset: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 3), ... abjad.Timespan(3, 6), @@ -3795,8 +3742,6 @@ def split_at_offsets(self, offsets) -> list["TimespanList"]: .. container:: example - Splits at offsets: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 3), ... abjad.Timespan(3, 6), @@ -3838,8 +3783,6 @@ def stretch(self, multiplier, anchor=None) -> "TimespanList": .. container:: example - Stretches timespans relative to timespan list start offset: - >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 3), ... abjad.Timespan(3, 6), @@ -3889,9 +3832,9 @@ def translate(self, translation=None) -> "TimespanList": """ Translates timespans by ``translation``. - .. container:: example + Translates timespan by offset ``50``: - Translates timespan by offset ``50``: + .. container:: example >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 3), @@ -3919,9 +3862,9 @@ def translate_offsets( Translates timespans by ``start_offset_translation`` and ``stop_offset_translation``. - .. container:: example + Translates timespan start- and stop-offsets equally: - Translates timespan start- and stop-offsets equally: + .. container:: example >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 3), @@ -3938,9 +3881,9 @@ def translate_offsets( Timespan(Offset((53, 1)), Offset((56, 1))) Timespan(Offset((56, 1)), Offset((60, 1))) - .. container:: example + Translates timespan stop-offsets only: - Translates timespan stop-offsets only: + .. container:: example >>> timespans = abjad.TimespanList([ ... abjad.Timespan(0, 3), diff --git a/abjad/tweaks.py b/abjad/tweaks.py index 44467abe27..6e5c3fd26c 100644 --- a/abjad/tweaks.py +++ b/abjad/tweaks.py @@ -170,9 +170,9 @@ def bundle( r""" Bundles ``indicator`` with ``tweaks``. - .. container:: example + Bundles indicator: - Bundles indicator: + .. container:: example >>> staff = abjad.Staff("c'4 d' e' f'") >>> bundle = abjad.bundle( diff --git a/abjad/wf.py b/abjad/wf.py index fdfd548212..5401456e6b 100644 --- a/abjad/wf.py +++ b/abjad/wf.py @@ -32,9 +32,9 @@ def check_beamed_long_notes(argument) -> tuple[list, int]: r""" Checks beamed long notes. - .. container:: example + Beamed quarter notes are not wellformed: - Beamed quarter notes are not wellformed: + .. container:: example >>> voice = abjad.Voice("c'4 d'4 e'4 f'4") >>> abjad.attach(abjad.StartBeam(), voice[0]) @@ -333,9 +333,9 @@ def check_out_of_range_pitches( r""" Checks out-of-range notes. - .. container:: example + Out of range: - Out of range: + .. container:: example >>> staff = abjad.Staff("c'8 r8 8 r8") >>> violin = abjad.Violin() @@ -427,9 +427,9 @@ def check_overlapping_text_spanners(argument) -> tuple[list, int]: r""" Checks overlapping text spanners. - .. container:: example + Overlapping text spanners are not wellformed: - Overlapping text spanners are not wellformed: + .. container:: example >>> voice = abjad.Voice("c'4 c'4 c'4 c'4") >>> abjad.text_spanner(voice) @@ -614,9 +614,9 @@ def check_unmatched_stop_text_spans(argument) -> tuple[list, int]: r""" Checks unmatched stop text spans. - .. container:: example + Unmatched stop text span is not wellformed: - Unmatched stop text span is not wellformed: + .. container:: example >>> voice = abjad.Voice("c'4 c'4 c'4 c'4") >>> stop_text_span = abjad.StopTextSpan() @@ -701,9 +701,9 @@ def check_unterminated_hairpins(argument) -> tuple[list, int]: r""" Checks unterminated hairpins. - .. container:: example + Unterminated crescendo is not wellformed: - Unterminated crescendo is not wellformed: + .. container:: example >>> voice = abjad.Voice("c'4 c'4 c'4 c'4") >>> start_hairpin = abjad.StartHairpin('<') @@ -846,9 +846,9 @@ def check_unterminated_text_spanners(argument) -> tuple[list, int]: r""" Checks unterminated text spanners. - .. container:: example + Unterminated text spanner is not wellformed: - Unterminated text spanner is not wellformed: + .. container:: example >>> voice = abjad.Voice("c'4 c'4 c'4 c'4") >>> start_text_span = abjad.StartTextSpan()