<commit_before># -*- coding: utf-8 -*-
# MIT Licensed, Copyright (c) 2016 <NAME> <<EMAIL>>

import dotenv<commit_msg>Add `load_envs` to take a base path and recurse up, looking for .envs<commit_after># -*- coding: utf-8 -*-
# MIT Licensed, Copyright (c) 2016 <NAME> <<EMAIL>>

from dotenv import load_dotenv, get_key, set_key, unset_key

def load_envs(path):
    import os
    path, _ = os.path.split(path)
    if path == '/':
        # bail out when you reach top of the FS
        load_dotenv(os.path.join(path, '.env'))
        return
    # load higher envs first
    # closer-to-base environments need higher precedence.
    load_envs(path)
    load_dotenv(os.path.join(path, '.env'))
{'fraction_non_alphanumeric': 0.13662790697674418, 'fraction_numerical': 0.014534883720930232, 'mean_word_length': 3.226993865030675, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '902480', 'n_tokens_mistral': 241, 'n_tokens_neox': 231, 'n_words': 72}