[tor-commits] [stem/master] Dropping PYFLAKES_IGNORE
atagar at torproject.org
atagar at torproject.org
Tue Dec 31 17:10:07 UTC 2013
commit 2a0d501384ec218d8e5dd8494feed6a6654d0fe3
Author: Damian Johnson <atagar at torproject.org>
Date: Tue Dec 31 09:10:09 2013 -0800
Dropping PYFLAKES_IGNORE
Simple case of premature optimization. We cached our 'path => issue' mappings
for pyflakes messages to ignore. This is pointless - we only do it once, and
it's not even any substantial overhead to do repeatedly.
---
test/util.py | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
diff --git a/test/util.py b/test/util.py
index 0befa49..6ff20bc 100644
--- a/test/util.py
+++ b/test/util.py
@@ -85,10 +85,6 @@ Target = stem.util.enum.UppercaseEnum(
STEM_BASE = os.path.sep.join(__file__.split(os.path.sep)[:-2])
-# Mapping of files to the issues that should be ignored.
-
-PYFLAKES_IGNORE = None
-
def get_unit_tests(prefix = None):
"""
@@ -311,16 +307,11 @@ def get_pyflakes_issues(paths):
:returns: dict of the form ``path => [(line_number, message)...]``
"""
- global PYFLAKES_IGNORE
-
- if PYFLAKES_IGNORE is None:
- pyflakes_ignore = {}
-
- for line in CONFIG["pyflakes.ignore"]:
- path, issue = line.split("=>")
- pyflakes_ignore.setdefault(path.strip(), []).append(issue.strip())
+ pyflakes_ignore = {}
- PYFLAKES_IGNORE = pyflakes_ignore
+ for line in CONFIG["pyflakes.ignore"]:
+ path, issue = line.split("=>")
+ pyflakes_ignore.setdefault(path.strip(), []).append(issue.strip())
# Pyflakes issues are of the form...
#
@@ -348,13 +339,13 @@ def get_pyflakes_issues(paths):
if _is_test_data(path):
continue
- # paths in PYFLAKES_IGNORE are relative, so we need to check to see if
+ # paths in pyflakes_ignore are relative, so we need to check to see if
# our path ends with any of them
ignore_issue = False
- for ignore_path in PYFLAKES_IGNORE:
- if path.endswith(ignore_path) and issue in PYFLAKES_IGNORE[ignore_path]:
+ for ignore_path in pyflakes_ignore:
+ if path.endswith(ignore_path) and issue in pyflakes_ignore[ignore_path]:
ignore_issue = True
break
More information about the tor-commits
mailing list