<commit_before>"""Python 2.x/3.x compatibility tools"""

import sys

__all__ = ['geterror', 'iteritems', 'long_', 'string_types', 'xrange_', 'ord_',
           'unichr_', 'unicode_', 'raw_input_', 'as_bytes', 'as_unicode']

def geterror ():
    return sys.exc_info()[1]

try:
    long_ = long
except NameError:
    long_ = int

try:
    xrange_ = xrange
except NameError:
    xrange_ = range

def get_BytesIO():
    try:
        from cStringIO import StringIO as BytesIO
    except ImportError:
        from io import BytesIO
    return BytesIO

def get_StringIO():
    try:
        from cStringIO import StringIO
    except ImportError:
        from io import StringIO
    return StringIO

def ord_(o):
    try:
        return ord(o)
    except TypeError:
        return o

def chr_(o):
    if sys.version_info >= (3, 0, 0):
        return bytes((o,))
    return chr(o)

try:
    unichr_ = unichr
except NameError:
    unichr_ = chr

try:
    unicode_ = unicode
except NameError:
    unicode_ = str

try:
    bytes_ = bytes
except NameError:
    bytes_ = str

try:
    string_types = basestring
except NameError:
    string_types = str

try:
    raw_input_ = raw_input<commit_msg>Avoid a wrapper function under Python 2<commit_after>"""Python 2.x/3.x compatibility tools"""

import sys

__all__ = ['geterror', 'iteritems', 'long_', 'string_types', 'xrange_', 'ord_',
           'unichr_', 'unicode_', 'raw_input_', 'as_bytes', 'as_unicode']

def geterror ():
    return sys.exc_info()[1]

try:
    long_ = long
except NameError:
    long_ = int

try:
    xrange_ = xrange
except NameError:
    xrange_ = range

def get_BytesIO():
    try:
        from cStringIO import StringIO as BytesIO
    except ImportError:
        from io import BytesIO
    return BytesIO

def get_StringIO():
    try:
        from cStringIO import StringIO
    except ImportError:
        from io import StringIO
    return StringIO

def ord_(o):
    try:
        return ord(o)
    except TypeError:
        return o

if sys.version_info >= (3, 0, 0):
    def chr_(o):
        return bytes((o,))
else:
    chr_ = chr

try:
    unichr_ = unichr
except NameError:
    unichr_ = chr

try:
    unicode_ = unicode
except NameError:
    unicode_ = str

try:
    bytes_ = bytes
except NameError:
    bytes_ = str

try:
    string_types = basestring
except NameError:
    string_types = str

try:
    raw_input_ = raw_input
{'fraction_non_alphanumeric': 0.09703053115851108, 'fraction_numerical': 0.005437055625261397, 'mean_word_length': 2.731669266770671, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3778178', 'n_tokens_mistral': 839, 'n_tokens_neox': 819, 'n_words': 244}