<commit_before># -*- coding: utf-8 -*-
"""Base Session class.


:copyright: 2014-2020 by PyVISA-py Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.

"""
import abc
import time
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, TypeVar

from pyvisa import attributes, constants, logger, rname
from pyvisa.constants import ResourceAttribute, StatusCode
from pyvisa.typing import VISARMSession

from .common import int_to_byte
from . import attributes as py_attributes #We need to import this for overwrite

#: Type var used when typing register.
T = TypeVar("T", bound=Type["Session"])


class UnknownAttribute(Exception):
    """Custom exception signaling a VISA attribute is not supported."""

    def __init__(self, attribute: constants.ResourceAttribute) -> None:
        self.attribute = attribute

    def __str__(self) -> str:
        attr = self.attribute
        if isinstance(attr, int):
            try:
                name = attributes.AttributesByID[attr].visa_name
            except KeyError:
                name = "Name not found"

            return "Unknown attribute %s (%s - %s)" % (attr, hex(attr), name)<commit_msg>Ran black and stuff<commit_after># -*- coding: utf-8 -*-
"""Base Session class.


:copyright: 2014-2020 by PyVISA-py Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.

"""
import abc
import time
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, TypeVar

from pyvisa import attributes, constants, logger, rname
from pyvisa.constants import ResourceAttribute, StatusCode
from pyvisa.typing import VISARMSession

from .common import int_to_byte
from . import attributes as py_attributes  # We need to import this for overwrite

#: Type var used when typing register.
T = TypeVar("T", bound=Type["Session"])


class UnknownAttribute(Exception):
    """Custom exception signaling a VISA attribute is not supported."""

    def __init__(self, attribute: constants.ResourceAttribute) -> None:
        self.attribute = attribute

    def __str__(self) -> str:
        attr = self.attribute
        if isinstance(attr, int):
            try:
                name = attributes.AttributesByID[attr].visa_name
            except KeyError:
                name = "Name not found"

            return "Unknown attribute %s (%s - %s)" % (attr, hex(attr), name)
{'fraction_non_alphanumeric': 0.09634551495016612, 'fraction_numerical': 0.007475083056478406, 'mean_word_length': 3.317204301075269, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1963238', 'n_tokens_mistral': 682, 'n_tokens_neox': 646, 'n_words': 250}