Skip to content

Commit

Permalink
rearranged PrettyMIDI arguments to keep mido_object as the last one
Browse files Browse the repository at this point in the history
  • Loading branch information
a-pillay committed Feb 16, 2024
1 parent 7142b42 commit 3039d4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions pretty_midi/pretty_midi.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ class PrettyMIDI(object):
Parameters
----------
mido_object : mido.MidiFile
Pre-loaded `mido.MidiFile` object.
Default ``None`` would check if ``midi_file`` is populated instead.
midi_file : str or file
Path or file pointer to a MIDI file.
Default ``None`` which means create an empty class with the supplied
values for resolution and initial tempo.
Note: If ``mido_object`` is not ``None``, this argument is ignored.
mido_object : mido.MidiFile
Pre-loaded `mido.MidiFile` object.
Default ``None`` would check if ``midi_file`` is populated instead.
resolution : int
Resolution of the MIDI data, when no file is provided.
initial_tempo : float
Expand All @@ -63,7 +63,7 @@ class PrettyMIDI(object):
List of :class:`pretty_midi.Text` objects.
"""

def __init__(self, midi_file=None, mido_object=None, resolution=220, initial_tempo=120., charset='latin1'):
def __init__(self, midi_file=None, resolution=220, initial_tempo=120., charset='latin1', mido_object=None):
"""Initialize either by populating it with MIDI data from a mido.MidiFile object, file or
from scratch with no data.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pretty_midi.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def make_mido_track(notes_str):
with NamedTemporaryFile() as file:

# Test-2: Passing file path while mido_object argument defaults to None.
# This test will ensure <=v0.2.10 compatibility for passing filename without keywords
# This test will ensure <=v0.2.10 compatibility for passing other arguments without keywords
example_mido_obj_2 = make_mido_track(example_track_2)
example_mido_obj_2.save(file=file)
file.seek(0)
Expand Down

0 comments on commit 3039d4b

Please sign in to comment.