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

Add typing to key.py #1289

Merged
merged 2 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pythonpylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ jobs:
- name: Type-check certain modules with mypy
run: |
mypy --follow-imports=silent music21/capella music21/common music21/corpus music21/features music21/figuredBass music21/humdrum music21/ipython21 music21/languageExcerpts music21/lily music21/mei music21/metadata music21/musedata music21/noteworthy music21/omr music21/romanText music21/test music21/vexflow
mypy --follow-imports=silent music21/articulations.py music21/bar.py music21/base.py music21/beam.py music21/clef.py music21/configure.py music21/defaults.py music21/derivation.py music21/duration.py music21/dynamics.py music21/editorial.py music21/environment.py music21/exceptions21.py music21/expressions.py music21/freezeThaw.py music21/harmony.py music21/instrument.py music21/interval.py music21/layout.py music21/percussion.py music21/prebase.py music21/repeat.py music21/roman.py music21/serial.py music21/sieve.py music21/sites.py music21/sorting.py music21/spanner.py music21/style.py music21/tablature.py music21/tempo.py music21/text.py music21/tie.py music21/tinyNotation.py music21/variant.py music21/voiceLeading.py music21/volpiano.py music21/volume.py
mypy --follow-imports=silent music21/articulations.py music21/bar.py music21/base.py music21/beam.py music21/clef.py music21/configure.py music21/defaults.py music21/derivation.py music21/duration.py music21/dynamics.py music21/editorial.py music21/environment.py music21/exceptions21.py music21/expressions.py music21/freezeThaw.py music21/harmony.py music21/instrument.py music21/interval.py music21/key.py music21/layout.py music21/percussion.py music21/prebase.py music21/repeat.py music21/roman.py music21/serial.py music21/sieve.py music21/sites.py music21/sorting.py music21/spanner.py music21/style.py music21/tablature.py music21/tempo.py music21/text.py music21/tie.py music21/tinyNotation.py music21/variant.py music21/voiceLeading.py music21/volpiano.py music21/volume.py
3 changes: 2 additions & 1 deletion music21/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# License: BSD, see license.txt
# ------------------------------------------------------------------------------
from fractions import Fraction
from typing import Union, TypeVar, TYPE_CHECKING, Iterable, Type
from typing import Union, TypeVar, TYPE_CHECKING, Iterable, Type, Literal

from music21.common.enums import OffsetSpecial

Expand All @@ -23,3 +23,4 @@
StreamType = TypeVar('StreamType', bound='music21.stream.Stream')
M21ObjType = TypeVar('M21ObjType', bound='music21.base.Music21Object')
ClassListType = Union[str, Iterable[str], Type[M21ObjType], Iterable[Type[M21ObjType]]]
StepName = Literal['C', 'D', 'E', 'F', 'G', 'A', 'B']
2 changes: 1 addition & 1 deletion music21/harmony.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def key(self):
>>> [str(p) for p in h1.pitches]
['D-2', 'F-2', 'A-2', 'C-3', 'E-3', 'G-3']

>>> h1.key = 'CM'
>>> h1.key = 'CM' # = C-Major
>>> [str(p) for p in h1.pitches]
['D-2', 'F-2', 'A-2', 'C-3', 'E-3', 'G-3']

Expand Down
Loading