@@ -52,6 +52,13 @@ class Note(object):
5252 velocity = _DEFAULT_VELOCITY
5353
5454 def __init__ (self , name = "C" , octave = 4 , dynamics = None , velocity = None , channel = None ):
55+ """
56+ :param name:
57+ :param octave:
58+ :param dynamics: Deprecated. Use `velocity` and `channel` directly.
59+ :param int velocity: Integer (0-127)
60+ :param int channel: Integer (0-15)
61+ """
5562 if dynamics is None :
5663 dynamics = {}
5764
@@ -68,12 +75,13 @@ def __init__(self, name="C", octave=4, dynamics=None, velocity=None, channel=Non
6875 elif isinstance (name , int ):
6976 self .from_int (name )
7077 else :
71- raise NoteFormatError (
72- "Don't know what to do with name object: " "'%s'" % name
73- )
78+ raise NoteFormatError ("Don't know what to do with name object: %r" % name )
7479
7580 @property
7681 def dynamics (self ):
82+ """
83+ .. deprecated:: Provided only for compatibility with existing code.
84+ """
7785 return {
7886 "channel" : self .channel ,
7987 "velocity" : self .velocity ,
@@ -94,6 +102,13 @@ def set_note(self, name="C", octave=4, dynamics=None, velocity=None, channel=Non
94102
95103 Return the objects if it succeeded, raise an NoteFormatError
96104 otherwise.
105+
106+ :param name:
107+ :param octave:
108+ :param dynamics: Deprecated. Use `velocity` and `channel` directly.
109+ :param int velocity: Integer (0-127)
110+ :param int channel: Integer (0-15)
111+ :return:
97112 """
98113 if dynamics is None :
99114 dynamics = {}
@@ -115,22 +130,17 @@ def set_note(self, name="C", octave=4, dynamics=None, velocity=None, channel=Non
115130 self .octave = octave
116131 return self
117132 else :
118- raise NoteFormatError (
119- "The string '%s' is not a valid "
120- "representation of a note in mingus" % name
121- )
133+ raise NoteFormatError ("Invalid note representation: %r" % name )
122134 elif len (dash_index ) == 2 :
123135 note , octave = dash_index
124136 if notes .is_valid_note (note ):
125137 self .name = note
126138 self .octave = int (octave )
127139 return self
128140 else :
129- raise NoteFormatError (
130- "The string '%s' is not a valid "
131- "representation of a note in mingus" % name
132- )
133- return False
141+ raise NoteFormatError ("Invalid note representation: %r" % name )
142+ else :
143+ raise NoteFormatError ("Invalid note representation: %r" % name )
134144
135145 def empty (self ):
136146 """Remove the data in the instance."""
0 commit comments