Skip to content

Commit

Permalink
Merge pull request vishnubob#23 from eli-b/misc-cleanup
Browse files Browse the repository at this point in the history
Removed unnecessary imports, obsolete or duplicated "docstrings" and upd...
  • Loading branch information
vishnubob committed Nov 9, 2013
2 parents 3059147 + 9a2c800 commit 7cf8b02
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
17 changes: 1 addition & 16 deletions src/events.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pdb
import math

class EventRegistry(object):
Expand All @@ -19,11 +18,6 @@ def register_event(cls, event, bases):
register_event = classmethod(register_event)


"""
EventMIDI : Concrete class used to describe MIDI Events.
Inherits from Event.
"""

class AbstractEvent(object):
__slots__ = ['tick', 'data']
name = "Generic MIDI Event"
Expand Down Expand Up @@ -63,11 +57,6 @@ def __baserepr__(self, keys=[]):
def __repr__(self):
return self.__baserepr__()

"""
MetaEvent is a special subclass of Event that is not meant to
be used as a concrete class. It defines a subset of Events known
as the Meta events.
"""

class Event(AbstractEvent):
__slots__ = ['channel']
Expand All @@ -77,7 +66,6 @@ def __init__(self, **kw):
if 'channel' not in kw:
kw = kw.copy()
kw['channel'] = 0
#self.__kw = kw
super(Event, self).__init__(**kw)

def copy(self, **kw):
Expand All @@ -89,9 +77,6 @@ def __cmp__(self, other):
if self.tick < other.tick: return -1
elif self.tick > other.tick: return 1
return 0
#if self.channel < other.channel: return -1
#elif self.channel > other.channel: return 1
#return cmp(self.data, other.data)

def __repr__(self):
return self.__baserepr__(['channel'])
Expand All @@ -104,7 +89,7 @@ def is_event(cls, statusmsg):
"""
MetaEvent is a special subclass of Event that is not meant to
be used as a concrete class. It defines a subset of Events known
as the Meta events.
as the Meta events.
"""

class MetaEvent(AbstractEvent):
Expand Down
4 changes: 2 additions & 2 deletions src/fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def parse_midi_event(self, trackdata):
break
data.append(datum)
return SysexEvent(tick=tick, data=data)
# not a Meta MIDI event, must be a general message
# not a Meta MIDI event or a Sysex event, must be a general message
else:
key = stsmsg & 0xF0
if key not in EventRegistry.Events:
Expand Down Expand Up @@ -133,7 +133,7 @@ def encode_midi_event(self, event):
ret += chr(0xF0)
ret += str.join('', map(chr, event.data))
ret += chr(0xF7)
# not a Meta MIDI event, must be a general message
# not a Meta MIDI event or a Sysex event, must be a general message
elif isinstance(event, Event):
if not self.RunningStatus or \
self.RunningStatus.statusmsg != event.statusmsg or \
Expand Down

0 comments on commit 7cf8b02

Please sign in to comment.