be explicit about ignoring params

This commit is contained in:
Victor Shyba 2021-12-03 15:42:20 -03:00
parent 87ff3f95ff
commit 1c857b8dd8

View file

@ -30,7 +30,7 @@ class SimpleMetrics:
self.prometheus_port = port
self.dht_node: Node = node
async def handle_metrics_get_request(self, request: web.Request):
async def handle_metrics_get_request(self, _):
try:
return web.Response(
text=prom_generate_latest().decode(),
@ -40,7 +40,7 @@ class SimpleMetrics:
log.exception('could not generate prometheus data')
raise
async def handle_peers_csv(self, request: web.Request):
async def handle_peers_csv(self, _):
out = StringIO()
writer = csv.DictWriter(out, fieldnames=["ip", "port", "dht_id"])
writer.writeheader()
@ -48,7 +48,7 @@ class SimpleMetrics:
writer.writerow({"ip": peer.address, "port": peer.udp_port, "dht_id": peer.node_id.hex()})
return web.Response(text=out.getvalue(), content_type='text/csv')
async def handle_blobs_csv(self, request: web.Request):
async def handle_blobs_csv(self, _):
out = StringIO()
writer = csv.DictWriter(out, fieldnames=["blob_hash"])
writer.writeheader()
@ -56,7 +56,7 @@ class SimpleMetrics:
writer.writerow({"blob_hash": blob.hex()})
return web.Response(text=out.getvalue(), content_type='text/csv')
async def active_estimation(self, request: web.Request):
async def active_estimation(self, _):
# - "crawls" the network for peers close to our node id (not a full aggressive crawler yet)
# given everything is random, the odds of a peer having the same X prefix bits matching ours is roughly 1/(2^X)
# we use that to estimate the network size, see issue #3463 for related papers and details
@ -65,7 +65,7 @@ class SimpleMetrics:
close_ids = [peer for peer in peers if peer.node_id[0] == self.dht_node.protocol.node_id[0]]
return web.json_response({"total": len(peers), "close": len(close_ids)})
async def passive_estimation(self, request: web.Request):
async def passive_estimation(self, _):
# same method as above but instead we use the routing table and assume our implementation was able to add
# all the reachable close peers, which should be usable for seed nodes since they are super popular
total_peers = self.dht_node.protocol.routing_table.get_peers()