Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Clean up docstrings #1605

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions abjad/contextmanagers.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ def __enter__(self) -> "ForbidUpdate":
r"""
Enters context manager.

REGRESSION. Indicators need to be updated after swap; context manager
updates indicators before forbidding further updates:

.. container:: example

REGRESSION. Indicators need to be updated after swap; context
manager updates indicators before forbidding further updates:

>>> staff = abjad.Staff(r"\times 1/1 { c'4 d' }")
>>> abjad.attach(abjad.Clef("alto"), staff[0][0])
>>> container = abjad.Container()
Expand Down
8 changes: 4 additions & 4 deletions abjad/cyclictuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,19 @@ def __getitem__(self, argument) -> typing.Any:
"""
Gets item or slice identified by ``argument``.

Gets slice open at right:

.. container:: example

Gets slice open at right:

>>> items = [0, 1, 2, 3, 4, 5]
>>> tuple_ = abjad.CyclicTuple(items=items)
>>> tuple_[2:]
(2, 3, 4, 5)

Gets slice closed at right:

.. container:: example

Gets slice closed at right:

>>> items = [0, 1, 2, 3, 4, 5]
>>> tuple_ = abjad.CyclicTuple(items=items)
>>> tuple_[:15]
Expand Down
24 changes: 12 additions & 12 deletions abjad/duration.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ def __ne__(self, argument) -> bool:

See https://bugs.python.org/issue4395#msg89533.

REGRESSION:

.. container:: example

REGRESSION:

>>> offset_1 = abjad.Offset(1)
>>> offset_2 = abjad.Offset(1, displacement=(-1, 16))

Expand Down Expand Up @@ -1066,10 +1066,10 @@ def to_clock_string(self) -> str:
r"""
Changes duration to clock string.

Changes duration to clock string:

.. container:: example

Changes duration to clock string:

>>> note = abjad.Note("c'4")
>>> duration = abjad.Duration(117)
>>> clock_string = duration.to_clock_string()
Expand Down Expand Up @@ -1292,10 +1292,10 @@ def __eq__(self, argument) -> bool:
"""
Is true when offset equals ``argument``.

With equal numerators, denominators and displacement:

.. container:: example

With equal numerators, denominators and displacement:

>>> offset_1 = abjad.Offset((1, 4), displacement=(-1, 16))
>>> offset_2 = abjad.Offset((1, 4), displacement=(-1, 16))

Expand Down Expand Up @@ -1351,10 +1351,10 @@ def __ge__(self, argument) -> bool:
"""
Is true when offset is greater than or equal to ``argument``.

With equal numerators, denominators and displacement:

.. container:: example

With equal numerators, denominators and displacement:

>>> offset_1 = abjad.Offset((1, 4), displacement=(-1, 16))
>>> offset_2 = abjad.Offset((1, 4), displacement=(-1, 16))

Expand Down Expand Up @@ -1410,10 +1410,10 @@ def __gt__(self, argument) -> bool:
"""
Is true when offset is greater than ``argument``.

With equal numerators, denominators and displacement:

.. container:: example

With equal numerators, denominators and displacement:

>>> offset_1 = abjad.Offset((1, 4), displacement=(-1, 16))
>>> offset_2 = abjad.Offset((1, 4), displacement=(-1, 16))

Expand Down Expand Up @@ -1475,10 +1475,10 @@ def __le__(self, argument) -> bool:
"""
Is true when offset is less than or equal to ``argument``.

With equal numerators, denominators and displacement:

.. container:: example

With equal numerators, denominators and displacement:

>>> offset_1 = abjad.Offset((1, 4), displacement=(-1, 16))
>>> offset_2 = abjad.Offset((1, 4), displacement=(-1, 16))

Expand Down
40 changes: 20 additions & 20 deletions abjad/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -1757,10 +1757,10 @@ def grace(argument) -> bool:
Grace music defined equal to grace container, after-grace container and
contents of those containers.

REGRESSION. Works with grace notes (and containers):

.. container:: example

REGRESSION. Works with grace notes (and containers):

>>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice")
>>> container = abjad.BeforeGraceContainer("cs'16")
>>> abjad.attach(container, music_voice[1])
Expand Down Expand Up @@ -1902,10 +1902,10 @@ def has_effective_indicator(
r"""
Is true when ``argument`` has effective indicator.

REGRESSION. Works with grace notes (and containers):

.. container:: example

REGRESSION. Works with grace notes (and containers):

>>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice")
>>> staff = abjad.Staff([music_voice])
>>> container = abjad.BeforeGraceContainer("cs'16")
Expand Down Expand Up @@ -2100,10 +2100,10 @@ def has_indicator(
r"""
Is true when ``argument`` has one or more indicators.

REGRESSION. Works with grace notes (and containers):

.. container:: example

REGRESSION. Works with grace notes (and containers):

>>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice")
>>> staff = abjad.Staff([music_voice])
>>> container = abjad.BeforeGraceContainer("cs'16")
Expand Down Expand Up @@ -2343,10 +2343,10 @@ def indicator(
r"""
Gets indicator.

REGRESSION. Works with grace notes (and containers):

.. container:: example

REGRESSION. Works with grace notes (and containers):

>>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice")
>>> staff = abjad.Staff([music_voice])
>>> container = abjad.BeforeGraceContainer("cs'16")
Expand Down Expand Up @@ -2494,10 +2494,10 @@ def indicators(
r"""
Get indicators.

REGRESSION. Works with grace notes (and containers):

.. container:: example

REGRESSION. Works with grace notes (and containers):

>>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice")
>>> staff = abjad.Staff([music_voice])
>>> container = abjad.BeforeGraceContainer("cs'16")
Expand Down Expand Up @@ -2987,10 +2987,10 @@ def lineage(argument) -> "Lineage":
r"""
Gets lineage.

REGRESSION. Works with grace notes (and containers):

.. container:: example

REGRESSION. Works with grace notes (and containers):

>>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice")
>>> container = abjad.BeforeGraceContainer("cs'16")
>>> abjad.attach(container, music_voice[1])
Expand Down Expand Up @@ -3191,10 +3191,10 @@ def logical_tie(argument) -> "_select.LogicalTie":
r"""
Gets logical tie.

REGRESSION. Works with grace notes (and containers):

.. container:: example

REGRESSION. Works with grace notes (and containers):

>>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice")
>>> container = abjad.BeforeGraceContainer("cs'16")
>>> abjad.attach(container, music_voice[1])
Expand Down Expand Up @@ -3383,10 +3383,10 @@ def measure_number(argument) -> int:
r"""
Gets measure number.

REGRESSION. Works with grace notes (and containers):

.. container:: example

REGRESSION. Works with grace notes (and containers):

>>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice")
>>> container = abjad.BeforeGraceContainer("cs'16")
>>> abjad.attach(container, music_voice[1])
Expand Down Expand Up @@ -3880,10 +3880,10 @@ def pitches(argument) -> set[_pitch.NamedPitch]:
r"""
Gets pitches.

REGRESSION. Works with grace notes (and containers):

.. container:: example

REGRESSION. Works with grace notes (and containers):

>>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice")
>>> container = abjad.BeforeGraceContainer("cs'16")
>>> abjad.attach(container, music_voice[1])
Expand Down Expand Up @@ -4138,10 +4138,10 @@ def timespan(argument, in_seconds: bool = False) -> _timespan.Timespan:
r"""
Gets timespan.

REGRESSION. Works with grace notes (and containers):

.. container:: example

REGRESSION. Works with grace notes (and containers):

>>> music_voice = abjad.Voice("c'4 d' e' f'", name="MusicVoice")
>>> container = abjad.BeforeGraceContainer("cs'16")
>>> abjad.attach(container, music_voice[1])
Expand Down
4 changes: 2 additions & 2 deletions abjad/indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,10 +952,10 @@ def to_staff_position(self, pitch) -> _pitch.StaffPosition:
r"""
Changes ``pitch`` to staff position.

Changes C#5 to absolute staff position:

.. container:: example

Changes C#5 to absolute staff position:

>>> pitch = abjad.NamedPitch("C#5")

>>> abjad.Clef("alto").to_staff_position(pitch)
Expand Down
16 changes: 8 additions & 8 deletions abjad/iterate.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ def leaves(
r"""
Iterates leaves in ``argument``.

Set ``exclude=<annotation>`` to exclude leaves with annotation:

.. container:: example

Set ``exclude=<annotation>`` to exclude leaves with annotation:

>>> staff = abjad.Staff()
>>> score = abjad.Score([staff], name="Score")
>>> staff.extend("<c' bf'>8 <g' a'>8")
Expand Down Expand Up @@ -488,10 +488,10 @@ def logical_ties(
r"""
Iterates logical ties in ``argument``.

Iterates logical ties:

.. container:: example

Iterates logical ties:

>>> string = r"c'4 ~ \times 2/3 { c'16 d'8 } e'8 f'4 ~ f'16"
>>> staff = abjad.Staff(string)
>>> abjad.show(staff) # doctest: +SKIP
Expand Down Expand Up @@ -840,10 +840,10 @@ def pitches(argument) -> typing.Iterator[_pitch.NamedPitch]:
r"""
Iterates pitches in ``argument``.

Iterates pitches in container:

.. container:: example

Iterates pitches in container:

>>> staff = abjad.Staff("c'8 d'8 e'8 f'8")
>>> abjad.show(staff) # doctest: +SKIP

Expand Down Expand Up @@ -937,10 +937,10 @@ def timeline(
r"""
Iterates leaves in ``argument`` in timeline order.

Timeline-iterates leaves:

.. container:: example

Timeline-iterates leaves:

>>> score = abjad.Score()
>>> score.append(abjad.Staff("c'4 d'4 e'4 f'4"))
>>> score.append(abjad.Staff("g'8 a'8 b'8 c''8"))
Expand Down
10 changes: 5 additions & 5 deletions abjad/makers.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,11 +706,11 @@ def make_notes(

Set ``durations`` to a single duration or a list of durations.

Cycles through ``pitches`` when the length of ``pitches`` is less than the length
of ``durations``:

.. container:: example

Cycles through ``pitches`` when the length of ``pitches`` is less than
the length of ``durations``:

>>> pitches = [0]
>>> durations = [(1, 16), (1, 8), (1, 8)]
>>> notes = abjad.makers.make_notes(pitches, durations)
Expand Down Expand Up @@ -930,10 +930,10 @@ def tuplet_from_duration_and_ratio(
r"""
Makes tuplet from ``duration`` and ``ratio``.

Makes tupletted leaves strictly without dots when all ``ratio`` equal ``1``:

.. container:: example

Makes tupletted leaves strictly without dots when all ``ratio`` equal ``1``:

>>> tuplet = abjad.makers.tuplet_from_duration_and_ratio(
... abjad.Duration(3, 16),
... (1, 1, 1, -1, -1),
Expand Down
12 changes: 6 additions & 6 deletions abjad/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,10 +583,10 @@ def integer_equivalent_number_to_integer(number) -> int | float:
"""
Changes integer-equivalent ``number`` to integer.

Returns integer-equivalent number as integer:

.. container:: example

Returns integer-equivalent number as integer:

>>> abjad.math.integer_equivalent_number_to_integer(17.0)
17

Expand All @@ -608,10 +608,10 @@ def integer_to_base_k_tuple(n, k) -> tuple[int, ...]:
"""
Changes nonnegative integer ``n`` to base-`k` tuple.

Gets base-10 digits of 1066:

.. container:: example

Gets base-10 digits of 1066:

>>> abjad.math.integer_to_base_k_tuple(1066, 10)
(1, 0, 6, 6)

Expand Down Expand Up @@ -1148,10 +1148,10 @@ def sign(n) -> int:
"""
Gets sign of ``n``.

Returns -1 on negative ``n``:

.. container:: example

Returns -1 on negative ``n``:

>>> abjad.math.sign(-96.2)
-1

Expand Down
Loading
Loading