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

[tor-commits] [chutney/master] Fixed some syntax errors



commit e49c377029997c7a2a80fae9181464278dd44544
Author: MrSquanchee <usuraj35@xxxxxxxxx>
Date:   Thu Apr 16 12:00:58 2020 +0530

    Fixed some syntax errors
    
    In Templating.py and TorNet.py
---
 lib/chutney/Templating.py |  2 +-
 lib/chutney/TorNet.py     | 14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/chutney/Templating.py b/lib/chutney/Templating.py
index 2a658ab..43eb636 100755
--- a/lib/chutney/Templating.py
+++ b/lib/chutney/Templating.py
@@ -107,7 +107,7 @@ class _DictWrapper(object):
         self._parent = parent
 
     def _getitem(self, key, my):
-        raise NotImplemented()
+        raise NotImplementedError()
 
     def __getitem__(self, key):
         return self.lookup(key, self)
diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py
index b68b240..6b5b88e 100644
--- a/lib/chutney/TorNet.py
+++ b/lib/chutney/TorNet.py
@@ -67,7 +67,7 @@ def getenv_type(env_var, default, type_, type_name=None):
             type_name = str(type_)
         raise ValueError(("Invalid value for environment variable '{}': "
                           "expected {}, but got '{}'")
-                         .format(env_var, typename, strval))
+                         .format(env_var, type_name, strval))
 
 def getenv_int(env_var, default):
     """
@@ -389,7 +389,7 @@ def get_tor_modules(tor):
         ]
     try:
         mods = run_tor(cmdline)
-    except subprocess.CalledProcessError as e:
+    except subprocess.CalledProcessError:
         # Tor doesn't support --list-modules; act as if it said nothing.
         mods = ""
 
@@ -761,8 +761,8 @@ class LocalNodeBuilder(NodeBuilder):
         stdouterr = run_tor(cmdline)
         fingerprint = "".join((stdouterr.rstrip().split('\n')[-1]).split()[1:])
         if not re.match(r'^[A-F0-9]{40}$', fingerprint):
-            print("Error when getting fingerprint using '%r'. It output '%r'."
-                  .format(" ".join(cmdline), stdouterr))
+            print("Error when getting fingerprint using '{0}'. It output '{1}'."
+                  .format(repr(" ".join(cmdline)), repr(stdouterr)))
             sys.exit(1)
         self._env['fingerprint'] = fingerprint
 
@@ -1757,7 +1757,7 @@ class LocalNodeController(NodeController):
         node_status = self.getNodeDirInfoStatus()
         if node_status:
             status_code, _, _, _ = node_status
-            return status_code == LocalDirectoryController.SUCCESS_CODE
+            return status_code == LocalNodeController.SUCCESS_CODE
         else:
             # Clients don't publish descriptors, so they are always ok.
             # (But we shouldn't print a descriptor status for them.)
@@ -2020,7 +2020,7 @@ class Network(object):
     def _addRequirement(self, requirement):
         requirement = requirement.upper()
         if requirement not in KNOWN_REQUIREMENTS:
-            raise RuntimemeError(("Unrecognized requirement %r"%requirement))
+            raise RuntimeError(("Unrecognized requirement %r"%requirement))
         self._requirements.append(requirement)
 
     def move_aside_nodes_dir(self):
@@ -2403,7 +2403,7 @@ class Network(object):
                     c.stop(sig=sig)
             print("Waiting for nodes to finish.")
             wrote_dot = False
-            for n in range(15):
+            for _ in range(15):
                 time.sleep(1)
                 if all(not c.isRunning() for c in controllers):
                     self.final_cleanup(wrote_dot,

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