<commit_before>from __future__ import division
from math import log, sqrt
import argparse, sys

note_names_sharp = ['A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#']
note_names_flat  = ['A', 'Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab']

def get_key_index(key):
    if len(key) == 1:
        key_index = note_names_sharp.index(key)
    else:
        if key in note_names_sharp:
            key_index = note_names_sharp.index(key)
        else:
            key_index = note_names_flat.index(key)      # let it fail here, if a wrong note name was specified
    return key_index


def frequencies(temperament, notes_low, notes_high, key = 'C', base_freq = 440.0, key_freq = 'A'):
    if key != 'A' or key_freq != 'A':
        raise NotImplementedError()
    freq = []
    for fullnote in range(-notes_low, notes_high):
        octave, note = divmod(fullnote, 12)
        freq.append((base_freq * 2 ** octave) * temperament[note])
    return freq
<commit_msg>TDD: this should make the test pass (but doesn't)<commit_after>from __future__ import division
from math import log, sqrt
import argparse, sys

note_names_sharp = ['A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#']
note_names_flat  = ['A', 'Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab']

def get_key_index(key):
    if len(key) == 1:
        key_index = note_names_sharp.index(key)
    else:
        if key in note_names_sharp:
            key_index = note_names_sharp.index(key)
        else:
            key_index = note_names_flat.index(key)      # let it fail here, if a wrong note name was specified
    return key_index


def frequencies(temperament, notes_low, notes_high, key = 'C', base_freq = 440.0, key_freq = 'A'):
    key_index     = get_key_index(key)
    keyfreq_index = get_key_index(key_freq)
    use_base_freq = base_freq / temperament[keyfreq_index - key_index]
    freq = []
    for fullnote in range(-notes_low, notes_high):
        octave, note = divmod(fullnote, 12)
        freq.append((use_base_freq * 2 ** octave) * temperament[note])
    return freq

{'fraction_non_alphanumeric': 0.15708812260536398, 'fraction_numerical': 0.007662835249042145, 'mean_word_length': 3.263265306122449, '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': '180071', 'n_tokens_mistral': 789, 'n_tokens_neox': 753, 'n_words': 212}