mirror of https://github.com/nucypher/nucypher.git
Fix I001 (import sorting) errors
parent
7554837934
commit
a457245501
|
@ -2,10 +2,16 @@
|
|||
|
||||
|
||||
from nucypher.__about__ import (
|
||||
__author__, __license__, __summary__, __title__, __version__, __copyright__, __email__, __url__
|
||||
__author__,
|
||||
__copyright__,
|
||||
__email__,
|
||||
__license__,
|
||||
__summary__,
|
||||
__title__,
|
||||
__url__,
|
||||
__version__,
|
||||
)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"__title__", "__summary__", "__version__", "__author__", "__license__", "__copyright__", "__email__", "__url__"
|
||||
]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
|
||||
import json
|
||||
import random
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
import random
|
||||
|
||||
_HERE = Path(__file__).parent
|
||||
with open(_HERE / 'web_colors.json') as f:
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
from typing import Tuple, Optional
|
||||
from typing import Optional, Tuple
|
||||
|
||||
from web3 import Web3
|
||||
from web3.types import Wei
|
||||
|
||||
from nucypher.blockchain.eth.agents import (
|
||||
ContractAgency,
|
||||
PREApplicationAgent
|
||||
)
|
||||
from nucypher.blockchain.eth.agents import ContractAgency, PREApplicationAgent
|
||||
from nucypher.blockchain.eth.registry import BaseContractRegistry
|
||||
from nucypher.blockchain.eth.token import TToken
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
|
||||
|
||||
from pathlib import Path
|
||||
from constant_sorrow.constants import (NO_BLOCKCHAIN_CONNECTION)
|
||||
|
||||
from constant_sorrow.constants import NO_BLOCKCHAIN_CONNECTION
|
||||
|
||||
# TODO: Move to constants.py?
|
||||
BASE_DIRECTORY = Path(__file__).parent
|
||||
|
|
|
@ -6,8 +6,11 @@ from dataclasses import dataclass, field
|
|||
from itertools import accumulate
|
||||
from typing import Any, Dict, Iterable, List, NamedTuple, Optional, Tuple, Type, cast
|
||||
|
||||
from constant_sorrow.constants import CONTRACT_ATTRIBUTE # type: ignore
|
||||
from constant_sorrow.constants import CONTRACT_CALL, TRANSACTION
|
||||
from constant_sorrow.constants import (
|
||||
CONTRACT_ATTRIBUTE, # type: ignore
|
||||
CONTRACT_CALL,
|
||||
TRANSACTION,
|
||||
)
|
||||
from eth_typing.evm import ChecksumAddress
|
||||
from eth_utils.address import to_checksum_address
|
||||
from nucypher_core import SessionStaticKey
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from eth_tester import EthereumTester, PyEVMBackend
|
||||
from eth_tester.backends.mock.main import MockBackend
|
||||
from typing import Union
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from eth_tester import EthereumTester, PyEVMBackend
|
||||
from eth_tester.backends.mock.main import MockBackend
|
||||
from web3 import HTTPProvider, IPCProvider, WebsocketProvider
|
||||
from web3.providers import BaseProvider
|
||||
from web3.providers.eth_tester.main import EthereumTesterProvider
|
||||
|
@ -43,7 +44,7 @@ def _get_auto_provider(eth_provider_uri) -> BaseProvider:
|
|||
def _get_pyevm_test_backend() -> PyEVMBackend:
|
||||
try:
|
||||
# TODO: Consider packaged support of --dev mode with testerchain
|
||||
from tests.constants import PYEVM_GAS_LIMIT, NUMBER_OF_ETH_TEST_ACCOUNTS
|
||||
from tests.constants import NUMBER_OF_ETH_TEST_ACCOUNTS, PYEVM_GAS_LIMIT
|
||||
except ImportError:
|
||||
raise DevelopmentInstallationRequired(importable_name='tests.constants')
|
||||
|
||||
|
|
|
@ -29,7 +29,10 @@ class Web3Signer(Signer):
|
|||
|
||||
@classmethod
|
||||
def from_signer_uri(cls, uri: str, testnet: bool = False) -> 'Web3Signer':
|
||||
from nucypher.blockchain.eth.interfaces import BlockchainInterface, BlockchainInterfaceFactory
|
||||
from nucypher.blockchain.eth.interfaces import (
|
||||
BlockchainInterface,
|
||||
BlockchainInterfaceFactory,
|
||||
)
|
||||
try:
|
||||
blockchain = BlockchainInterfaceFactory.get_or_create_interface(eth_provider_uri=uri)
|
||||
except BlockchainInterface.UnsupportedProvider:
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
import maya
|
||||
from hexbytes import HexBytes
|
||||
import random
|
||||
from typing import Callable, Dict
|
||||
|
||||
import random
|
||||
|
||||
import maya
|
||||
from constant_sorrow.constants import NOT_STAKING, UNTRACKED_PENDING_TRANSACTION
|
||||
from hexbytes import HexBytes
|
||||
from twisted.internet import reactor, task
|
||||
from web3.exceptions import TransactionNotFound
|
||||
|
||||
from nucypher.blockchain.eth.constants import AVERAGE_BLOCK_TIME_IN_SECONDS, NULL_ADDRESS
|
||||
from nucypher.blockchain.eth.constants import (
|
||||
AVERAGE_BLOCK_TIME_IN_SECONDS,
|
||||
NULL_ADDRESS,
|
||||
)
|
||||
from nucypher.utilities.gas_strategies import EXPECTED_CONFIRMATION_TIME_IN_SECONDS
|
||||
from nucypher.utilities.logging import Logger
|
||||
from constant_sorrow.constants import NOT_STAKING, UNTRACKED_PENDING_TRANSACTION
|
||||
|
||||
|
||||
class WorkTrackerBase:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
|
||||
import time
|
||||
from typing import Callable, Any, Union
|
||||
from typing import Any, Callable, Union
|
||||
|
||||
from requests import HTTPError
|
||||
from web3 import Web3
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
import nucypher
|
||||
|
||||
|
||||
NU_BANNER = r'''
|
||||
|
||||
███╗ ██╗██╗ ██╗
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from copy import copy
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from eth_tester.exceptions import ValidationError
|
||||
from nucypher_core import NodeMetadata
|
||||
from unittest.mock import patch, Mock
|
||||
|
||||
from nucypher.blockchain.eth.signers.software import Web3Signer
|
||||
from nucypher.characters.lawful import Alice, Ursula
|
||||
|
|
|
@ -11,21 +11,27 @@ from web3.main import Web3
|
|||
from nucypher.blockchain.eth.agents import ContractAgency, NucypherTokenAgent
|
||||
from nucypher.blockchain.eth.interfaces import BlockchainInterfaceFactory
|
||||
from nucypher.blockchain.eth.networks import NetworksInventory
|
||||
from nucypher.blockchain.eth.registry import InMemoryContractRegistry, BaseContractRegistry
|
||||
from nucypher.blockchain.eth.registry import (
|
||||
BaseContractRegistry,
|
||||
InMemoryContractRegistry,
|
||||
)
|
||||
from nucypher.blockchain.eth.signers.base import Signer
|
||||
from nucypher.blockchain.eth.token import NU
|
||||
from nucypher.cli.actions.configure import get_config_filepaths
|
||||
from nucypher.cli.literature import (
|
||||
DEFAULT_TO_LONE_CONFIG_FILE,
|
||||
GENERIC_SELECT_ACCOUNT,
|
||||
IGNORE_OLD_CONFIGURATION,
|
||||
NO_CONFIGURATIONS_ON_DISK,
|
||||
NO_ETH_ACCOUNTS,
|
||||
SELECT_NETWORK,
|
||||
SELECTED_ACCOUNT,
|
||||
IGNORE_OLD_CONFIGURATION,
|
||||
DEFAULT_TO_LONE_CONFIG_FILE
|
||||
)
|
||||
from nucypher.config.base import CharacterConfiguration
|
||||
from nucypher.config.constants import NUCYPHER_ENVVAR_OPERATOR_ADDRESS, DEFAULT_CONFIG_ROOT
|
||||
from nucypher.config.constants import (
|
||||
DEFAULT_CONFIG_ROOT,
|
||||
NUCYPHER_ENVVAR_OPERATOR_ADDRESS,
|
||||
)
|
||||
from nucypher.utilities.emitters import StdoutEmitter
|
||||
|
||||
|
||||
|
|
|
@ -11,13 +11,11 @@ from nucypher.cli.actions.auth import (
|
|||
from nucypher.cli.actions.configure import (
|
||||
collect_operator_ip_address,
|
||||
destroy_configuration,
|
||||
)
|
||||
from nucypher.cli.actions.configure import forget as forget_nodes
|
||||
from nucypher.cli.actions.configure import (
|
||||
get_or_update_configuration,
|
||||
handle_missing_configuration_file,
|
||||
perform_startup_ip_check,
|
||||
)
|
||||
from nucypher.cli.actions.configure import forget as forget_nodes
|
||||
from nucypher.cli.actions.select import (
|
||||
select_client_account,
|
||||
select_config_file,
|
||||
|
|
|
@ -2,10 +2,7 @@ import click
|
|||
from constant_sorrow.constants import NO_KEYSTORE_ATTACHED
|
||||
|
||||
from nucypher.characters.banners import NUCYPHER_BANNER
|
||||
from nucypher.config.constants import (
|
||||
DEFAULT_CONFIG_ROOT,
|
||||
USER_LOG_DIR
|
||||
)
|
||||
from nucypher.config.constants import DEFAULT_CONFIG_ROOT, USER_LOG_DIR
|
||||
|
||||
|
||||
def echo_version(ctx, param, value):
|
||||
|
|
|
@ -14,7 +14,7 @@ from nucypher.blockchain.economics import Economics
|
|||
from nucypher.blockchain.eth.networks import NetworksInventory
|
||||
from nucypher.blockchain.eth.token import TToken
|
||||
from nucypher.policy.payment import PAYMENT_METHODS
|
||||
from nucypher.utilities.networking import validate_operator_ip, InvalidOperatorIP
|
||||
from nucypher.utilities.networking import InvalidOperatorIP, validate_operator_ip
|
||||
|
||||
|
||||
class ChecksumAddress(click.ParamType):
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
|
||||
|
||||
import click
|
||||
import os
|
||||
import shutil
|
||||
from distutils.util import strtobool
|
||||
from pathlib import Path
|
||||
from typing import Dict, Optional, Tuple
|
||||
|
||||
import click
|
||||
from web3.types import BlockIdentifier
|
||||
|
||||
from nucypher.blockchain.eth.agents import EthereumContractAgent
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
import datetime
|
||||
from ipaddress import IPv4Address
|
||||
from pathlib import Path
|
||||
from typing import ClassVar, Optional, Tuple
|
||||
|
||||
from cryptography import x509
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.hazmat.backends.openssl.ec import _EllipticCurvePrivateKey
|
||||
|
@ -8,9 +12,6 @@ from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve
|
|||
from cryptography.hazmat.primitives.serialization import Encoding
|
||||
from cryptography.x509 import Certificate
|
||||
from cryptography.x509.oid import NameOID
|
||||
from ipaddress import IPv4Address
|
||||
from pathlib import Path
|
||||
from typing import ClassVar, Optional, Tuple
|
||||
|
||||
_TLS_CERTIFICATE_ENCODING = Encoding.PEM
|
||||
_TLS_CURVE = ec.SECP384R1
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import requests
|
||||
import socket
|
||||
|
||||
import requests
|
||||
|
||||
NodeSeemsToBeDown = (
|
||||
requests.exceptions.ConnectionError,
|
||||
requests.exceptions.ReadTimeout,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
|
||||
import os
|
||||
|
||||
from hendrix.facilities.resources import MediaResource
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
|
||||
from eth_typing.evm import ChecksumAddress
|
||||
from eth_utils import to_checksum_address, to_canonical_address
|
||||
|
||||
from eth_utils import to_canonical_address, to_checksum_address
|
||||
from nucypher_core import Address, RevocationOrder
|
||||
|
||||
from nucypher.crypto.signing import SignatureStamp
|
||||
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import io
|
|||
import sys
|
||||
import traceback
|
||||
from queue import Queue
|
||||
from threading import Thread, Event, Lock
|
||||
from typing import Callable, List, Any, Optional, Dict
|
||||
from threading import Event, Lock, Thread
|
||||
from typing import Any, Callable, Dict, List, Optional
|
||||
|
||||
from constant_sorrow.constants import PRODUCER_STOPPED, TIMEOUT_TRIGGERED
|
||||
from twisted.python.threadpool import ThreadPool
|
||||
|
|
|
@ -5,9 +5,9 @@ from difflib import get_close_matches
|
|||
from typing import Optional
|
||||
|
||||
import requests
|
||||
from constant_sorrow.constants import SLOW, MEDIUM, FAST, FASTEST
|
||||
from constant_sorrow.constants import FAST, FASTEST, MEDIUM, SLOW
|
||||
from web3 import Web3
|
||||
from web3.types import Wei, TxParams
|
||||
from web3.types import TxParams, Wei
|
||||
|
||||
|
||||
class Datafeed(ABC):
|
||||
|
|
|
@ -7,12 +7,9 @@ from web3 import Web3
|
|||
from web3.exceptions import ValidationError
|
||||
from web3.gas_strategies import time_based
|
||||
from web3.gas_strategies.rpc import rpc_gas_price_strategy
|
||||
from web3.types import Wei, TxParams
|
||||
from web3.types import TxParams, Wei
|
||||
|
||||
from nucypher.utilities.datafeeds import (
|
||||
UpvestGasPriceDatafeed,
|
||||
ZoltuGasPriceDatafeed
|
||||
)
|
||||
from nucypher.utilities.datafeeds import UpvestGasPriceDatafeed, ZoltuGasPriceDatafeed
|
||||
|
||||
|
||||
class GasStrategyError(RuntimeError):
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
|
||||
import pathlib
|
||||
from contextlib import contextmanager
|
||||
|
||||
from twisted.logger import (
|
||||
FileLogObserver,
|
||||
LogLevel,
|
||||
formatEvent,
|
||||
formatEventAsClassicLogText,
|
||||
globalLogPublisher,
|
||||
jsonFileLogObserver,
|
||||
LogLevel,
|
||||
)
|
||||
from twisted.logger import Logger as TwistedLogger
|
||||
from twisted.python.logfile import LogFile
|
||||
|
@ -136,7 +137,7 @@ class _SentryInitGuard:
|
|||
|
||||
def sentry_observer(event):
|
||||
try:
|
||||
from sentry_sdk import capture_exception, add_breadcrumb
|
||||
from sentry_sdk import add_breadcrumb, capture_exception
|
||||
except ImportError:
|
||||
raise ImportError('Sentry SDK is not installed. Please install it and try again.')
|
||||
|
||||
|
|
Loading…
Reference in New Issue