<commit_before>import os

HUG_USE_UJSON = bool(os.environ.get('HUG_USE_UJSON', 1))
try:
    if HUG_USE_UJSON:
        import ujson as json
    else:
        import json
except ImportError:
    import json
<commit_msg>- Fix unsupported `default` kwarg when using ujson - Mimic json built-in behavior by settings `escape_forward_slashes=False`<commit_after>import os

HUG_USE_UJSON = bool(os.environ.get('HUG_USE_UJSON', 1))
try:
    if HUG_USE_UJSON:
        import ujson as json

        class dumps_proxy:
            """Proxies the call so non supported kwargs are skipped
            and it enables escape_forward_slashes to simulate built-in json
            """
            _dumps = json.dumps

            def __call__(self, *args, **kwargs):
                kwargs.pop('default', None)
                kwargs.update(escape_forward_slashes=False)
                return self._dumps(*args, **kwargs)
        json = dumps_proxy()
    else:
        import json
except ImportError:
    import json

{'fraction_non_alphanumeric': 0.08, 'fraction_numerical': 0.002, 'mean_word_length': 2.4756944444444446, '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': '872618', 'n_tokens_mistral': 310, 'n_tokens_neox': 301, 'n_words': 85}