<commit_before>#!/usr/bin/env python

import random
from functools import reduce


def gen(places: dict):
    accumulator = 0
    for k, v in places.items():
        accumulator += v
        yield (k, (accumulator - v, accumulator))


def select(places: dict):
    random_num = int(random.uniform(0.0, reduce(lambda x, y: x + y, places.values())))

    for i in gen(places):
        place, rng = i[0], i[1]
        if random_num in range(*rng):
            return f'{place}, because {random_num}'

    return 'I dunno, lol'


def main():
    all_places = {
        'Litwiny': 40,
        'Terra pizza': 40,
        'Arena city': 20
    }

    print(select(all_places))


if __name__ == '__main__':
    main()<commit_msg>added new places to visit (sorta)<commit_after>#!/usr/bin/env python

import random
from functools import reduce


def gen(places: dict):
    accumulator = 0
    for k, v in places.items():
        accumulator += v
        yield (k, (accumulator - v, accumulator))


def select(places: dict):
    random_num = int(random.uniform(0.0, reduce(lambda x, y: x + y, places.values())))

    for i in gen(places):
        place, rng = i[0], i[1]
        if random_num in range(*rng):
            return f'{place}, because {random_num}'

    return 'I dunno, lol'


def main():
    all_places = {
        'Litwiny': 40,
        'Terra pizza': 40,
        'Arena city': 20,
        'Zamok': 80,
        'Ronin (delivery)': 10
    }

    print(select(all_places))


if __name__ == '__main__':
    main()
{'fraction_non_alphanumeric': 0.14011896893588896, 'fraction_numerical': 0.017184401850627893, 'mean_word_length': 2.4645308924485128, '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': '587003', 'n_tokens_mistral': 563, 'n_tokens_neox': 512, 'n_words': 153}