commit 1a1cc3fbd56ce4f6ef05eb82226b49745221c4cf Author: Damian Johnson atagar@torproject.org Date: Fri Jan 17 13:14:54 2020 -0800
Replace func_name method
This fixes...
Traceback (most recent call last): File "/home/atagar/Desktop/tor/bridgedb/bridgedb/test/test_https_distributor.py", line 154, in test_HTTPSDistributor_prepopulateRings_without_proxies dist.prepopulateRings() File "/home/atagar/Desktop/tor/bridgedb/bridgedb/distributors/https/distributor.py", line 263, in prepopulateRings populate_from=self.hashring.bridges) File "/home/atagar/Desktop/tor/bridgedb/bridgedb/Bridges.py", line 673, in addRing filterNames = self.extractFilterNames(ringname) File "/home/atagar/Desktop/tor/bridgedb/bridgedb/Bridges.py", line 630, in extractFilterNames for filterName in [x.func_name for x in list(ringname)]: File "/home/atagar/Desktop/tor/bridgedb/bridgedb/Bridges.py", line 630, in <listcomp> for filterName in [x.func_name for x in list(ringname)]: builtins.AttributeError: 'function' object has no attribute 'func_name'
Test results changed as follows...
before: FAILED (skips=114, failures=14, errors=143, successes=714) after: FAILED (skips=114, failures=15, errors=140, successes=716) --- bridgedb/Bridges.py | 4 ++-- bridgedb/distributors/https/distributor.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/bridgedb/Bridges.py b/bridgedb/Bridges.py index 20a78cb..135174c 100644 --- a/bridgedb/Bridges.py +++ b/bridgedb/Bridges.py @@ -627,8 +627,8 @@ class FilteredBridgeSplitter(object): """ filterNames = []
- for filterName in [x.func_name for x in list(ringname)]: - # Using `assignBridgesToSubring.func_name` gives us a messy + for filterName in [x.__name__ for x in list(ringname)]: + # Using `assignBridgesToSubring.__name__` gives us a messy # string which includes all parameters and memory addresses. Get # rid of this by partitioning at the first `(`: realFilterName = filterName.partition('(')[0] diff --git a/bridgedb/distributors/https/distributor.py b/bridgedb/distributors/https/distributor.py index 7bce8d9..03aa970 100644 --- a/bridgedb/distributors/https/distributor.py +++ b/bridgedb/distributors/https/distributor.py @@ -326,7 +326,7 @@ class HTTPSDistributor(Distributor): logging.debug("Assigned client to subhashring %d/%d" % (subring, self.totalSubrings)) logging.debug("Assigned client to subhashring position: %s" % position.encode('hex')) logging.debug("Total bridges: %d" % len(self.hashring)) - logging.debug("Bridge filters: %s" % ' '.join([x.func_name for x in filters])) + logging.debug("Bridge filters: %s" % ' '.join([x.__name__ for x in filters]))
# Check wheth we have a cached copy of the hashring: if filters in self.hashring.filterRings.keys():
tor-commits@lists.torproject.org