A few typos and naming fixes pointed out in RFCs.

pull/1741/head
jMyles 2020-09-01 20:32:33 -07:00
parent 263c7a37a8
commit 2f3eeaca85
4 changed files with 9 additions and 9 deletions

View File

@ -884,7 +884,7 @@ class Bob(Character):
# Sanity check - do we even have enough nodes? # Sanity check - do we even have enough nodes?
if len(nodes) < no_less_than: if len(nodes) < no_less_than:
raise ValueError(f"Can't select {no_less_than} from {len(nodes)} (Fleet state: {nodes.FleetState}") raise ValueError(f"Can't select {no_less_than} from {len(nodes)} (Fleet state: {nodes.FleetState})")
search_boundary = 2 search_boundary = 2
target_nodes = [] target_nodes = []
@ -1645,7 +1645,7 @@ class Enrico(Character):
def __init__(self, policy_encrypting_key=None, controller: bool = True, *args, **kwargs): def __init__(self, policy_encrypting_key=None, controller: bool = True, *args, **kwargs):
self._policy_pubkey = policy_encrypting_key self._policy_pubkey = policy_encrypting_key
# Encrico never uses the blockchain, hence federated_only) # Enrico never uses the blockchain, hence federated_only)
kwargs['federated_only'] = True kwargs['federated_only'] = True
kwargs['known_node_class'] = None kwargs['known_node_class'] = None
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)

View File

@ -293,7 +293,7 @@ class Learner:
if self.learning_domains: if self.learning_domains:
one_and_only_learning_domain = tuple(self.learning_domains)[ one_and_only_learning_domain = tuple(self.learning_domains)[
0] # TODO: Are we done with multiple domains? 2144 0] # TODO: Are we done with multiple domains? 2144, 1580
canonical_sage_uris = self.network_middleware.TEACHER_NODES.get(one_and_only_learning_domain, ()) canonical_sage_uris = self.network_middleware.TEACHER_NODES.get(one_and_only_learning_domain, ())
for uri in canonical_sage_uris: for uri in canonical_sage_uris:

View File

@ -235,7 +235,7 @@ class TreasureMap:
try: try:
return self.public_id() == other.public_id() return self.public_id() == other.public_id()
except AttributeError: except AttributeError:
raise TypeError(f"Can't compare f{other} to a TreasureMap (it needs to implement public_id() )") raise TypeError(f"Can't compare {other} to a TreasureMap (it needs to implement public_id() )")
def __iter__(self): def __iter__(self):
return iter(self.destinations.items()) return iter(self.destinations.items())

View File

@ -182,7 +182,7 @@ class NodeEngagementMutex:
log = Logger("Policy") log = Logger("Policy")
def __init__(self, def __init__(self,
f, # TODO: typing.Protocol callable_to_engage, # TODO: typing.Protocol
nodes, nodes,
network_middleware, network_middleware,
percent_to_complete_before_release=5, percent_to_complete_before_release=5,
@ -190,7 +190,7 @@ class NodeEngagementMutex:
threadpool_size=120, threadpool_size=120,
*args, *args,
**kwargs): **kwargs):
self.f = f self.f = callable_to_engage
self.nodes = nodes self.nodes = nodes
self.network_middleware = network_middleware self.network_middleware = network_middleware
self.args = args self.args = args
@ -211,9 +211,9 @@ class NodeEngagementMutex:
self.when_complete = Deferred() # TODO: Allow cancelling via KB Interrupt or some other way? self.when_complete = Deferred() # TODO: Allow cancelling via KB Interrupt or some other way?
if note is None: if note is None:
self._repr = f"{f} to {len(nodes)} nodes" self._repr = f"{callable_to_engage} to {len(nodes)} nodes"
else: else:
self._repr = f"{note}: {f} to {len(nodes)} nodes" self._repr = f"{note}: {callable_to_engage} to {len(nodes)} nodes"
self._threadpool = ThreadPool(minthreads=threadpool_size, maxthreads=threadpool_size, name=self._repr) self._threadpool = ThreadPool(minthreads=threadpool_size, maxthreads=threadpool_size, name=self._repr)
self.log.info(f"NEM spinning up {self._threadpool}") self.log.info(f"NEM spinning up {self._threadpool}")
@ -412,7 +412,7 @@ class Policy(ABC):
self.alice.block_until_number_of_known_nodes_is(8, timeout=2, learn_on_this_thread=True) self.alice.block_until_number_of_known_nodes_is(8, timeout=2, learn_on_this_thread=True)
target_nodes = self.bob.matching_nodes_among(self.alice.known_nodes) target_nodes = self.bob.matching_nodes_among(self.alice.known_nodes)
self.publishing_mutex = NodeEngagementMutex(f=self.put_treasure_map_on_node, self.publishing_mutex = NodeEngagementMutex(callable_to_engage=self.put_treasure_map_on_node,
nodes=target_nodes, nodes=target_nodes,
network_middleware=network_middleware) network_middleware=network_middleware)