<commit_before>from base64 import standard_b64encode, standard_b64decode

import nacl.bindings
import nacl.utils
from nacl.secret import SecretBox

from pymacaroons.field_encryptors.base_field_encryptor import (
    BaseFieldEncryptor
)
from pymacaroons.utils import (
    truncate_or_pad, convert_to_bytes, convert_to_string
)


class SecretBoxEncryptor(BaseFieldEncryptor):

    def __init__(self, signifier=None, nonce=None):
        super(SecretBoxEncryptor, self).__init__(
            signifier=signifier or 'sbe::'
        )
        self.nonce = (nonce or
            nacl.utils.random(nacl.bindings.crypto_secretbox_NONCEBYTES))

    def encrypt(self, signature, field_data):
        encrypt_key = truncate_or_pad(signature)<commit_msg>Break how flake8 wants me to break<commit_after>from base64 import standard_b64encode, standard_b64decode

import nacl.bindings
import nacl.utils
from nacl.secret import SecretBox

from pymacaroons.field_encryptors.base_field_encryptor import (
    BaseFieldEncryptor
)
from pymacaroons.utils import (
    truncate_or_pad, convert_to_bytes, convert_to_string
)


class SecretBoxEncryptor(BaseFieldEncryptor):

    def __init__(self, signifier=None, nonce=None):
        super(SecretBoxEncryptor, self).__init__(
            signifier=signifier or 'sbe::'
        )
        self.nonce = nonce or nacl.utils.random(
            nacl.bindings.crypto_secretbox_NONCEBYTES
        )

    def encrypt(self, signature, field_data):
        encrypt_key = truncate_or_pad(signature)
{'fraction_non_alphanumeric': 0.07119314436387607, 'fraction_numerical': 0.008569545154911009, 'mean_word_length': 4.111111111111111, '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': '1558055', 'n_tokens_mistral': 506, 'n_tokens_neox': 490, 'n_words': 94}