<commit_before># -*- coding: utf-8 -*-
"""
    decorators.py
    ~~~~~~~~~~~~~
    <Add description of the module here>.
    
    :copyright: (c) 2015 by <NAME>.
    :license: BSD-style, see LICENSE for details
"""

from functools import wraps
from .categories import Byteorder, Option


def option(name, default=None):
    """Attaches an option with its *name* and *default* value to the
    keyword arguments, if the keyword does not exist. All positional
    arguments and keyword arguments are forwarded unchanged.
    """

    def decorator(method):
        @wraps(method)
        def wrapper(*args, **kwargs):
            kwargs[name] = kwargs.get(name, default)
            return method(*args, **kwargs)

        return wrapper

    return decorator


def byte_order_option(default=Byteorder.default):
    """Attaches the byte order option with the *default* value to the
    keyword arguments, if the keyword does not exist. All positional
    arguments and keyword arguments are forwarded unchanged.
    """

    def decorator(method):
        @wraps(method)
        def wrapper(*args, **kwargs):
            kwargs[Option.byteorder] = kwargs.get(Option.byteorder,
                                                  bool(default))
            return method(*args, **kwargs)

        return wrapper

    return decorator


def field_types_option(default=False):
    """Attaches the field type option with a *default* value to the
    keyword arguments, if the keyword does not exist. All positional
    arguments and keyword arguments are forwarded unchanged.
    """

    def decorator(method):
        @wraps(method)
        def wrapper(*args, **kwargs):
            kwargs[Option.classes] = kwargs.get(Option.classes,
                                                bool(default))
            return method(*args, **kwargs)

        return wrapper

    return decorator


def nested_option(default=False):
    """Attaches the nested option with the *default* value to the
    keyword arguments, if the keyword does not exist. All positional
    arguments and keyword arguments are forwarded unchanged.
    """

    def decorator(method):
        @wraps(method)
        def wrapper(*args, **kwargs):
            kwargs[Option.nested] = kwargs.get(Option.nested,
                                               bool(default))
            return method(*args, **kwargs)

        return wrapper

    return decorator


def verbose_option(default=False):
    """Attaches the verbose option with the *default* value to the
    keyword arguments, if the keyword does not exist. All positional
    arguments and keyword arguments are forwarded unchanged.
    """

    def decorator(method):
        @wraps(method)
        def wrapper(*args, **kwargs):
            kwargs[Option.verbose] = kwargs.get(Option.verbose,
                                                bool(default))
            return method(*args, **kwargs)

        return wrapper

    return decorator<commit_msg>fixed decorators<commit_after># -*- coding: utf-8 -*-
"""
    decorators.py
    ~~~~~~~~~~~~~
    <Add description of the module here>.
    
    :copyright: (c) 2015 by <NAME>.
    :license: BSD-style, see LICENSE for details
"""

from functools import wraps
from .categories import Byteorder, Option


def byte_order_option(default=Byteorder.default):
    """Attaches the option ``byte_order`` with its *default* value to the
    keyword arguments, when the option does not exist. All positional
    arguments and keyword arguments are forwarded unchanged.
    """

    def decorator(method):
        @wraps(method)
        def wrapper(*args, **kwargs):
            option = Option.byteorder.value
            kwargs[option] = kwargs.get(option, default)
            return method(*args, **kwargs)

        return wrapper

    return decorator


def field_types_option(default=False):
    """Attaches the option ``field_types`` with its *default* value to the
    keyword arguments when the option does not exist. All positional
    arguments and keyword arguments are forwarded unchanged.
    """

    def decorator(method):
        @wraps(method)
        def wrapper(*args, **kwargs):
            option = Option.field_types.value
            kwargs[option] = kwargs.get(option, bool(default))
            return method(*args, **kwargs)

        return wrapper

    return decorator


def nested_option(default=False):
    """Attaches the option ``nested`` with its *default* value to the
    keyword arguments when the option does not exist. All positional
    arguments and keyword arguments are forwarded unchanged.
    """

    def decorator(method):
        @wraps(method)
        def wrapper(*args, **kwargs):
            option = Option.nested.value
            kwargs[option] = kwargs.get(option, bool(default))
            return method(*args, **kwargs)

        return wrapper

    return decorator


def verbose_option(default=False):
    """Attaches the option ``verbose`` with its *default* value to the
    keyword arguments when the option does not exist. All positional
    arguments and keyword arguments are forwarded unchanged.
    """

    def decorator(method):
        @wraps(method)
        def wrapper(*args, **kwargs):
            option = Option.verbose.value
            kwargs[option] = kwargs.get(option, bool(default))
            return method(*args, **kwargs)

        return wrapper

    return decorator
{'fraction_non_alphanumeric': 0.09536985795978602, 'fraction_numerical': 0.0018446781036709095, 'mean_word_length': 2.4756410256410257, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7108958', 'n_tokens_mistral': 1380, 'n_tokens_neox': 1321, 'n_words': 477}