<commit_before>#!/usr/bin/env python

"""Open Annotation JSON-LD support functions for Eve."""

__author__ = '<NAME>'
__license__ = 'MIT'

import json
import urlparse
import hashlib
import re

import flask
import mimeparse

import oajson
import seqid

from settings import TARGET_RESOURCE

# whether to expand @id values to absolute URLs
ABSOLUTE_ID_URLS = True

# mapping from Eve JSON keys to JSON-LD ones
jsonld_key_rewrites = [
    ('_id', '@id'),
]

eve_to_jsonld_key_map = dict(jsonld_key_rewrites)
jsonld_to_eve_key_map = dict([(b,a) for a,b in jsonld_key_rewrites])

def dump_json(document, prettyprint=True):
    if not prettyprint:
        return json.dumps(document)
    else:
        return json.dumps(document, indent=2, sort_keys=True,
                          separators=(',', ': '))

def setup_callbacks(app):<commit_msg>trailing newline in prettyprinted JSON<commit_after>#!/usr/bin/env python

"""Open Annotation JSON-LD support functions for Eve."""

__author__ = '<NAME>'
__license__ = 'MIT'

import json
import urlparse
import hashlib
import re

import flask
import mimeparse

import oajson
import seqid

from settings import TARGET_RESOURCE

# whether to expand @id values to absolute URLs
ABSOLUTE_ID_URLS = True

# mapping from Eve JSON keys to JSON-LD ones
jsonld_key_rewrites = [
    ('_id', '@id'),
]

eve_to_jsonld_key_map = dict(jsonld_key_rewrites)
jsonld_to_eve_key_map = dict([(b,a) for a,b in jsonld_key_rewrites])

def dump_json(document, prettyprint=True):
    if not prettyprint:
        return json.dumps(document)
    else:
        return json.dumps(document, indent=2, sort_keys=True,
                          separators=(',', ': '))+'\n'

def setup_callbacks(app):
{'fraction_non_alphanumeric': 0.10082063305978899, 'fraction_numerical': 0.0011723329425556857, 'mean_word_length': 4.172727272727273, 'pattern_counts': {'":': 0, '<': 5, '<?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': '150931', 'n_tokens_mistral': 587, 'n_tokens_neox': 569, 'n_words': 160}