removes dead code

remotes/origin/v7.4.x
Kieran Prasch 2023-10-25 20:17:59 +02:00 committed by Derek Pierre
parent 9e6bc1dbc7
commit 32fb9f5742
3 changed files with 6 additions and 44 deletions

View File

@ -1,9 +1,8 @@
from pathlib import Path
from typing import ClassVar, Dict, List, Optional, Union
from constant_sorrow.constants import NO_NICKNAME, NO_SIGNING_POWER, STRANGER
from eth_utils import to_canonical_address
from nucypher_core.umbral import PublicKey
from typing import ClassVar, Dict, List, Optional
from typing import Union
from nucypher.acumen.nicknames import Nickname
from nucypher.blockchain.eth import domains
@ -208,10 +207,6 @@ class Character(Learner):
# TODO: This is wasteful. #1995
return to_canonical_address(str(self.checksum_address))
@classmethod
def from_config(cls, config, **overrides) -> 'Character':
return config.produce(**overrides)
@classmethod
def from_public_keys(cls,
powers_and_material: Dict = None,
@ -257,25 +252,6 @@ class Character(Learner):
**kwargs,
)
def _set_known_node_class(self, known_node_class):
"""
Once in a while, in tests or demos, we init a plain Character who doesn't already know about its node class.
"""
if not known_node_class:
from nucypher.characters.lawful import Ursula
known_node_class = Ursula
self.known_node_class = known_node_class
# TODO: Unused
def store_metadata(self, filepath: Path) -> Path:
"""
Save this node to the disk.
:param filepath: Output filepath to save node metadata.
:return: Output filepath
"""
return self.node_storage.store_node_metadata(node=self, filepath=filepath)
def public_keys(self, power_up_class: ClassVar):
"""
Pass a power_up_class, get the public material for this Character which corresponds to that

View File

@ -1,7 +1,6 @@
import contextlib
import json
import time
from pathlib import Path
from queue import Queue
from typing import (
Any,
@ -26,7 +25,7 @@ from constant_sorrow.constants import (
STRANGER_ALICE,
)
from cryptography.hazmat.primitives.serialization import Encoding
from cryptography.x509 import Certificate, NameOID
from cryptography.x509 import Certificate
from eth_typing.evm import ChecksumAddress
from eth_utils import to_checksum_address
from nucypher_core import (
@ -797,7 +796,6 @@ class Ursula(Teacher, Character, Operator):
operator_address: Optional[ChecksumAddress] = None,
client_password: Optional[str] = None,
transacting_power: Optional[TransactingPower] = None,
operator_signature_from_metadata=NOT_SIGNED,
eth_endpoint: Optional[str] = None,
polygon_endpoint: Optional[str] = None,
condition_blockchain_endpoints: Optional[Dict[int, List[str]]] = None,
@ -847,9 +845,8 @@ class Ursula(Teacher, Character, Operator):
)
except Exception:
# TODO: Move this lower to encapsulate the Operator init in a try/except block.
# TODO: Do not announce self to "other nodes" until this init is finished.
# It's not possible to finish constructing this node.
# It's not possible to finish constructing this node...
# This block is here to ensure that the reactor is stopped in tests.
self.stop(halt_reactor=False)
raise
@ -875,10 +872,7 @@ class Ursula(Teacher, Character, Operator):
self.__operator_address = None
# Teacher (All Modes)
Teacher.__init__(
self,
certificate=certificate,
)
Teacher.__init__(self, certificate=certificate)
self._prometheus_metrics_tracker = None

View File

@ -710,11 +710,6 @@ class Learner:
self._LONG_LEARNING_DELAY))
self._learning_task.interval = self._LONG_LEARNING_DELAY
def network_bootstrap(self, node_list: list) -> None:
for node_addr, port in node_list:
new_nodes = self.learn_about_nodes_now(node_addr, port)
self.__known_nodes.update(new_nodes)
def get_nodes_by_ids(self, node_ids):
for node_id in node_ids:
try:
@ -727,9 +722,6 @@ class Learner:
# Scenario 3: We don't know about this node, and neither does our friend.
def write_node_metadata(self, node, serializer=bytes) -> str:
return self.node_storage.set(node=node)
def verify_from(
self,
stranger: "characters.base.Character",