Skip to content

Commit

Permalink
Fix relative imports in the midi module
Browse files Browse the repository at this point in the history
  • Loading branch information
Linkid committed Dec 28, 2017
1 parent 5443442 commit c3d1df5
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 29 deletions.
7 changes: 3 additions & 4 deletions fretwork/midi/EventDispatcher.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-

from DataTypeConverters import readBew
from DataTypeConverters import toBytes

from constants import *
from .DataTypeConverters import readBew
from .DataTypeConverters import toBytes
from .constants import *


class EventDispatcher:
Expand Down
6 changes: 2 additions & 4 deletions fretwork/midi/MidiFileParser.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-

# uhh I don't really like this, but there are so many constants to
# import otherwise
from constants import *
from .EventDispatcher import EventDispatcher
from .constants import *

from EventDispatcher import EventDispatcher

class MidiFileParser(object):

Expand Down
6 changes: 2 additions & 4 deletions fretwork/midi/MidiInFile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-

from RawInstreamFile import RawInstreamFile
from MidiFileParser import MidiFileParser
from .MidiFileParser import MidiFileParser
from .RawInstreamFile import RawInstreamFile


class MidiInFile(object):
Expand Down Expand Up @@ -38,14 +38,12 @@ def __init__(self, outStream, infile):
self.raw_in = RawInstreamFile(infile)
self.parser = MidiFileParser(self.raw_in, outStream)


def read(self):
"Start parsing the file"
p = self.parser
p.parseMThdChunk()
p.parseMTrkChunks()


def setData(self, data=''):
"Sets the data from a plain string"
self.raw_in.setData(data)
3 changes: 2 additions & 1 deletion fretwork/midi/MidiInStream.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

from MidiOutStream import MidiOutStream
from .MidiOutStream import MidiOutStream


class MidiInStream(object):

Expand Down
9 changes: 5 additions & 4 deletions fretwork/midi/MidiOutFile.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-

from MidiOutStream import MidiOutStream
from RawOutstreamFile import RawOutstreamFile
from .DataTypeConverters import fromBytes
from .DataTypeConverters import writeVar
from .MidiOutStream import MidiOutStream
from .RawOutstreamFile import RawOutstreamFile
from .constants import *

from constants import *
from DataTypeConverters import fromBytes, writeVar

class MidiOutFile(MidiOutStream):

Expand Down
4 changes: 3 additions & 1 deletion fretwork/midi/MidiToText.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

from MidiOutStream import MidiOutStream
from .MidiOutStream import MidiOutStream


class MidiToText(MidiOutStream):


Expand Down
6 changes: 3 additions & 3 deletions fretwork/midi/RawInstreamFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import os.path

from DataTypeConverters import readBew as readBew_
from DataTypeConverters import readVar
from DataTypeConverters import varLen
from .DataTypeConverters import readBew as readBew_
from .DataTypeConverters import readVar
from .DataTypeConverters import varLen


class RawInstreamFile(object):
Expand Down
6 changes: 3 additions & 3 deletions fretwork/midi/RawOutstreamFile.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-

# standard library imports
import sys
from types import StringType
from cStringIO import StringIO

# custom import
from DataTypeConverters import writeBew, writeVar
from .DataTypeConverters import writeVar
from .DataTypeConverters import writeBew


class RawOutstreamFile(object):

Expand Down
10 changes: 5 additions & 5 deletions fretwork/midi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-

from MidiOutStream import MidiOutStream
from MidiOutFile import MidiOutFile
from MidiInStream import MidiInStream
from MidiInFile import MidiInFile
from MidiToText import MidiToText
from .MidiInFile import MidiInFile
from .MidiInStream import MidiInStream
from .MidiOutFile import MidiOutFile
from .MidiOutStream import MidiOutStream
from .MidiToText import MidiToText

__all__ = ['MidiOutStream',
'MidiOutFile',
Expand Down

0 comments on commit c3d1df5

Please sign in to comment.