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

import logging
from glob import glob
from os import environ, path
from subprocess import call
from sys import argv

logging.basicConfig(level=logging.INFO)


def format_with_environment(path):
    """
    Open file and format its content with environment variables.
    :param path: path to file which should be formatted
    """
    with open(path, 'r+') as f:
        content = f.read()
        content = content.format(**environ)
        f.seek(0)
        f.truncate()
        f.write(content)

configs = [environ['DIAMOND_CONF']]

for configs_dir in [environ['COLLECTORS_CONF_DIR'],
                    environ['HANDLERS_CONF_DIR']]:
    configs.extend(config for config in glob(path.join(configs_dir, '*'))
                   if config.endswith('.conf'))


logging.info('Formatting %s with environments', ', '.join(configs))

for config in configs:
    format_with_environment(config)<commit_msg>Simplify check.<commit_after>#!/usr/bin/env python

import logging
from glob import glob
from os import environ, path
from subprocess import call
from sys import argv

logging.basicConfig(level=logging.INFO)


def format_with_environment(path):
    """
    Open file and format its content with environment variables.
    :param path: path to file which should be formatted
    """
    with open(path, 'r+') as f:
        content = f.read()
        content = content.format(**environ)
        f.seek(0)
        f.truncate()
        f.write(content)

configs = [environ['DIAMOND_CONF']]

for configs_dir in [environ['COLLECTORS_CONF_DIR'],
                    environ['HANDLERS_CONF_DIR']]:
    configs += glob(path.join(configs_dir, '*.conf'))


logging.info('Formatting %s with environments', ', '.join(configs))

for config in configs:
    format_with_environment(config)
{'fraction_non_alphanumeric': 0.11313465783664459, 'fraction_numerical': 0.0011037527593818985, 'mean_word_length': 3.400485436893204, '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': '451001', 'n_tokens_mistral': 553, 'n_tokens_neox': 540, 'n_words': 152}