GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit b1c0f0d0 authored by juga  's avatar juga

chg: resultdump: Remove `_count` from attributes

Tests wont' pass with this commit, they'll be fixed in the next commits
parent c7c91370
...@@ -225,9 +225,9 @@ class Result: ...@@ -225,9 +225,9 @@ class Result:
consensus_bandwidth_is_unmeasured=None, consensus_bandwidth_is_unmeasured=None,
# Counters to be stored by relay and not per measurement, # Counters to be stored by relay and not per measurement,
# since the measurements might fail. # since the measurements might fail.
relay_in_recent_consensus_count=None, relay_in_recent_consensus=None,
relay_recent_measurement_attempt_count=None, relay_recent_measurement_attempt=None,
relay_recent_priority_list_count=None): relay_recent_priority_list=None):
""" """
Initializes a ``Result.Relay``. Initializes a ``Result.Relay``.
...@@ -247,15 +247,14 @@ class Result: ...@@ -247,15 +247,14 @@ class Result:
self.consensus_bandwidth = consensus_bandwidth self.consensus_bandwidth = consensus_bandwidth
self.consensus_bandwidth_is_unmeasured = \ self.consensus_bandwidth_is_unmeasured = \
consensus_bandwidth_is_unmeasured consensus_bandwidth_is_unmeasured
self.relay_in_recent_consensus_count = \ self.relay_in_recent_consensus = \
relay_in_recent_consensus_count relay_in_recent_consensus
self.relay_recent_measurement_attempt_count = \ self.relay_recent_measurement_attempt = \
relay_recent_measurement_attempt_count relay_recent_measurement_attempt
self.relay_recent_priority_list_count = \ self.relay_recent_priority_list = \
relay_recent_priority_list_count relay_recent_priority_list
def __init__(self, relay, circ, dest_url, scanner_nick, t=None, def __init__(self, relay, circ, dest_url, scanner_nick, t=None):
relay_in_recent_consensus_count=None):
""" """
Initilizes the measurement and the relay with all the relay attributes. Initilizes the measurement and the relay with all the relay attributes.
""" """
...@@ -267,9 +266,9 @@ class Result: ...@@ -267,9 +266,9 @@ class Result:
relay.observed_bandwidth, relay.observed_bandwidth,
relay.consensus_bandwidth, relay.consensus_bandwidth,
relay.consensus_bandwidth_is_unmeasured, relay.consensus_bandwidth_is_unmeasured,
relay.relay_in_recent_consensus_count, relay.relay_in_recent_consensus,
relay.relay_recent_measurement_attempt_count, relay.relay_recent_measurement_attempt,
relay.relay_recent_priority_list_count relay.relay_recent_priority_list
) )
self._circ = circ self._circ = circ
self._dest_url = dest_url self._dest_url = dest_url
...@@ -317,27 +316,27 @@ class Result: ...@@ -317,27 +316,27 @@ class Result:
return self._relay.master_key_ed25519 return self._relay.master_key_ed25519
@property @property
def relay_in_recent_consensus_count(self): def relay_in_recent_consensus(self):
"""Number of times the relay was in a consensus.""" """Number of times the relay was in a consensus."""
return self._relay.relay_in_recent_consensus_count return self._relay.relay_in_recent_consensus
@property @property
def relay_recent_measurement_attempt_count(self): def relay_recent_measurement_attempt(self):
"""Returns the relay recent measurements attemps. """Returns the relay recent measurements attemps.
It is initialized in :class:`~sbws.lib.relaylist.Relay` and It is initialized in :class:`~sbws.lib.relaylist.Relay` and
incremented in :func:`~sbws.core.scanner.main_loop`. incremented in :func:`~sbws.core.scanner.main_loop`.
""" """
return self._relay.relay_recent_measurement_attempt_count return self._relay.relay_recent_measurement_attempt
@property @property
def relay_recent_priority_list_count(self): def relay_recent_priority_list(self):
"""Returns the relay recent "prioritization"s to be measured. """Returns the relay recent "prioritization"s to be measured.
It is initialized in :class:`~sbws.lib.relaylist.Relay` and It is initialized in :class:`~sbws.lib.relaylist.Relay` and
incremented in :func:`~sbws.core.scanner.main_loop`. incremented in :func:`~sbws.core.scanner.main_loop`.
""" """
return self._relay.relay_recent_priority_list_count return self._relay.relay_recent_priority_list
@property @property
def circ(self): def circ(self):
...@@ -371,12 +370,12 @@ class Result: ...@@ -371,12 +370,12 @@ class Result:
'type': self.type, 'type': self.type,
'scanner': self.scanner, 'scanner': self.scanner,
'version': self.version, 'version': self.version,
'relay_in_recent_consensus_count': 'relay_in_recent_consensus':
self.relay_in_recent_consensus_count, self.relay_in_recent_consensus,
'relay_recent_measurement_attempt_count': 'relay_recent_measurement_attempt':
self.relay_recent_measurement_attempt_count, self.relay_recent_measurement_attempt,
'relay_recent_priority_list_count': 'relay_recent_priority_list':
self.relay_recent_priority_list_count, self.relay_recent_priority_list,
} }
@staticmethod @staticmethod
...@@ -459,12 +458,12 @@ class ResultError(Result): ...@@ -459,12 +458,12 @@ class ResultError(Result):
Result.Relay( Result.Relay(
d['fingerprint'], d['nickname'], d['address'], d['fingerprint'], d['nickname'], d['address'],
d['master_key_ed25519'], d['master_key_ed25519'],
relay_in_recent_consensus_count= # noqa relay_in_recent_consensus= # noqa
d.get('relay_in_recent_consensus_count', None), # noqa d.get('relay_in_recent_consensus', None), # noqa
relay_recent_measurement_attempt_count= # noqa relay_recent_measurement_attempt= # noqa
d.get('relay_recent_measurement_attempt_count', None), # noqa d.get('relay_recent_measurement_attempt', None), # noqa
relay_recent_priority_list_count= # noqa relay_recent_priority_list= # noqa
d.get('relay_recent_priority_list_count', None), # noqa d.get('relay_recent_priority_list', None), # noqa
), ),
d['circ'], d['dest_url'], d['scanner'], d['circ'], d['dest_url'], d['scanner'],
msg=d['msg'], t=d['time']) msg=d['msg'], t=d['time'])
...@@ -507,12 +506,12 @@ class ResultErrorCircuit(ResultError): ...@@ -507,12 +506,12 @@ class ResultErrorCircuit(ResultError):
Result.Relay( Result.Relay(
d['fingerprint'], d['nickname'], d['address'], d['fingerprint'], d['nickname'], d['address'],
d['master_key_ed25519'], d['master_key_ed25519'],
relay_in_recent_consensus_count= # noqa relay_in_recent_consensus= # noqa
d.get('relay_in_recent_consensus_count', None), # noqa d.get('relay_in_recent_consensus', None), # noqa
relay_recent_measurement_attempt_count= # noqa relay_recent_measurement_attempt= # noqa
d.get('relay_recent_measurement_attempt_count', None), # noqa d.get('relay_recent_measurement_attempt', None), # noqa
relay_recent_priority_list_count= # noqa relay_recent_priority_list= # noqa
d.get('relay_recent_priority_list_count', None), # noqa d.get('relay_recent_priority_list', None), # noqa
), ),
d['circ'], d['dest_url'], d['scanner'], d['circ'], d['dest_url'], d['scanner'],
msg=d['msg'], t=d['time']) msg=d['msg'], t=d['time'])
...@@ -537,12 +536,12 @@ class ResultErrorStream(ResultError): ...@@ -537,12 +536,12 @@ class ResultErrorStream(ResultError):
Result.Relay( Result.Relay(
d['fingerprint'], d['nickname'], d['address'], d['fingerprint'], d['nickname'], d['address'],
d['master_key_ed25519'], d['master_key_ed25519'],
relay_in_recent_consensus_count= # noqa relay_in_recent_consensus= # noqa
d.get('relay_in_recent_consensus_count', None), # noqa d.get('relay_in_recent_consensus', None), # noqa
relay_recent_measurement_attempt_count= # noqa relay_recent_measurement_attempt= # noqa
d.get('relay_recent_measurement_attempt_count', None), # noqa d.get('relay_recent_measurement_attempt', None), # noqa
relay_recent_priority_list_count= # noqa relay_recent_priority_list= # noqa
d.get('relay_recent_priority_list_count', None), # noqa d.get('relay_recent_priority_list', None), # noqa
), ),
d['circ'], d['dest_url'], d['scanner'], d['circ'], d['dest_url'], d['scanner'],
msg=d['msg'], t=d['time']) msg=d['msg'], t=d['time'])
...@@ -657,12 +656,12 @@ class ResultErrorAuth(ResultError): ...@@ -657,12 +656,12 @@ class ResultErrorAuth(ResultError):
Result.Relay( Result.Relay(
d['fingerprint'], d['nickname'], d['address'], d['fingerprint'], d['nickname'], d['address'],
d['master_key_ed25519'], d['master_key_ed25519'],
relay_in_recent_consensus_count= # noqa relay_in_recent_consensus= # noqa
d.get('relay_in_recent_consensus_count', None), # noqa d.get('relay_in_recent_consensus', None), # noqa
relay_recent_measurement_attempt_count= # noqa relay_recent_measurement_attempt= # noqa
d.get('relay_recent_measurement_attempt_count', None), # noqa d.get('relay_recent_measurement_attempt', None), # noqa
relay_recent_priority_list_count= # noqa relay_recent_priority_list= # noqa
d.get('relay_recent_priority_list_count', None), # noqa d.get('relay_recent_priority_list', None), # noqa
), ),
d['circ'], d['dest_url'], d['scanner'], d['circ'], d['dest_url'], d['scanner'],
msg=d['msg'], t=d['time']) msg=d['msg'], t=d['time'])
...@@ -701,12 +700,12 @@ class ResultSuccess(Result): ...@@ -701,12 +700,12 @@ class ResultSuccess(Result):
d.get('relay_burst_bandwidth'), d['relay_observed_bandwidth'], d.get('relay_burst_bandwidth'), d['relay_observed_bandwidth'],
d.get('consensus_bandwidth'), d.get('consensus_bandwidth'),
d.get('consensus_bandwidth_is_unmeasured'), d.get('consensus_bandwidth_is_unmeasured'),
relay_in_recent_consensus_count= # noqa relay_in_recent_consensus= # noqa
d.get('relay_in_recent_consensus_count', None), # noqa d.get('relay_in_recent_consensus', None), # noqa
relay_recent_measurement_attempt_count= # noqa relay_recent_measurement_attempt= # noqa
d.get('relay_recent_measurement_attempt_count', None), # noqa d.get('relay_recent_measurement_attempt', None), # noqa
relay_recent_priority_list_count= # noqa relay_recent_priority_list= # noqa
d.get('relay_recent_priority_list_count', None), # noqa d.get('relay_recent_priority_list', None), # noqa
), ),
d['circ'], d['dest_url'], d['scanner'], d['circ'], d['dest_url'], d['scanner'],
t=d['time']) t=d['time'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment