Skip to content

Commit

Permalink
refactor: Change enums names
Browse files Browse the repository at this point in the history
  • Loading branch information
antscloud committed Jan 23, 2024
1 parent 39bb972 commit 4295242
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions docs/source/get-started/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ from fretboardgtr.notes_creators import ChordFromName

TUNING = ["E", "A", "D", "G", "B", "E"]
ROOT = "C"
QUALITY = Chord.MAJOR
QUALITY = ChordName.MAJOR

fingerings = (
ChordFromName(root=ROOT, quality=QUALITY).build().get_chord_fingerings(TUNING)
Expand Down Expand Up @@ -190,11 +190,11 @@ And so on.
```python
from fretboardgtr.fretboard import FretBoardConfig, FretBoard
from fretboardgtr.notes_creators import ScaleFromName
from fretboardgtr.constants import Mode
from fretboardgtr.constants import ModeName

TUNING = ["E", "A", "D", "G", "B", "E"]
ROOT = "A"
MODE = Mode.MINOR_PENTATONIC
MODE = ModeName.MINOR_PENTATONIC

scale_positions = (
ScaleFromName(root=ROOT, mode=MODE).build().get_scale_positions(TUNING, max_spacing=4)
Expand Down
18 changes: 9 additions & 9 deletions fretboardgtr/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from enum import Enum


class Mode(str, Enum):
class ModeName(str, Enum):
"""Makes it easier to list and select a mode.
One can use auto-completion Mode.MIXOLYDIAN can be used instead of
the 'Mixolydian' literal string.
One can use auto-completion ModeName.MIXOLYDIAN can be used instead
of the 'Mixolydian' literal string.
"""

AEOLIAN = "Aeolian"
Expand Down Expand Up @@ -78,13 +78,13 @@ class Mode(str, Enum):
}


class Chord(str, Enum):
class ChordName(str, Enum):
"""Makes it easier to list and select a chord.
One can use auto-completion Chord.MAJOR can be used instead of the 'M'
One can use auto-completion ChordName.MAJOR can be used instead of the 'M'
literal string.
Not every defined Chord from CHORDS_DICT_ESSENTIAL is defined as an
Not every defined ChordName from CHORDS_DICT_ESSENTIAL is defined as an
enum here, only the most common ones.
"""

Expand Down Expand Up @@ -187,11 +187,11 @@ class Chord(str, Enum):
}


class Note(str, Enum):
class NoteName(str, Enum):
"""Makes it easier to list and select a note.
One can use auto-completion Note.A_SHARP instead of the 'A#' literal
string.
One can use auto-completion NoteName.A_SHARP instead of the 'A#'
literal string.
"""

A = "A"
Expand Down
12 changes: 6 additions & 6 deletions fretboardgtr/notes_creators.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@ class ScaleFromName:
Given a root name and a mode name, get the resulting scale.
Also :
Mode name can be given thanks to the constants.Mode enum as well as string
Note name can be given thanks to the constants.Note enum as well as string
Mode name can be given thanks to the constants.ModeName enum as well as string
Note name can be given thanks to the constants.NoteName enum as well as string
Example
-------
>>> ScaleFromName(root='C',mode='Dorian').build()
NotesContainer(root= 'C', scale = ['C', 'D', 'D#', 'F', 'G', 'A', 'A#'])
>>> ScaleFromName(root=Note.C,mode=Mode.DORIAN).build()
>>> ScaleFromName(root=Name.C,mode=ModeName.DORIAN).build()
NotesContainer(root= 'C', scale = ['C', 'D', 'D#', 'F', 'G', 'A', 'A#'])
"""

Expand All @@ -192,14 +192,14 @@ class ChordFromName:
Given a root name and a quality name, get the resulting scale.
Also :
Mode name can be given thanks to the constants.Chord enum as well as string
Note name can be given thanks to the constants.Note enum as well as string
Mode name can be given thanks to the constants.ChordName enum as well as string
Note name can be given thanks to the constants.NoteName enum as well as string
Example
-------
>>> ChordFromName(root='C',quality='M').build()
NotesContainer(root= 'C', scale = ['C', 'E', 'G'])
>>> ChordFromName(root=Note.C,quality=Chord.MAJOR).build()
>>> ChordFromName(root=NoteName.C,quality=ChordName.MAJOR).build()
NotesContainer(root= 'C', scale = ['C', 'E', 'G'])
"""

Expand Down

0 comments on commit 4295242

Please sign in to comment.