<commit_before>from collections import OrderedDict

import logging
log = logging.getLogger('payment_terminal')

from .fields import (
    BBSField, DelimitedField,
    ConstantField, EnumField,
    IntegerField, PriceField,
    TextField, FormattedTextField,
    DateTimeField,
)


class BBSMessageMeta(type):
    def __new__(mcls, cls, bases, d):
        fields = OrderedDict()

        # inherit fields from first base class with `_fields` attribute
        for base in bases:
            if hasattr(base, '_fields'):
                fields.update(base._fields)
                break

        # read fields from class body
        for name, field in d.items():
            if isinstance(field, BBSField):
                fields[name] = field

        d['_fields'] = fields
        return type.__new__(mcls, cls, bases, d)

    @classmethod
    def __prepare__(mcls, cls, bases):
        # the dictionary to use to store class attributes
        # need to return OrderedDict rather than default dict as attribute
        # order affects parsing<commit_msg>change metaclass self argument from mcls to mcs to keep pylint happy<commit_after>from collections import OrderedDict

import logging
log = logging.getLogger('payment_terminal')

from .fields import (
    BBSField, DelimitedField,
    ConstantField, EnumField,
    IntegerField, PriceField,
    TextField, FormattedTextField,
    DateTimeField,
)


class BBSMessageMeta(type):
    def __new__(mcs, cls, bases, d):
        fields = OrderedDict()

        # inherit fields from first base class with `_fields` attribute
        for base in bases:
            if hasattr(base, '_fields'):
                fields.update(base._fields)
                break

        # read fields from class body
        for name, field in d.items():
            if isinstance(field, BBSField):
                fields[name] = field

        d['_fields'] = fields
        return type.__new__(mcs, cls, bases, d)

    @classmethod
    def __prepare__(mcs, cls, bases):
        # the dictionary to use to store class attributes
        # need to return OrderedDict rather than default dict as attribute
        # order affects parsing
{'fraction_non_alphanumeric': 0.07386888273314866, 'fraction_numerical': 0.0, 'mean_word_length': 2.5064724919093853, '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': '513556', 'n_tokens_mistral': 582, 'n_tokens_neox': 564, 'n_words': 200}