[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Make the imports of the CollectorClient conditional (#559)



commit d47aaffa5a9a2c4994af08b149b022705c7f69a1
Author: Arturo Filastò <arturo@xxxxxxxxxxx>
Date:   Thu Jun 30 12:41:17 2016 +0200

    Make the imports of the CollectorClient conditional (#559)
    
    This brings down the runtime of the ooniprobe --version command from
    1.302 seconds to 0.464 seconds (280% improvement).
---
 ooni/oonicli.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ooni/oonicli.py b/ooni/oonicli.py
index 74bf9ac..b829408 100644
--- a/ooni/oonicli.py
+++ b/ooni/oonicli.py
@@ -14,7 +14,6 @@ from ooni import errors, __version__
 from ooni.constants import CANONICAL_BOUNCER_ONION
 from ooni.settings import config
 from ooni.utils import log
-from backend_client import CollectorClient
 
 class LifetimeExceeded(Exception): pass
 
@@ -222,6 +221,8 @@ def setupAnnotations(global_options):
     return annotations
 
 def setupCollector(global_options, collector_client):
+    from backend_client import CollectorClient
+
     if global_options['collector']:
         collector_client = CollectorClient(global_options['collector'])
     elif config.reports.get('collector', None) is not None:
@@ -233,6 +234,7 @@ def setupCollector(global_options, collector_client):
 def createDeck(global_options, url=None):
     from ooni.nettest import NetTestLoader
     from ooni.deck import Deck, nettest_to_path
+    from backend_client import CollectorClient
 
     if url:
         log.msg("Creating deck for: %s" % (url))



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits