<commit_before># -*- coding: utf-8 -*-

""" Tablib - JSON Support
"""

import tablib

import sys
from tablib.packages import omnijson as json


title = 'json'
extensions = ('json', 'jsn')


def date_handler(obj):
    return obj.isoformat() if hasattr(obj, 'isoformat') else obj


def export_set(dataset):
    """Returns JSON representation of Dataset."""<commit_msg>if the object is a decimal, return the string representation of it.<commit_after># -*- coding: utf-8 -*-

""" Tablib - JSON Support
"""
import decimal

import tablib

import sys
from tablib.packages import omnijson as json


title = 'json'
extensions = ('json', 'jsn')


def date_handler(obj):
    if isinstance(obj, decimal.Decimal):
        return str(obj)
    elif hasattr(obj, 'isoformat'):
        return obj.isoformat()
    else:
        return obj
    # return obj.isoformat() if hasattr(obj, 'isoformat') else obj


def export_set(dataset):
    """Returns JSON representation of Dataset."""
{'fraction_non_alphanumeric': 0.12863070539419086, 'fraction_numerical': 0.002074688796680498, 'mean_word_length': 3.707317073170732, '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': '6165933', 'n_tokens_mistral': 295, 'n_tokens_neox': 292, 'n_words': 99}