<commit_before>from datetime import datetime
import json
import types


def _serialize_complex_object(obj):
    if isinstance(obj, datetime):
        return obj.isoformat()
    if isinstance(obj, types.GeneratorType):
        return [i for i in obj]
    raise TypeError(
        "Type %s couldn't be serialized. This is a bug in simpleflow,"
        " please file a new issue on GitHub!" % type(obj))


def json_dumps(obj, pretty=False):
    kwargs = {
        "default": _serialize_complex_object
    }
    if pretty:
        kwargs["indent"] = 4
        kwargs["sort_keys"] = True
    return json.dumps(obj, **kwargs)<commit_msg>Make json_dumps(.., pretty=True) even more pretty!<commit_after>from datetime import datetime
import json
import types


def _serialize_complex_object(obj):
    if isinstance(obj, datetime):
        return obj.isoformat()
    if isinstance(obj, types.GeneratorType):
        return [i for i in obj]
    raise TypeError(
        "Type %s couldn't be serialized. This is a bug in simpleflow,"
        " please file a new issue on GitHub!" % type(obj))


def json_dumps(obj, pretty=False):
    kwargs = {
        "default": _serialize_complex_object
    }
    if pretty:
        kwargs["indent"] = 4
        kwargs["sort_keys"] = True
        kwargs["separators"] = (",", ": ")
    return json.dumps(obj, **kwargs)
{'fraction_non_alphanumeric': 0.10804769001490314, 'fraction_numerical': 0.0014903129657228018, 'mean_word_length': 2.9851632047477743, 'pattern_counts': {'":': 3, '<': 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': '4914277', 'n_tokens_mistral': 397, 'n_tokens_neox': 385, 'n_words': 125}