<commit_before># Copyright (c) 2015 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
from bisect         import  bisect_left, insort_left
from collections    import  namedtuple, Mapping, MutableMapping, \
                            Sequence, Iterable
from fractions      import  Fraction
from generic        import  FileReader
from io             import  BytesIO, BufferedReader
from itertools      import  count
from numpy          import  nan as NaN, inf as infinity
from random         import  randrange
import unittest

########################################################################
################################ 2 to 3 ################################
########################################################################
############ Also, be sure to run on the command line:      ############
############                                                ############
############   $ sed -i -e 's/assertRaisesRegex/&p/' [file] ############
########################################################################

#int_types = (int, long)
int_types = int

def int_to_bytes (integer, length, byte_order):
    #result = ""
    #while integer > 0:
        #result += chr(integer % 0x100)
        #integer //= 0x100
    #result += "\0" * (length - len(result))
    #if byte_order == "big":
        #return result[::-1]
    #return result
    return integer.to_bytes(length, byte_order)

def bytes_to_int (bytestring, byte_order):
    #if byte_order == "little":
        #bytestring = bytestring[::-1]
    #result = 0
    #for byte in bytestring:
        #result *= 0x100
        #result += ord(byte)
    #return result
    return int.from_bytes(bytestring, byte_order)

def hex_to_bytes (hexstring):
    #return hexstring.replace(" ", "").decode("hex")
    return bytes.fromhex(hexstring)

########################################################################
############################# TIFF Classes #############################
########################################################################

class IFDTag:
    """IFD tags by name"""
    NewSubfileType              = 0x00fe
    SubfileType                 = 0x00ff

    ImageWidth                  = 0x0100
    ImageLength                 = 0x0101
    BitsPerSample               = 0x0102
    Compression                 = 0x0103
    PhotometricInterpretation   = 0x0106
    Thresholding                = 0x0107

    CellWidth                   = 0x0108
    CellLength                  = 0x0109
    FillOrder                   = 0x010a
    DocumentName                = 0x010d
    ImageDescription            = 0x010e
    Make                        = 0x010f

    Model                       = 0x0110
    StripOffsets                = 0x0111
    Orientation                 = 0x0112
    SamplesPerPixel             = 0x0115
    RowsPerStrip                = 0x0116<commit_msg>Removed some weird stuff from tiff.py<commit_after># Copyright (c) 2015 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
from bisect         import  bisect_left, insort_left
from collections    import  namedtuple, Mapping, MutableMapping, \
                            Sequence, Iterable
from fractions      import  Fraction
from io             import  BytesIO, BufferedReader
from itertools      import  count
from numpy          import  nan as NaN, inf as infinity
from random         import  randrange

from blister.read.generic import FileReader, int_to_bytes, \
                            bytes_to_int, hex_to_bytes
import unittest

########################################################################
################################ 2 to 3 ################################
########################################################################
############ Also, be sure to run on the command line:      ############
############                                                ############
############   $ sed -i -e 's/assertRaisesRegex/&p/' [file] ############
########################################################################

#int_types = (int, long)
int_types = int

########################################################################
############################# TIFF Classes #############################
########################################################################

class IFDTag:
    """IFD tags by name"""
    NewSubfileType              = 0x00fe
    SubfileType                 = 0x00ff

    ImageWidth                  = 0x0100
    ImageLength                 = 0x0101
    BitsPerSample               = 0x0102
    Compression                 = 0x0103
    PhotometricInterpretation   = 0x0106
    Thresholding                = 0x0107

    CellWidth                   = 0x0108
    CellLength                  = 0x0109
    FillOrder                   = 0x010a
    DocumentName                = 0x010d
    ImageDescription            = 0x010e
    Make                        = 0x010f

    Model                       = 0x0110
    StripOffsets                = 0x0111
    Orientation                 = 0x0112
    SamplesPerPixel             = 0x0115
    RowsPerStrip                = 0x0116
{'fraction_non_alphanumeric': 0.2544222807677832, 'fraction_numerical': 0.03820097854723372, 'mean_word_length': 2.2076041038020517, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3352148', 'n_tokens_mistral': 1447, 'n_tokens_neox': 1224, 'n_words': 349}