[tor-commits] [stem/master] Pyflakes and PEP8 corrections

atagar at torproject.org atagar at torproject.org
Sun Jul 7 20:37:14 UTC 2013


commit 5cd89263f0acc5a7b6fcdd4021efa09a4f1634ab
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu Jul 4 13:41:22 2013 -0700

    Pyflakes and PEP8 corrections
    
    After upgrading both they each complained about a few new things. Mostly
    pyflakes getting confused by pydoc comments, but there were a couple fair
    catches.
---
 stem/util/conf.py                                 |    2 +-
 test/settings.cfg                                 |    2 ++
 test/unit/descriptor/networkstatus/document_v3.py |    4 +++-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/stem/util/conf.py b/stem/util/conf.py
index 14cc306..f897aac 100644
--- a/stem/util/conf.py
+++ b/stem/util/conf.py
@@ -299,7 +299,7 @@ def parse_enum_csv(key, value, enumeration, count = None):
     raise ValueError("The count must be None, an int, or two value tuple. Got '%s' (%s)'" % (count, type(count)))
 
   result = []
-  enum_keys = [key.upper() for key in enumeration.keys()]
+  enum_keys = [k.upper() for k in enumeration.keys()]
   enum_values = list(enumeration)
 
   for val in values:
diff --git a/test/settings.cfg b/test/settings.cfg
index 96fc407..16d8c8b 100644
--- a/test/settings.cfg
+++ b/test/settings.cfg
@@ -129,6 +129,7 @@ pep8.ignore E127
 # False positives from pyflakes. These are mappings between the path and the
 # issue.
 
+pyflakes.ignore stem/control.py => undefined name 'control'
 pyflakes.ignore stem/prereq.py => 'RSA' imported but unused
 pyflakes.ignore stem/prereq.py => 'asn1' imported but unused
 pyflakes.ignore stem/prereq.py => 'mock' imported but unused
@@ -137,6 +138,7 @@ pyflakes.ignore stem/descriptor/__init__.py => redefinition of unused 'OrderedDi
 pyflakes.ignore stem/util/str_tools.py => redefinition of function '_to_bytes_impl' from line 51
 pyflakes.ignore stem/util/str_tools.py => redefinition of function '_to_unicode_impl' from line 57
 pyflakes.ignore test/mocking.py => undefined name 'builtins'
+pyflakes.ignore test/mocking.py => undefined name 'test'
 pyflakes.ignore test/unit/response/events.py => 'from stem import *' used; unable to detect undefined names
 
 # Test modules we want to run. Modules are roughly ordered by the dependencies
diff --git a/test/unit/descriptor/networkstatus/document_v3.py b/test/unit/descriptor/networkstatus/document_v3.py
index 366b516..ece95de 100644
--- a/test/unit/descriptor/networkstatus/document_v3.py
+++ b/test/unit/descriptor/networkstatus/document_v3.py
@@ -220,7 +220,9 @@ class TestNetworkStatusDocument(unittest.TestCase):
       for index in xrange(len(lines) - 1):
         # once we reach the crypto blob we're done since swapping those won't
         # be detected
-        if lines[index].startswith(stem.util.str_tools._to_bytes(CRYPTO_BLOB[1:10])): break
+
+        if lines[index].startswith(stem.util.str_tools._to_bytes(CRYPTO_BLOB[1:10])):
+          break
 
         # swaps this line with the one after it
         test_lines = list(lines)





More information about the tor-commits mailing list