<commit_before># -*- coding: utf8 -*-
from struct import unpack_from, pack
from jawa.attribute import Attribute


class SignatureAttribute(Attribute):
    ADDED_IN = '5.0.0'
    MINIMUM_CLASS_VERSION = (49, 0)

    def __init__(self, table, signature=None, name_index=None):
        super(SignatureAttribute, self).__init__(
            table,
            name_index or table.cf.constants.create_utf8(
                'Signature'
            ).index
        )
        self._signature_index = signature.index if signature else None

    def unpack(self, info):
        self._signature_index = unpack_from('>H', info)[0]

    @property
    def info(self):
        return pack('>H', self._signature_index)

    @property
    def signature(self):
        return self._cf.constants[self._signature_index]
<commit_msg>Signature attribute unpack was not using new info stream reader.<commit_after># -*- coding: utf8 -*-
from struct import pack
from jawa.attribute import Attribute


class SignatureAttribute(Attribute):
    ADDED_IN = '5.0.0'
    MINIMUM_CLASS_VERSION = (49, 0)

    def __init__(self, table, signature=None, name_index=None):
        super(SignatureAttribute, self).__init__(
            table,
            name_index or table.cf.constants.create_utf8(
                'Signature'
            ).index
        )
        self._signature_index = signature.index if signature else None

    def unpack(self, info):
        self._signature_index = info.u2()

    @property
    def info(self):
        return pack('>H', self._signature_index)

    @property
    def signature(self):
        return self._cf.constants[self._signature_index]

{'fraction_non_alphanumeric': 0.10030395136778116, 'fraction_numerical': 0.01094224924012158, 'mean_word_length': 2.674107142857143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '6316825', 'n_tokens_mistral': 481, 'n_tokens_neox': 461, 'n_words': 117}