예제 #1
0
def compare_humdrum_file(filename):
    with open(filename) as f:
        orig = f.read().strip()
    conv = emit.show_humdrum(humdrum.parse_file(filename))

    s = difflib.SequenceMatcher(None, orig, conv)
    lines = zip(orig.splitlines(), conv.splitlines(), count())
    diff = [(o, g, n) for o, g, n in lines if o != g]
    return s.ratio(), diff, orig, conv
예제 #2
0
def test_parse_file():
    temp = tempfile.NamedTemporaryFile(mode='w+t')

    try:
        temp.writelines("**kern")
        temp.seek(0)
        sco = humdrum.parse_file(temp.name)
        assert  sco[0][0].name == "kern"
    finally:
        temp.close()
예제 #3
0
def generate_humdrum(filename, options):
    print emit.show_humdrum(humdrum.parse_file(filename))
예제 #4
0
def generate_lilypond(filename, options):
    result = emit.show_lilypond(humdrum.parse_file(filename))
    if not options.quiet:
        print result