<commit_before>from __future__ import unicode_literals
from decimal import Decimal
import contextlib
import glob
import json
import os
import re
import subprocess
import sys

if sys.version_info[:2] < (2, 7):  # pragma: no cover
    import unittest2 as unittest
else:
    import unittest

try:
    from unittest import mock
except ImportError:
    import mock

try:
    from sys import pypy_version_info
except ImportError:
    pypy_version_info = None

from jsonschema import (
    PY3, SchemaError, UnknownType, ValidationError, ErrorTree,
    Draft3Validator, FormatChecker, RefResolver, validate
)


THIS_DIR = os.path.dirname(__file__)
TESTS_DIR = os.path.join(THIS_DIR, "json", "tests")

JSONSCHEMA_SUITE = os.path.join(THIS_DIR, "json", "bin", "jsonschema_suite")
REMOTES = json.load(
    subprocess.Popen(
        [JSONSCHEMA_SUITE, "remotes"], stdout=subprocess.PIPE,
    ).stdout
)

<commit_msg>json.load in Py3: How I hate you.<commit_after>from __future__ import unicode_literals
from decimal import Decimal
from subprocess import PIPE
import contextlib
import glob
import io
import json
import os
import re
import subprocess
import sys

if sys.version_info[:2] < (2, 7):  # pragma: no cover
    import unittest2 as unittest
else:
    import unittest

try:
    from unittest import mock
except ImportError:
    import mock

try:
    from sys import pypy_version_info
except ImportError:
    pypy_version_info = None

from jsonschema import (
    PY3, SchemaError, UnknownType, ValidationError, ErrorTree,
    Draft3Validator, FormatChecker, RefResolver, validate
)


THIS_DIR = os.path.dirname(__file__)
TESTS_DIR = os.path.join(THIS_DIR, "json", "tests")

JSONSCHEMA_SUITE = os.path.join(THIS_DIR, "json", "bin", "jsonschema_suite")

REMOTES = subprocess.Popen([JSONSCHEMA_SUITE, "remotes"], stdout=PIPE).stdout
if PY3:
    REMOTES = io.TextIOWrapper(REMOTES)
REMOTES = json.load(REMOTES)


{'fraction_non_alphanumeric': 0.08460325801366264, 'fraction_numerical': 0.007356805044666317, 'mean_word_length': 4.734939759036145, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2025675', 'n_tokens_mistral': 660, 'n_tokens_neox': 641, 'n_words': 183}