From 3039d4b4ee11cdf526805087ca6c8c4b41070007 Mon Sep 17 00:00:00 2001 From: Ashwin Pillay Date: Fri, 16 Feb 2024 17:15:25 -0500 Subject: [PATCH] rearranged PrettyMIDI arguments to keep mido_object as the last one --- pretty_midi/pretty_midi.py | 8 ++++---- tests/test_pretty_midi.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pretty_midi/pretty_midi.py b/pretty_midi/pretty_midi.py index a3d1831..6f03213 100644 --- a/pretty_midi/pretty_midi.py +++ b/pretty_midi/pretty_midi.py @@ -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 @@ -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. diff --git a/tests/test_pretty_midi.py b/tests/test_pretty_midi.py index 6f0a756..c0ccbe0 100644 --- a/tests/test_pretty_midi.py +++ b/tests/test_pretty_midi.py @@ -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)