commit 0fd1dd595d11a6b9c066e26f07da07b70122fabb Author: aagbsn aagbsn@extc.org Date: Sun Nov 2 20:19:23 2014 +0000
Remove unused imports (pyflakes) --- ooni/kit/daphn3.py | 2 -- ooni/kit/domclass.py | 3 --- ooni/nettests/blocking/bridge_reachability.py | 3 +-- ooni/nettests/experimental/dns_injection.py | 1 - ooni/nettests/experimental/domclass_collector.py | 2 -- ooni/nettests/experimental/http_filtering_bypassing.py | 2 +- ooni/nettests/experimental/http_trix.py | 1 - ooni/nettests/experimental/http_uk_mobile_networks.py | 1 - ooni/nettests/experimental/keyword_filtering.py | 2 -- ooni/nettests/experimental/parasitictraceroute.py | 1 - ooni/nettests/experimental/squid.py | 1 + ooni/nettests/scanning/http_url_list.py | 1 - ooni/nettests/third_party/netalyzr.py | 2 +- ooni/oonid.py | 5 ----- ooni/reporter.py | 1 - ooni/tests/disable_test_dns.py | 4 ---- ooni/tests/test_managers.py | 8 +++----- ooni/tests/test_reporter.py | 1 - ooni/utils/net.py | 2 -- ooni/utils/txscapy.py | 1 - 20 files changed, 7 insertions(+), 37 deletions(-)
diff --git a/ooni/kit/daphn3.py b/ooni/kit/daphn3.py index ffe04f6..6abe2fd 100644 --- a/ooni/kit/daphn3.py +++ b/ooni/kit/daphn3.py @@ -1,8 +1,6 @@ -import sys import yaml
from twisted.internet import protocol, defer -from twisted.internet.error import ConnectionDone
from ooni.utils import log
diff --git a/ooni/kit/domclass.py b/ooni/kit/domclass.py index ea68808..feeb22e 100644 --- a/ooni/kit/domclass.py +++ b/ooni/kit/domclass.py @@ -21,7 +21,6 @@ The procedure we use is the following: probability matrix B. """
-import yaml import numpy import time
@@ -63,8 +62,6 @@ def compute_probability_matrix(dataset):
:dataset: an array of pairs representing the parent child relationships. """ - import itertools - ret = {} matrix = numpy.zeros((len(thetags) + 1, len(thetags) + 1))
for data in dataset: diff --git a/ooni/nettests/blocking/bridge_reachability.py b/ooni/nettests/blocking/bridge_reachability.py index b9aec33..e282853 100644 --- a/ooni/nettests/blocking/bridge_reachability.py +++ b/ooni/nettests/blocking/bridge_reachability.py @@ -9,9 +9,8 @@ from twisted.internet import reactor, error
import txtorcon
-from ooni.settings import config from ooni.utils import log, onion -from ooni import nettest, errors +from ooni import nettest
class TorIsNotInstalled(Exception): diff --git a/ooni/nettests/experimental/dns_injection.py b/ooni/nettests/experimental/dns_injection.py index cf25539..0a5c94e 100644 --- a/ooni/nettests/experimental/dns_injection.py +++ b/ooni/nettests/experimental/dns_injection.py @@ -3,7 +3,6 @@ from twisted.python import usage from twisted.internet import defer
from ooni.templates import dnst -from ooni import nettest from ooni.utils import log
class UsageOptions(usage.Options): diff --git a/ooni/nettests/experimental/domclass_collector.py b/ooni/nettests/experimental/domclass_collector.py index 6384e62..efd5dbc 100644 --- a/ooni/nettests/experimental/domclass_collector.py +++ b/ooni/nettests/experimental/domclass_collector.py @@ -7,8 +7,6 @@ # :authors: Arturo Filastò # :licence: see LICENSE
-from twisted.internet import threads, defer - from ooni.kit import domclass from ooni.templates import httpt
diff --git a/ooni/nettests/experimental/http_filtering_bypassing.py b/ooni/nettests/experimental/http_filtering_bypassing.py index 1faed37..18501fb 100644 --- a/ooni/nettests/experimental/http_filtering_bypassing.py +++ b/ooni/nettests/experimental/http_filtering_bypassing.py @@ -2,7 +2,7 @@ from twisted.python import usage
from ooni.utils import log -from ooni.utils import randomStr, randomSTR +from ooni.utils import randomStr from ooni.templates import tcpt
class UsageOptions(usage.Options): diff --git a/ooni/nettests/experimental/http_trix.py b/ooni/nettests/experimental/http_trix.py index b5c9ae2..6d11bbb 100644 --- a/ooni/nettests/experimental/http_trix.py +++ b/ooni/nettests/experimental/http_trix.py @@ -2,7 +2,6 @@ from twisted.python import usage
from ooni.utils import log -from ooni.utils import randomStr, randomSTR from ooni.templates import tcpt
class UsageOptions(usage.Options): diff --git a/ooni/nettests/experimental/http_uk_mobile_networks.py b/ooni/nettests/experimental/http_uk_mobile_networks.py index cc00fdc..2ac0bd9 100644 --- a/ooni/nettests/experimental/http_uk_mobile_networks.py +++ b/ooni/nettests/experimental/http_uk_mobile_networks.py @@ -2,7 +2,6 @@ import yaml
from twisted.python import usage -from twisted.plugin import IPlugin
from ooni.templates import httpt from ooni.utils import log diff --git a/ooni/nettests/experimental/keyword_filtering.py b/ooni/nettests/experimental/keyword_filtering.py index b54ba0d..cd83da1 100644 --- a/ooni/nettests/experimental/keyword_filtering.py +++ b/ooni/nettests/experimental/keyword_filtering.py @@ -4,9 +4,7 @@ # :licence: see LICENSE
from twisted.python import usage -from twisted.internet import defer
-from ooni.utils import log from ooni.templates import scapyt
from scapy.layers.inet import TCP, IP diff --git a/ooni/nettests/experimental/parasitictraceroute.py b/ooni/nettests/experimental/parasitictraceroute.py index 882d25a..7d57304 100644 --- a/ooni/nettests/experimental/parasitictraceroute.py +++ b/ooni/nettests/experimental/parasitictraceroute.py @@ -1,4 +1,3 @@ -from twisted.python import usage from twisted.internet import defer, reactor from ooni.errors import handleAllFailures from ooni.templates import scapyt diff --git a/ooni/nettests/experimental/squid.py b/ooni/nettests/experimental/squid.py index 17255e5..cf976ba 100644 --- a/ooni/nettests/experimental/squid.py +++ b/ooni/nettests/experimental/squid.py @@ -9,6 +9,7 @@ from ooni import utils from ooni.utils import log from ooni.templates import httpt +import re
class SquidTest(httpt.HTTPTest): """ diff --git a/ooni/nettests/scanning/http_url_list.py b/ooni/nettests/scanning/http_url_list.py index 98e4ba0..f89def4 100644 --- a/ooni/nettests/scanning/http_url_list.py +++ b/ooni/nettests/scanning/http_url_list.py @@ -3,7 +3,6 @@ # :authors: Arturo Filastò # :licence: see LICENSE
-from twisted.internet import defer from twisted.python import usage from ooni.templates import httpt from ooni.utils import log diff --git a/ooni/nettests/third_party/netalyzr.py b/ooni/nettests/third_party/netalyzr.py index 63ab3c7..3154af7 100644 --- a/ooni/nettests/third_party/netalyzr.py +++ b/ooni/nettests/third_party/netalyzr.py @@ -10,7 +10,7 @@ from ooni import nettest from ooni.utils import log import time import os -from twisted.internet import reactor, threads, defer +from twisted.internet import reactor, threads
class NetalyzrWrapperTest(nettest.NetTestCase): name = "NetalyzrWrapper" diff --git a/ooni/oonid.py b/ooni/oonid.py index cc71d47..c04cadc 100644 --- a/ooni/oonid.py +++ b/ooni/oonid.py @@ -1,13 +1,8 @@ -import os -import random - from twisted.application import service, internet -from twisted.web import static, server
from ooni.settings import config from ooni.api.spec import oonidApplication from ooni.director import Director -from ooni.reporter import YAMLReporter, OONIBReporter
def getOonid(): director = Director() diff --git a/ooni/reporter.py b/ooni/reporter.py index 06f866e..cbea9f7 100644 --- a/ooni/reporter.py +++ b/ooni/reporter.py @@ -1,4 +1,3 @@ -import time import yaml import json import os diff --git a/ooni/tests/disable_test_dns.py b/ooni/tests/disable_test_dns.py index 13b1ae8..7ddae3d 100644 --- a/ooni/tests/disable_test_dns.py +++ b/ooni/tests/disable_test_dns.py @@ -2,11 +2,7 @@ # This unittest is to verify that our usage of the twisted DNS resolver does # not break with new versions of twisted.
-import pdb from twisted.trial import unittest - -from twisted.internet import reactor - from twisted.names import dns from twisted.names.client import Resolver
diff --git a/ooni/tests/test_managers.py b/ooni/tests/test_managers.py index d7f3177..29b7cc3 100644 --- a/ooni/tests/test_managers.py +++ b/ooni/tests/test_managers.py @@ -1,18 +1,16 @@ import os
from twisted.trial import unittest -from twisted.python import failure from twisted.internet import defer, task
-from ooni.tasks import BaseTask, TaskWithTimeout -from ooni.managers import TaskManager, MeasurementManager +from ooni.managers import MeasurementManager
from ooni.tests.mocks import MockSuccessTask, MockFailTask, MockFailOnceTask, MockFailure from ooni.tests.mocks import MockSuccessTaskWithTimeout, MockFailTaskThatTimesOut from ooni.tests.mocks import MockTimeoutOnceTask, MockFailTaskWithTimeout from ooni.tests.mocks import MockTaskManager, mockFailure, MockDirector -from ooni.tests.mocks import MockNetTest, MockMeasurement, MockSuccessMeasurement -from ooni.tests.mocks import MockFailMeasurement, MockFailOnceMeasurement +from ooni.tests.mocks import MockNetTest, MockSuccessMeasurement +from ooni.tests.mocks import MockFailMeasurement from ooni.settings import config
diff --git a/ooni/tests/test_reporter.py b/ooni/tests/test_reporter.py index 64b3623..454fbef 100644 --- a/ooni/tests/test_reporter.py +++ b/ooni/tests/test_reporter.py @@ -2,7 +2,6 @@ import os import yaml import json import time -import os from mock import MagicMock
from twisted.internet import defer diff --git a/ooni/utils/net.py b/ooni/utils/net.py index ad19b49..fbd0fb5 100644 --- a/ooni/utils/net.py +++ b/ooni/utils/net.py @@ -16,8 +16,6 @@ except ImportError: return protocol return endpoint.connect(OneShotFactory())
-from ooni.utils import log - # if sys.platform.system() == 'Windows': # import _winreg as winreg
diff --git a/ooni/utils/txscapy.py b/ooni/utils/txscapy.py index e8a27b6..d0f58ba 100644 --- a/ooni/utils/txscapy.py +++ b/ooni/utils/txscapy.py @@ -8,7 +8,6 @@ from twisted.internet import reactor from twisted.internet import defer, abstract
from scapy.config import conf -from scapy.supersocket import L3RawSocket from scapy.all import RandShort, IP, IPerror, ICMP, ICMPerror, TCP, TCPerror, UDP, UDPerror
from ooni.utils import log