<commit_before>#!/usr/bin/env python
# encoding: utf8

# Copyright (C) 2015 by <NAME>.
# This file is part of crypto-enigma, an Enigma Machine simulator.
# released under the BSD-3 License (see LICENSE.txt).

"""
This is a supporting module that defines the components used to construct an Enigma machine.
It will not generally be used directly.
"""

from __future__ import (absolute_import, print_function, division, unicode_literals)

from itertools import cycle, islice
from cachetools import cached
from enum import Enum

from .cypher import *


# REV - Additional performance improvements
# A note on the use of caching (cachetools):
# A large speed improvement comes from caching the encodings of rotors when first computed for a given position.
# This is effective because upper rotors don't change frequently so such cached mappings are reused many times.
# And because even the lower rotors will assume a maximum of 26 distinct positions, the cache will always be small.


LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"


class Direction(Enum):
    """The direction that a signal flows through a component.

    During encoding of a character, the signal passes first through the wiring of each `Component`,
    from right to left in the machine, in a forward (`~Direction.FWD`) direction, then through the reflector,
    and then, from left to right, through each component again, in reverse (`~Direction.REV`).
    This direction affects the encoding performed by the component (see `mapping`).
    """
    FWD = 1<commit_msg>Keep enum import with other Python 3 futurization<commit_after>#!/usr/bin/env python
# encoding: utf8

# Copyright (C) 2015 by <NAME>.
# This file is part of crypto-enigma, an Enigma Machine simulator.
# released under the BSD-3 License (see LICENSE.txt).

"""
This is a supporting module that defines the components used to construct an Enigma machine.
It will not generally be used directly.
"""

from __future__ import (absolute_import, print_function, division, unicode_literals)
from enum import Enum

from itertools import cycle, islice
from cachetools import cached

from .cypher import *


# REV - Additional performance improvements
# A note on the use of caching (cachetools):
# A large speed improvement comes from caching the encodings of rotors when first computed for a given position.
# This is effective because upper rotors don't change frequently so such cached mappings are reused many times.
# And because even the lower rotors will assume a maximum of 26 distinct positions, the cache will always be small.


LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"


class Direction(Enum):
    """The direction that a signal flows through a component.

    During encoding of a character, the signal passes first through the wiring of each `Component`,
    from right to left in the machine, in a forward (`~Direction.FWD`) direction, then through the reflector,
    and then, from left to right, through each component again, in reverse (`~Direction.REV`).
    This direction affects the encoding performed by the component (see `mapping`).
    """
    FWD = 1
{'fraction_non_alphanumeric': 0.06334841628959276, 'fraction_numerical': 0.006140917905623788, 'mean_word_length': 4.373263888888889, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3597570', 'n_tokens_mistral': 833, 'n_tokens_neox': 787, 'n_words': 422}