mirror of https://github.com/nucypher/nucypher.git
Linting and Newsfrag for PR #3315
parent
f4caacc4b1
commit
0c528eaa7a
|
@ -1,6 +1,7 @@
|
|||
from cytoolz.functoolz import memoize
|
||||
from enum import Enum
|
||||
from typing import NamedTuple, Dict, Any
|
||||
from typing import Any, Dict, NamedTuple
|
||||
|
||||
from cytoolz.functoolz import memoize
|
||||
|
||||
|
||||
class UnrecognizedTacoDomain(Exception):
|
||||
|
@ -24,7 +25,6 @@ class PolygonChain(ChainInfo, Enum):
|
|||
|
||||
|
||||
class TACoDomain:
|
||||
|
||||
def __init__(self, name: str, eth_chain: EthChain, polygon_chain: PolygonChain):
|
||||
self.name = name
|
||||
self.eth_chain = eth_chain
|
||||
|
@ -77,8 +77,9 @@ TAPIR = TACoDomain(
|
|||
|
||||
DEFAULT_DOMAIN: TACoDomain = MAINNET
|
||||
|
||||
SUPPORTED_DOMAINS: Dict[str, TACoDomain] = {str(domain): domain for domain in (MAINNET, LYNX, TAPIR)}
|
||||
|
||||
SUPPORTED_DOMAINS: Dict[str, TACoDomain] = {
|
||||
str(domain): domain for domain in (MAINNET, LYNX, TAPIR)
|
||||
}
|
||||
|
||||
|
||||
@memoize
|
||||
|
|
|
@ -1,7 +1,23 @@
|
|||
import contextlib
|
||||
import json
|
||||
import maya
|
||||
import time
|
||||
from pathlib import Path
|
||||
from queue import Queue
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
Dict,
|
||||
Iterable,
|
||||
List,
|
||||
NamedTuple,
|
||||
Optional,
|
||||
Sequence,
|
||||
Set,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
import maya
|
||||
from constant_sorrow import constants
|
||||
from constant_sorrow.constants import (
|
||||
INVALIDATED,
|
||||
|
@ -48,28 +64,13 @@ from nucypher_core.umbral import (
|
|||
VerifiedKeyFrag,
|
||||
reencrypt,
|
||||
)
|
||||
from pathlib import Path
|
||||
from queue import Queue
|
||||
from twisted.internet import reactor
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
Dict,
|
||||
Iterable,
|
||||
List,
|
||||
NamedTuple,
|
||||
Optional,
|
||||
Sequence,
|
||||
Set,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
from web3.types import TxReceipt
|
||||
|
||||
import nucypher
|
||||
from nucypher.acumen.nicknames import Nickname
|
||||
from nucypher.acumen.perception import ArchivedFleetState, RemoteUrsulaStatus
|
||||
from nucypher.blockchain.eth import actors, domains
|
||||
from nucypher.blockchain.eth import actors
|
||||
from nucypher.blockchain.eth.actors import Operator
|
||||
from nucypher.blockchain.eth.agents import (
|
||||
ContractAgency,
|
||||
|
@ -1006,9 +1007,7 @@ class Ursula(Teacher, Character, Operator):
|
|||
if discovery and not self.lonely:
|
||||
self.start_learning_loop(now=eager)
|
||||
if emitter:
|
||||
emitter.message(
|
||||
f"✓ Node Discovery ({self.domain})", color="green"
|
||||
)
|
||||
emitter.message(f"✓ Node Discovery ({self.domain})", color="green")
|
||||
|
||||
if ritual_tracking:
|
||||
self.ritual_tracker.start()
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
import time
|
||||
from collections import defaultdict, deque
|
||||
from contextlib import suppress
|
||||
from pathlib import Path
|
||||
from queue import Queue
|
||||
from typing import Callable, List, Optional, Set, Tuple
|
||||
|
||||
import maya
|
||||
import requests
|
||||
import time
|
||||
from constant_sorrow.constants import (
|
||||
CERTIFICATE_NOT_SAVED,
|
||||
FLEET_STATES_MATCH,
|
||||
|
@ -10,18 +14,14 @@ from constant_sorrow.constants import (
|
|||
NOT_SIGNED,
|
||||
RELAX,
|
||||
)
|
||||
from contextlib import suppress
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.x509 import Certificate, load_der_x509_certificate
|
||||
from eth_utils import to_checksum_address
|
||||
from nucypher_core import MetadataResponse, MetadataResponsePayload, NodeMetadata
|
||||
from nucypher_core.umbral import Signature
|
||||
from pathlib import Path
|
||||
from queue import Queue
|
||||
from requests.exceptions import SSLError
|
||||
from twisted.internet import reactor, task
|
||||
from twisted.internet.defer import Deferred
|
||||
from typing import Callable, List, Optional, Set, Tuple
|
||||
|
||||
from nucypher import characters
|
||||
from nucypher.acumen.nicknames import Nickname
|
||||
|
@ -29,7 +29,6 @@ from nucypher.acumen.perception import FleetSensor
|
|||
from nucypher.blockchain.eth import domains
|
||||
from nucypher.blockchain.eth.agents import ContractAgency, TACoApplicationAgent
|
||||
from nucypher.blockchain.eth.constants import NULL_ADDRESS
|
||||
from nucypher.blockchain.eth.domains import TACoDomain
|
||||
from nucypher.blockchain.eth.registry import ContractRegistry
|
||||
from nucypher.config.constants import SeednodeMetadata
|
||||
from nucypher.config.storages import ForgetfulNodeStorage
|
||||
|
@ -279,7 +278,9 @@ class Learner:
|
|||
|
||||
self._abort_on_learning_error = abort_on_learning_error
|
||||
|
||||
self.__known_nodes = self.tracker_class(domain=self.domain, this_node=self if include_self_in_the_state else None)
|
||||
self.__known_nodes = self.tracker_class(
|
||||
domain=self.domain, this_node=self if include_self_in_the_state else None
|
||||
)
|
||||
self._verify_node_bonding = verify_node_bonding
|
||||
|
||||
self.lonely = lonely
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import pytest
|
||||
import random
|
||||
|
||||
import pytest
|
||||
from web3 import Web3
|
||||
|
||||
import tests
|
||||
|
@ -20,8 +21,9 @@ from tests.constants import (
|
|||
BONUS_TOKENS_FOR_TESTS,
|
||||
INSECURE_DEVELOPMENT_PASSWORD,
|
||||
MIN_OPERATOR_SECONDS,
|
||||
TEMPORARY_DOMAIN,
|
||||
TEST_ETH_PROVIDER_URI,
|
||||
TESTERCHAIN_CHAIN_ID, TEMPORARY_DOMAIN,
|
||||
TESTERCHAIN_CHAIN_ID,
|
||||
)
|
||||
from tests.utils.blockchain import TesterBlockchain
|
||||
from tests.utils.registry import ApeRegistrySource
|
||||
|
@ -411,8 +413,7 @@ def mock_condition_blockchains(module_mocker):
|
|||
)
|
||||
|
||||
module_mocker.patch(
|
||||
"nucypher.blockchain.eth.domains.get_domain",
|
||||
return_value=TEMPORARY_DOMAIN
|
||||
"nucypher.blockchain.eth.domains.get_domain", return_value=TEMPORARY_DOMAIN
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@ from nucypher.blockchain.eth.domains import ChainInfo, TACoDomain
|
|||
from nucypher.blockchain.eth.token import NU
|
||||
from nucypher.config.constants import (
|
||||
NUCYPHER_ENVVAR_KEYSTORE_PASSWORD,
|
||||
NUCYPHER_ENVVAR_OPERATOR_ETH_PASSWORD, TEMPORARY_DOMAIN_NAME,
|
||||
NUCYPHER_ENVVAR_OPERATOR_ETH_PASSWORD,
|
||||
TEMPORARY_DOMAIN_NAME,
|
||||
)
|
||||
|
||||
#
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
import contextlib
|
||||
import json
|
||||
import maya
|
||||
import os
|
||||
import pytest
|
||||
import shutil
|
||||
import tempfile
|
||||
from click.testing import CliRunner
|
||||
from datetime import timedelta
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
from typing import Tuple
|
||||
|
||||
import maya
|
||||
import pytest
|
||||
from click.testing import CliRunner
|
||||
from eth_account import Account
|
||||
from eth_utils import to_checksum_address
|
||||
from functools import partial
|
||||
from nucypher_core.ferveo import AggregatedTranscript, DkgPublicKey, Keypair, Validator
|
||||
from pathlib import Path
|
||||
from twisted.internet.task import Clock
|
||||
from typing import Tuple
|
||||
from web3 import Web3
|
||||
|
||||
import tests
|
||||
|
@ -48,8 +49,10 @@ from tests.constants import (
|
|||
MOCK_CUSTOM_INSTALLATION_PATH,
|
||||
MOCK_CUSTOM_INSTALLATION_PATH_2,
|
||||
MOCK_ETH_PROVIDER_URI,
|
||||
TEMPORARY_DOMAIN,
|
||||
TEST_ETH_PROVIDER_URI,
|
||||
TESTERCHAIN_CHAIN_ID, TEMPORARY_DOMAIN, )
|
||||
TESTERCHAIN_CHAIN_ID,
|
||||
)
|
||||
from tests.mock.interfaces import MockBlockchain
|
||||
from tests.mock.performance_mocks import (
|
||||
mock_cert_generation,
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import os
|
||||
import pytest
|
||||
from eth_account.account import Account
|
||||
from pathlib import Path
|
||||
from typing import Iterable, Optional
|
||||
|
||||
import pytest
|
||||
from eth_account.account import Account
|
||||
|
||||
from nucypher.blockchain.eth.actors import Operator
|
||||
from nucypher.blockchain.eth.agents import (
|
||||
ContractAgency,
|
||||
|
@ -31,7 +32,8 @@ from tests.constants import (
|
|||
KEYFILE_NAME_TEMPLATE,
|
||||
MOCK_KEYSTORE_PATH,
|
||||
NUMBER_OF_MOCK_KEYSTORE_ACCOUNTS,
|
||||
TESTERCHAIN_CHAIN_ID, TEMPORARY_DOMAIN,
|
||||
TEMPORARY_DOMAIN,
|
||||
TESTERCHAIN_CHAIN_ID,
|
||||
)
|
||||
from tests.mock.interfaces import MockBlockchain
|
||||
from tests.mock.io import MockStdinWrapper
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import pytest
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
import tests
|
||||
from nucypher.acumen.perception import FleetSensor
|
||||
from nucypher.blockchain.eth.domains import TACoDomain
|
||||
|
@ -8,7 +9,7 @@ from nucypher.blockchain.eth.registry import ContractRegistry
|
|||
from nucypher.characters.lawful import Ursula
|
||||
from nucypher.config.storages import LocalFileBasedNodeStorage
|
||||
from nucypher.network.nodes import TEACHER_NODES
|
||||
from tests.constants import TESTERCHAIN_CHAIN_INFO, TEMPORARY_DOMAIN
|
||||
from tests.constants import TEMPORARY_DOMAIN, TESTERCHAIN_CHAIN_INFO
|
||||
from tests.utils.registry import MockRegistrySource
|
||||
from tests.utils.ursula import make_ursulas
|
||||
|
||||
|
@ -31,7 +32,6 @@ def domain_2():
|
|||
)
|
||||
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def test_registry(module_mocker, domain_1, domain_2):
|
||||
with tests.utils.registry.mock_registry_sources(
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from collections import defaultdict
|
||||
from contextlib import contextmanager
|
||||
from typing import List
|
||||
|
||||
from ape.contracts import ContractInstance
|
||||
from contextlib import contextmanager
|
||||
from eth_utils import to_checksum_address
|
||||
from typing import List
|
||||
|
||||
from nucypher.blockchain.eth.domains import TACoDomain
|
||||
from nucypher.blockchain.eth.registry import (
|
||||
|
@ -21,7 +21,7 @@ def mock_registry_sources(mocker, _domains: List[TACoDomain] = None):
|
|||
_domains = [TEMPORARY_DOMAIN]
|
||||
|
||||
_supported_domains = mocker.patch.dict(
|
||||
'nucypher.blockchain.eth.domains.SUPPORTED_DOMAINS',
|
||||
"nucypher.blockchain.eth.domains.SUPPORTED_DOMAINS",
|
||||
{str(domain): domain for domain in _domains},
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue