<commit_before>#!/usr/bin/env python
"""
Open a MIDI file and print every message in every track.

Support for MIDI files is still experimental.
"""
import sys
from mido.midifiles import MidiFile

if __name__ == '__main__':
    filename = sys.argv[1]
    midi_file = MidiFile(filename)
    midi_file._print_tracks()<commit_msg>Rewrote print_midi_file.py so it doesn't use a private method.<commit_after>#!/usr/bin/env python
"""
Open a MIDI file and print every message in every track.

Support for MIDI files is still experimental.
"""
import sys
from mido.midifiles import MidiFile

if __name__ == '__main__':
    filename = sys.argv[1]
    with MidiFile(filename) as midi_file:
        for i, track in enumerate(midi_file.tracks):
            sys.stdout.write('=== Track {}\n'.format(i))
            for message in track:
                sys.stdout.write('  {!r}\n'.format(message))
{'fraction_non_alphanumeric': 0.11073446327683616, 'fraction_numerical': 0.0022598870056497176, 'mean_word_length': 3.474747474747475, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4922667', 'n_tokens_mistral': 293, 'n_tokens_neox': 280, 'n_words': 90}