[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Helper function for ignored pyflakes issues
commit 0cbcfbb36c74019377cd3e0feb57b30e22d99570
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Tue Dec 31 09:16:00 2013 -0800
Helper function for ignored pyflakes issues
Bit of this code is begging for a small helper function. Makes the loop far
more readable.
---
test/util.py | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/test/util.py b/test/util.py
index 6ff20bc..9ff6e99 100644
--- a/test/util.py
+++ b/test/util.py
@@ -313,6 +313,16 @@ def get_pyflakes_issues(paths):
path, issue = line.split("=>")
pyflakes_ignore.setdefault(path.strip(), []).append(issue.strip())
+ def is_ignored(path, issue):
+ # Paths in pyflakes_ignore are relative, so we need to check to see if our
+ # path ends with any of them.
+
+ for ignore_path in pyflakes_ignore:
+ if path.endswith(ignore_path) and issue in pyflakes_ignore[ignore_path]:
+ return True
+
+ return False
+
# Pyflakes issues are of the form...
#
# FILE:LINE: ISSUE
@@ -336,20 +346,7 @@ def get_pyflakes_issues(paths):
if line_match:
path, line, issue = line_match.groups()
- if _is_test_data(path):
- continue
-
- # 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]:
- ignore_issue = True
- break
-
- if not ignore_issue:
+ if not _is_test_data(path) and not is_ignored(path, issue):
issues.setdefault(path, []).append((int(line), issue))
return issues
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits