<commit_before># -*- coding: utf-8 -*-
# pylint: skip-file
"""Python 2/3 compatibility

    Some py2/py3 compatibility support based on a stripped down
    version of six so we don't have to depend on a specific version
    of it.

    Borrowed from
    https://github.com/mitsuhiko/flask/blob/master/flask/_compat.py
"""

import sys
import cgi
from decimal import Decimal
from functools import partial


PY3 = sys.version_info[0] == 3
PY26 = sys.version_info[0:2] == (2, 6)


def _identity(x): return x


if PY3:
    from html.parser import HTMLParser
    from urllib.parse import (
        urlencode, urlsplit, urlunsplit, parse_qs, parse_qsl)
    import builtins as _builtins

    text_type = str
    string_types = (str,)
    integer_types = (int,)
    number_types = (int, float, Decimal)
    builtins = _builtins.__dict__.values()

    def iterkeys(d): return iter(d.keys())

    def itervalues(d): return iter(d.values())

    def iteritems(d): return iter(d.items())

    _range = range

    implements_to_string = _identity
    izip = zip

    def _cmp(a, b): return (a > b) - (a < b)
else:
    from HTMLParser import HTMLParser
    from itertools import izip
    from urllib import urlencode
    from urlparse import urlsplit, urlunsplit, parse_qs, parse_qsl
    import __builtin__ as _builtins

    text_type = unicode
    string_types = (str, unicode)
    integer_types = (int, long)
    number_types = (int, long, float, Decimal)

    def iterkeys(d): return d.iterkeys()

    def itervalues(d): return d.itervalues()

    def iteritems(d): return d.iteritems()

    _range = xrange
    _cmp = cmp

    def implements_to_string(cls):
        cls.__unicode__ = cls.__str__
        cls.__str__ = lambda x: x.__unicode__().encode('utf-8')
        return cls


builtins = dict((value, key) for key, value in iteritems(_builtins.__dict__))
html_escape = partial(cgi.escape, quote=True)
html_unescape = HTMLParser().unescape

try:
    from functools import cmp_to_key
except ImportError:
    # This function is missing on PY26.
    def cmp_to_key(mycmp):
        """Convert a cmp= function into a key= function"""
        class K(object):
            __slots__ = ['obj']

            def __init__(self, obj, *args):
                self.obj = obj

            def __lt__(self, other):
                return mycmp(self.obj, other.obj) < 0

            def __gt__(self, other):
                return mycmp(self.obj, other.obj) > 0

            def __eq__(self, other):
                return mycmp(self.obj, other.obj) == 0

            def __le__(self, other):
                return mycmp(self.obj, other.obj) <= 0

            def __ge__(self, other):<commit_msg>Check for hash-ability while constructing _compat.builtins.<commit_after># -*- coding: utf-8 -*-
# pylint: skip-file
"""Python 2/3 compatibility

    Some py2/py3 compatibility support based on a stripped down
    version of six so we don't have to depend on a specific version
    of it.

    Borrowed from
    https://github.com/mitsuhiko/flask/blob/master/flask/_compat.py
"""

import sys
import cgi
from collections import Hashable
from decimal import Decimal
from functools import partial


PY3 = sys.version_info[0] == 3
PY26 = sys.version_info[0:2] == (2, 6)


def _identity(x): return x


if PY3:
    from html.parser import HTMLParser
    from urllib.parse import (
        urlencode, urlsplit, urlunsplit, parse_qs, parse_qsl)
    import builtins as _builtins

    text_type = str
    string_types = (str,)
    integer_types = (int,)
    number_types = (int, float, Decimal)
    builtins = _builtins.__dict__.values()

    def iterkeys(d): return iter(d.keys())

    def itervalues(d): return iter(d.values())

    def iteritems(d): return iter(d.items())

    _range = range

    implements_to_string = _identity
    izip = zip

    def _cmp(a, b): return (a > b) - (a < b)
else:
    from HTMLParser import HTMLParser
    from itertools import izip
    from urllib import urlencode
    from urlparse import urlsplit, urlunsplit, parse_qs, parse_qsl
    import __builtin__ as _builtins

    text_type = unicode
    string_types = (str, unicode)
    integer_types = (int, long)
    number_types = (int, long, float, Decimal)

    def iterkeys(d): return d.iterkeys()

    def itervalues(d): return d.itervalues()

    def iteritems(d): return d.iteritems()

    _range = xrange
    _cmp = cmp

    def implements_to_string(cls):
        cls.__unicode__ = cls.__str__
        cls.__str__ = lambda x: x.__unicode__().encode('utf-8')
        return cls


builtins = dict((value, key) for key, value in iteritems(_builtins.__dict__)
                if isinstance(value, Hashable))
html_escape = partial(cgi.escape, quote=True)
html_unescape = HTMLParser().unescape

try:
    from functools import cmp_to_key
except ImportError:
    # This function is missing on PY26.
    def cmp_to_key(mycmp):
        """Convert a cmp= function into a key= function"""
        class K(object):
            __slots__ = ['obj']

            def __init__(self, obj, *args):
                self.obj = obj

            def __lt__(self, other):
                return mycmp(self.obj, other.obj) < 0

            def __gt__(self, other):
                return mycmp(self.obj, other.obj) > 0

            def __eq__(self, other):
                return mycmp(self.obj, other.obj) == 0

            def __le__(self, other):
                return mycmp(self.obj, other.obj) <= 0

            def __ge__(self, other):
{'fraction_non_alphanumeric': 0.10160818713450293, 'fraction_numerical': 0.00804093567251462, 'mean_word_length': 2.634130146082337, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '4356203', 'n_tokens_mistral': 1809, 'n_tokens_neox': 1724, 'n_words': 519}