<commit_before>from collections import namedtuple


Configuration = namedtuple(
    'Configuration',
    ['API_ROOT', 'AUTH', 'VALIDATE_SSL', 'TIMEOUT', 'APPEND_SLASH']
)


class Factory:
    def __init__(self, config_dict):
        self._config_dict = config_dict

    def create(self) -> Configuration:
        return Configuration(
            API_ROOT=self.API_ROOT,
            AUTH=self.AUTH,
            VALIDATE_SSL=self.VALIDATE_SSL,
            TIMEOUT=self.TIMEOUT,
            APPEND_SLASH=self.APPEND_SLASH,
        )

    @property
    def API_ROOT(self):
        return self._config_dict['API_ROOT']

    @property
    def AUTH(self):
        return self._config_dict.get('AUTH', None)

    @property
    def VALIDATE_SSL(self):
        return self._config_dict.get('VALIDATE_SSL', True)

    @property
    def TIMEOUT(self):
        return self._config_dict.get('TIMEOUT', 1)

    @property
    def APPEND_SLASH(self):
        return self._config_dict.get('APPEND_SLASH', True)
<commit_msg>Append slash to API root if needed.<commit_after>from collections import namedtuple


Configuration = namedtuple(
    'Configuration',
    ['API_ROOT', 'AUTH', 'VALIDATE_SSL', 'TIMEOUT', 'APPEND_SLASH']
)


class Factory:
    def __init__(self, config_dict):
        self._config_dict = config_dict

    def create(self) -> Configuration:
        return Configuration(
            API_ROOT=self.API_ROOT,
            AUTH=self.AUTH,
            VALIDATE_SSL=self.VALIDATE_SSL,
            TIMEOUT=self.TIMEOUT,
            APPEND_SLASH=self.APPEND_SLASH,
        )

    @property
    def API_ROOT(self):
        url = self._config_dict['API_ROOT']
        if not url.endswith('/'):
            url += '/'
        return url

    @property
    def AUTH(self):
        return self._config_dict.get('AUTH', None)

    @property
    def VALIDATE_SSL(self):
        return self._config_dict.get('VALIDATE_SSL', True)

    @property
    def TIMEOUT(self):
        return self._config_dict.get('TIMEOUT', 1)

    @property
    def APPEND_SLASH(self):
        return self._config_dict.get('APPEND_SLASH', True)

{'fraction_non_alphanumeric': 0.10810810810810811, 'fraction_numerical': 0.000948316737790422, 'mean_word_length': 2.6006825938566553, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2866339', 'n_tokens_mistral': 664, 'n_tokens_neox': 643, 'n_words': 128}