<commit_before>from collections import defaultdict
from utils import Enum


class TinyPNGError(Enum):
    """List of error codes returned by TinyPNG API"""
    Unauthorized = 1
    InputMissing = 2
    BadSignature = 3
    DecodeError = 4
    TooManyRequests = 5
    InternalServerError = 6


FATAL_ERRORS = (TinyPNGError.Unauthorized, TinyPNGError.TooManyRequests)


class TinyPNGResponse:
    """Immutable class to represent TinyPNG response"""

    SUCCESS_CODE = 201

    def __init__(self, status, **kwargs):
        self._status = status
        self._response = kwargs
        self._properties = defaultdict(lambda: None)
        self._properties.update(kwargs)

    @property
    def status(self):
        return self._status

    @property
    def success(self):
        return self.status == self.SUCCESS_CODE

    @property
    def failure(self):
        return not self.success

    @property
    def errno(self):
        err = self._properties['error']
        if err:
            return TinyPNGError.from_value(err)
        return None

    @property
    def errmsg(self):
        return self._properties['message']

    @property
    def input_size(self):
        input = self._properties['input']
        if input and 'size' in input:
            return input['size']
        return None

    @property
    def output_size(self):
        output = self._properties['output']
        if output and 'size' in output:
            return output['size']
        return None

    @property
    def output_ratio(self):
        output = self._properties['output']
        if output and 'ratio' in output:
            return output['ratio']
        return None

    @property
    def compressed_image_url(self):
        return self._properties['location']

    @property
    def bytes(self):
        return self._properties['bytes']
<commit_msg>change variable names<commit_after>from collections import defaultdict
from utils import Enum


class TinyPNGError(Enum):
    """List of error codes returned by TinyPNG API"""
    Unauthorized = 1
    InputMissing = 2
    BadSignature = 3
    DecodeError = 4
    TooManyRequests = 5
    InternalServerError = 6


FATAL_ERRORS = (TinyPNGError.Unauthorized, TinyPNGError.TooManyRequests)


class TinyPNGResponse:
    """Immutable class to represent TinyPNG response"""

    SUCCESS_CODE = 201

    def __init__(self, response_code, **kwargs):
        self._response_code = response_code
        self._response = kwargs
        self._properties = defaultdict(lambda: None)
        self._properties.update(kwargs)

    @property
    def response_code(self):
        return self._response_code

    @property
    def success(self):
        return self.response_code == self.SUCCESS_CODE

    @property
    def failure(self):
        return not self.success

    @property
    def errno(self):
        err = self._properties['error']
        if err:
            return TinyPNGError.from_value(err)
        return None

    @property
    def errmsg(self):
        return self._properties['message']

    @property
    def input_size(self):
        input_ = self._properties['input']
        if input_:
            return input_.get('size')
        return None

    @property
    def output_size(self):
        output = self._properties['output']
        if output:
            return output.get('size')
        return None

    @property
    def output_ratio(self):
        output = self._properties['output']
        if output:
            return output.get('ratio')
        return None

    @property
    def compressed_image_url(self):
        return self._properties['location']

    @property
    def bytes(self):
        return self._properties['bytes']

{'fraction_non_alphanumeric': 0.08666306695464362, 'fraction_numerical': 0.004859611231101512, 'mean_word_length': 2.4497206703910615, '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': '7206339', 'n_tokens_mistral': 1051, 'n_tokens_neox': 989, 'n_words': 276}