[tor-commits] [bridgedb/develop] Remove filterBridgesByOnlyIP4() and filterBridgesByOnlyIP6().

isis at torproject.org isis at torproject.org
Thu Feb 19 02:21:14 UTC 2015


commit 264d8fc91ae1b7de149bf155e37a6b38e52ad240
Author: Isis Lovecruft <isis at torproject.org>
Date:   Wed Dec 24 08:43:39 2014 +0000

    Remove filterBridgesByOnlyIP4() and filterBridgesByOnlyIP6().
    
    These were only used in lib/bridgedb/test/legacy_Tests.py.
---
 lib/bridgedb/Filters.py           |   16 ----------------
 lib/bridgedb/test/legacy_Tests.py |    4 +---
 2 files changed, 1 insertion(+), 19 deletions(-)

diff --git a/lib/bridgedb/Filters.py b/lib/bridgedb/Filters.py
index 1a8a8d8..4580c87 100644
--- a/lib/bridgedb/Filters.py
+++ b/lib/bridgedb/Filters.py
@@ -73,22 +73,6 @@ def filterBridgesByIP6(bridge):
     return False
 setattr(filterBridgesByIP6, "description", "ip=6")
 
-def filterBridgesByOnlyIP4(bridge):
-    for k in bridge.or_addresses.keys():
-        if type(k) is IPv6Address:
-            return False
-    if type(k) is IPv4Address:
-        return True
-    return False
-
-def filterBridgesByOnlyIP6(bridge):
-    for k in bridge.or_addresses.keys():
-        if type(k) is IPv4Address:
-            return False
-    if type(k) is IPv6Address:
-        return True
-    return False
-
 def filterBridgesByTransport(methodname, addressClass=None):
     if addressClass is None: addressClass = IPv4Address
     assert (addressClass) in (IPv4Address, IPv6Address)
diff --git a/lib/bridgedb/test/legacy_Tests.py b/lib/bridgedb/test/legacy_Tests.py
index fa7a13c..70196b8 100644
--- a/lib/bridgedb/test/legacy_Tests.py
+++ b/lib/bridgedb/test/legacy_Tests.py
@@ -29,8 +29,6 @@ import ipaddr
 
 from bridgedb.Filters import filterBridgesByIP4
 from bridgedb.Filters import filterBridgesByIP6
-from bridgedb.Filters import filterBridgesByOnlyIP4
-from bridgedb.Filters import filterBridgesByOnlyIP6
 from bridgedb.Filters import filterBridgesByTransport
 from bridgedb.Filters import filterBridgesByNotBlockedIn
 
@@ -376,7 +374,7 @@ class IPBridgeDistTests(unittest.TestCase):
 
         for i in xrange(5):
             b = d.getBridgesForIP(randomIP4String(), "x", 1, bridgeFilterRules=[
-                filterBridgesByOnlyIP4, filterBridgesByOnlyIP6])
+                filterBridgesByIP4, filterBridgesByIP6])
             assert len(b) == 0
 
     def testDistWithFilterBlockedCountries(self):





More information about the tor-commits mailing list