<commit_before>"""A custom utils library used across docker scripts."""

import inspect
import json
import os
import subprocess
import time


def merge(d, merged):
    """Merge the dict merged into dict d by adding their values on
    common keys
    """
    for key, value in iter(merged.items()):
        d[key] = d[key] + value if key in d else value


def set_up_dns(config, uid):
    """Sets up DNS configuration values, starting the server if needed."""
    if config == 'auto':
        dns_config = run_script_return_dict('dns_up.py', ['--uid', uid])
        return ([dns_config['dns']], dns_config)
    if config == 'none':
        return ([], {})
    return ([config], {})


def get_file_dir(file_path):
    """Returns the absolute path to directory containing given file"""
    return os.path.dirname(os.path.realpath(file_path))


def get_script_dir():<commit_msg>VFS-1000 Add whitespace in set_up_dns in common.py<commit_after>"""A custom utils library used across docker scripts."""

import inspect
import json
import os
import subprocess
import time


def merge(d, merged):
    """Merge the dict merged into dict d by adding their values on
    common keys
    """
    for key, value in iter(merged.items()):
        d[key] = d[key] + value if key in d else value


def set_up_dns(config, uid):
    """Sets up DNS configuration values, starting the server if needed."""
    if config == 'auto':
        dns_config = run_script_return_dict('dns_up.py', ['--uid', uid])
        return ([dns_config['dns']], dns_config)

    if config == 'none':
        return ([], {})
    
    return ([config], {})


def get_file_dir(file_path):
    """Returns the absolute path to directory containing given file"""
    return os.path.dirname(os.path.realpath(file_path))


def get_script_dir():
{'fraction_non_alphanumeric': 0.1260457334076966, 'fraction_numerical': 0.002230897936419409, 'mean_word_length': 3.4962406015037595, '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': '4178300', 'n_tokens_mistral': 558, 'n_tokens_neox': 541, 'n_words': 191}