<commit_before>import sys
import re
import binascii
import os
import hashlib
import struct


is_python2 = str == bytes #or sys.version_info.major == 2
is_ios = "Pythonista" in os.environ.get("XPC_SERVICE_NAME", "")		# for Pythonista iOS

RE_HEX_CHARS = HEX_CHARS_RE = re.compile('^[0-9a-fA-F]*$')        
RE_IS_TXID = re.compile('^[0-9a-fA-F]{64}$')
RE_IS_BASE58 = RE_BASE58_CHARS = re.compile('^[0-9a-km-zA-HJ-NP-Z]$')


# PYTHON 2 FUNCTIONS
if is_python2:
    
    is_python2 = bytes == str
    st = lambda u: str(u)
    by = lambda v: bytes(v)

    string_types = (str, unicode)
    string_or_bytes_types = (str, unicode)
    int_types = (int, float, long)

    # Base switching
    code_strings = {
        2: '01',
        10: '0123456789',
        16: '0123456789abcdef',
        32: 'abcdefghijklmnopqrstuvwxyz234567',
        58: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz',
        256: ''.join([chr(x) for x in range(256)])
    }

    ### Hex to bin converter and vice versa for objects
    
    def is_txid(txid):
        RE_IS_TXID = re.compile('^[0-9a-fA-F]{64}$')
        assert isinstance(txid, string_or_bytes_types)
        if len(txid) == 64:<commit_msg>RE_IS_BLOCK<commit_after>import sys
import re
import binascii
import os
import hashlib
import struct


is_python2 = str == bytes #or sys.version_info.major == 2
is_ios = "Pythonista" in os.environ.get("XPC_SERVICE_NAME", "")		# for Pythonista iOS

RE_HEX_CHARS = HEX_CHARS_RE = re.compile('^[0-9a-fA-F]*$')        
RE_IS_TXID = re.compile('^[0-9a-fA-F]{64}$')
RE_IS_BASE58 = RE_BASE58_CHARS = re.compile('^[0-9a-km-zA-HJ-NP-Z]$')
RE_IS_BLOCK = re.compile('^[0]{5,}[0-9a-fA-F]{59,}$')


# PYTHON 2 FUNCTIONS
if is_python2:
    
    is_python2 = bytes == str
    st = lambda u: str(u)
    by = lambda v: bytes(v)

    string_types = (str, unicode)
    string_or_bytes_types = (str, unicode)
    int_types = (int, float, long)

    # Base switching
    code_strings = {
        2: '01',
        10: '0123456789',
        16: '0123456789abcdef',
        32: 'abcdefghijklmnopqrstuvwxyz234567',
        58: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz',
        256: ''.join([chr(x) for x in range(256)])
    }

    ### Hex to bin converter and vice versa for objects
    
    def is_txid(txid):
        RE_IS_TXID = re.compile('^[0-9a-fA-F]{64}$')
        assert isinstance(txid, string_or_bytes_types)
        if len(txid) == 64:
{'fraction_non_alphanumeric': 0.1419753086419753, 'fraction_numerical': 0.06419753086419754, 'mean_word_length': 3.1484641638225255, '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': '2091072', 'n_tokens_mistral': 1096, 'n_tokens_neox': 963, 'n_words': 195}