<commit_before>import sys
import json
from random import choice

START_WITH_FEET = True


def part_and_move(dance_parts, part=None):
    if not part:
        part = choice(list(dance_parts.keys()))
    move = choice(dance_parts.pop(part))
    return part, move


if __name__ == "__main__":
    with open(sys.argv[1], 'r') as inputs:
        file_contents = inputs.read()
        dance_parts = json.loads(file_contents)
        first_part = "feet" if START_WITH_FEET else None
        first_part, first_move = part_and_move(dance_parts, first_part)
        second_part, second_move = part_and_move(dance_parts)
        third_part, third_move = part_and_move(dance_parts)
        print (
            "Start with {}: {},\nAdd {}: {},\nThen add {}: {}".format(
                first_part, first_move, second_part, second_move,
                third_part, third_move
            )
        )<commit_msg>Refactored to make dance layers more usable for app<commit_after>import sys
import json
from random import choice

START_WITH_FEET = True


def part_and_move(dance_parts, part=None):
    if not part:
        part = choice(list(dance_parts.keys()))
    move = choice(dance_parts.pop(part))
    return part, move


def get_parts(dance_parts, start_with_feet=None):
    first_part = "feet" if start_with_feet else None
    first_part, first_move = part_and_move(dance_parts, first_part)
    second_part, second_move = part_and_move(dance_parts)
    third_part, third_move = part_and_move(dance_parts)
    return (
        (first_part, first_move),
        (second_part, second_move),
        (third_part, third_move)
    )


if __name__ == "__main__":
    with open(sys.argv[1], 'r') as inputs:
        file_contents = inputs.read()
        dance_parts = json.loads(file_contents)
        first, second, third = get_parts(dance_parts, START_WITH_FEET)
        first_part, first_move = first
        second_part, second_move = second
        third_part, third_move = third

        print (
            "Start with {}: {},\nAdd {}: {},\nThen add {}: {}".format(
                first_part, first_move, second_part, second_move,
                third_part, third_move
            )
        )
{'fraction_non_alphanumeric': 0.0999083409715857, 'fraction_numerical': 0.0009165902841429881, 'mean_word_length': 2.8843416370106763, 'pattern_counts': {'":': 2, '<': 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': '1975322', 'n_tokens_mistral': 716, 'n_tokens_neox': 703, 'n_words': 160}