<commit_before>import binascii
import logging
import struct
import time
import sys, traceback
from cStringIO import StringIO
from collections import namedtuple
from datetime import datetime
from functools import partial

__all__ = [
    'KafkaError',
    'ConnectionFailure',
    'OffsetOutOfRange',
    'InvalidMessageCode',
    'WrongPartitionCode',
    'InvalidFetchSizeCode',
    'UnknownError',
    'InvalidOffset',
    'PRODUCE_REQUEST',
    'FETCH_REQUEST',
    'OFFSETS_REQUEST',
    'LATEST_OFFSET',
    'EARLIEST_OFFSET',
    'Lengths',
]

class KafkaError(Exception): pass
class ConnectionFailure(KafkaError): pass
class OffsetOutOfRange(KafkaError): pass
class InvalidMessageCode(KafkaError): pass
class WrongPartitionCode(KafkaError): pass
class InvalidFetchSizeCode(KafkaError): pass
class UnknownError(KafkaError): pass
class InvalidOffset(KafkaError): pass

error_codes = {
    1: OffsetOutOfRange,
    2: InvalidMessageCode,
    3: WrongPartitionCode,
    4: InvalidFetchSizeCode,
}

PRODUCE_REQUEST      = 0
FETCH_REQUEST        = 1
MULTIFETCH_REQUEST   = 2
MULTIPRODUCE_REQUEST = 3
OFFSETS_REQUEST      = 4

MAGIC_BYTE = 0

LATEST_OFFSET   = -1
EARLIEST_OFFSET = -2

kafka_log  = logging.getLogger('kafka')

class Lengths(object):
    ERROR_CODE = 2
    RESPONSE_SIZE = 4
    REQUEST_TYPE = 2
    TOPIC_LENGTH = 2
    PARTITION = 4
    OFFSET = 8
    OFFSET_COUNT = 4
    MAX_NUM_OFFSETS = 4
    MAX_REQUEST_SIZE = 4
    TIME_VAL = 8
    MESSAGE_LENGTH = 4
    MAGIC = 1
    COMPRESSION = 1
    CHECKSUM = 4
    MESSAGE_HEADER = MESSAGE_LENGTH + MAGIC + CHECKSUM<commit_msg>update logger name to brod<commit_after>import binascii
import logging
import struct
import time
import sys, traceback
from cStringIO import StringIO
from collections import namedtuple
from datetime import datetime
from functools import partial

__all__ = [
    'KafkaError',
    'ConnectionFailure',
    'OffsetOutOfRange',
    'InvalidMessageCode',
    'WrongPartitionCode',
    'InvalidFetchSizeCode',
    'UnknownError',
    'InvalidOffset',
    'PRODUCE_REQUEST',
    'FETCH_REQUEST',
    'OFFSETS_REQUEST',
    'LATEST_OFFSET',
    'EARLIEST_OFFSET',
    'Lengths',
]

class KafkaError(Exception): pass
class ConnectionFailure(KafkaError): pass
class OffsetOutOfRange(KafkaError): pass
class InvalidMessageCode(KafkaError): pass
class WrongPartitionCode(KafkaError): pass
class InvalidFetchSizeCode(KafkaError): pass
class UnknownError(KafkaError): pass
class InvalidOffset(KafkaError): pass

error_codes = {
    1: OffsetOutOfRange,
    2: InvalidMessageCode,
    3: WrongPartitionCode,
    4: InvalidFetchSizeCode,
}

PRODUCE_REQUEST      = 0
FETCH_REQUEST        = 1
MULTIFETCH_REQUEST   = 2
MULTIPRODUCE_REQUEST = 3
OFFSETS_REQUEST      = 4

MAGIC_BYTE = 0

LATEST_OFFSET   = -1
EARLIEST_OFFSET = -2

kafka_log  = logging.getLogger('brod')

class Lengths(object):
    ERROR_CODE = 2
    RESPONSE_SIZE = 4
    REQUEST_TYPE = 2
    TOPIC_LENGTH = 2
    PARTITION = 4
    OFFSET = 8
    OFFSET_COUNT = 4
    MAX_NUM_OFFSETS = 4
    MAX_REQUEST_SIZE = 4
    TIME_VAL = 8
    MESSAGE_LENGTH = 4
    MAGIC = 1
    COMPRESSION = 1
    CHECKSUM = 4
    MESSAGE_HEADER = MESSAGE_LENGTH + MAGIC + CHECKSUM
{'fraction_non_alphanumeric': 0.075046904315197, 'fraction_numerical': 0.016260162601626018, 'mean_word_length': 3.913978494623656, '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': '4171555', 'n_tokens_mistral': 1116, 'n_tokens_neox': 1037, 'n_words': 257}