def set_note(self, name='C', octave=4, dynamics={}):
        """Set the note to name in octave with dynamics.

        Return the objects if it succeeded, raise an NoteFormatError
        otherwise.
        """
        dash_index = name.split('-')
        if len(dash_index) == 1:
            if notes.is_valid_note(name):
                self.name = name
                self.octave = octave
                self.dynamics = dynamics
                return self
            else:
                raise NoteFormatError("The string '%s' is not a valid "
                        "representation of a note in mingus" % name)
        elif len(dash_index) == 2:
            if notes.is_valid_note(dash_index[0]):
                self.name = dash_index[0]
                self.octave = int(dash_index[1])
                self.dynamics = dynamics
                return self
            else:
                raise NoteFormatError("The string '%s' is not a valid "
                        "representation of a note in mingus" % name)
        return False
def set_note ( self , name = 'C' , octave = 4 , dynamics = { } ) : dash_index = name . split ( '-' ) if len ( dash_index ) == 1 : if notes . is_valid_note ( name ) : self . name = name self . octave = octave self . dynamics = dynamics return self else : raise NoteFormatError ( "The string '%s' is not a valid " "representation of a note in mingus" % name ) elif len ( dash_index ) == 2 : if notes . is_valid_note ( dash_index [ 0 ] ) : self . name = dash_index [ 0 ] self . octave = int ( dash_index [ 1 ] ) self . dynamics = dynamics return self else : raise NoteFormatError ( "The string '%s' is not a valid " "representation of a note in mingus" % name ) return False
Set the note to name in octave with dynamics.

        Return the objects if it succeeded, raise an NoteFormatError
        otherwise.