<commit_before># coding: utf8
from __future__ import unicode_literals

import sys
from pathlib import Path

from .json import ujson


def json_dumps(data, indent=0, sort_keys=False):
    result = ujson.dumps(
        data, indent=indent, escape_forward_slashes=False, sort_keys=sort_keys
    )
    if sys.version_info[0] == 2:  # Python 2
        return result.decode("utf8")
    return result


def json_loads(data):<commit_msg>Use regular json module if sort_keys=True<commit_after># coding: utf8
from __future__ import unicode_literals

import sys
import json
from pathlib import Path

from .json import ujson


def json_dumps(data, indent=0, sort_keys=False):
    if sort_keys:
        result = json.dumps(data, indent=indent, sort_keys=sort_keys)
    else:
        result = ujson.dumps(data, indent=indent, escape_forward_slashes=False)
    if sys.version_info[0] == 2:  # Python 2
        return result.decode("utf8")
    return result


def json_loads(data):
{'fraction_non_alphanumeric': 0.08808290155440414, 'fraction_numerical': 0.012435233160621761, 'mean_word_length': 4.08421052631579, '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': '4379020', 'n_tokens_mistral': 323, 'n_tokens_neox': 314, 'n_words': 87}