1 |
commit: b3cfe6e0c7754a9e17b681581b2a317b7861b486 |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Oct 12 03:59:28 2015 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Oct 28 16:49:56 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=b3cfe6e0 |
7 |
|
8 |
lint: fix redefined-outer-name warnings |
9 |
|
10 |
The doc module just needs a main func to hold all the variables |
11 |
instead of coding it all in global scope. |
12 |
|
13 |
.pylintrc | 3 +-- |
14 |
catalyst/log.py | 4 ++++ |
15 |
doc/make_subarch_table_guidexml.py | 9 +++++++-- |
16 |
3 files changed, 12 insertions(+), 4 deletions(-) |
17 |
|
18 |
diff --git a/.pylintrc b/.pylintrc |
19 |
index 2a03f23..e657daf 100644 |
20 |
--- a/.pylintrc |
21 |
+++ b/.pylintrc |
22 |
@@ -32,10 +32,9 @@ load-plugins= |
23 |
# bad-continuation -- might be hard with tab indentation policy |
24 |
# invalid-name -- need to manage constants better |
25 |
# line-too-long -- figure out a length and stick to it |
26 |
-# redefined-outer-name -- clean up code to not do this |
27 |
# super-init-not-called -- fix the classes __init__ structure |
28 |
# no-init -- update classes w/missing __init__ functions |
29 |
-disable=missing-docstring, too-many-lines, too-many-branches, too-many-statements, too-few-public-methods, too-many-instance-attributes, too-many-public-methods, too-many-locals, too-many-arguments, locally-enabled, locally-disabled, fixme, broad-except, bad-whitespace, bad-continuation, invalid-name, line-too-long, redefined-outer-name, super-init-not-called, no-init |
30 |
+disable=missing-docstring, too-many-lines, too-many-branches, too-many-statements, too-few-public-methods, too-many-instance-attributes, too-many-public-methods, too-many-locals, too-many-arguments, locally-enabled, locally-disabled, fixme, broad-except, bad-whitespace, bad-continuation, invalid-name, line-too-long, super-init-not-called, no-init |
31 |
|
32 |
|
33 |
[REPORTS] |
34 |
|
35 |
diff --git a/catalyst/log.py b/catalyst/log.py |
36 |
index 5938199..d640dec 100644 |
37 |
--- a/catalyst/log.py |
38 |
+++ b/catalyst/log.py |
39 |
@@ -98,6 +98,10 @@ class CatalystFormatter(logging.Formatter): |
40 |
return msg |
41 |
|
42 |
|
43 |
+# We define |debug| in global scope so people can call log.debug(), but it |
44 |
+# makes the linter complain when we have a |debug| keyword. Since we don't |
45 |
+# use that func in here, it's not a problem, so silence the warning. |
46 |
+# pylint: disable=redefined-outer-name |
47 |
def setup_logging(level, output=None, debug=False, color=None): |
48 |
"""Initialize the logging module using the |level| level""" |
49 |
# The incoming level will be things like "info", but setLevel wants |
50 |
|
51 |
diff --git a/doc/make_subarch_table_guidexml.py b/doc/make_subarch_table_guidexml.py |
52 |
index a6a9022..0699d2a 100755 |
53 |
--- a/doc/make_subarch_table_guidexml.py |
54 |
+++ b/doc/make_subarch_table_guidexml.py |
55 |
@@ -6,6 +6,7 @@ |
56 |
|
57 |
import os |
58 |
import re |
59 |
+import sys |
60 |
import textwrap |
61 |
|
62 |
|
63 |
@@ -99,11 +100,11 @@ def dump(subarch_title_to_subarch_id, subarch_id_to_pattern_arch_genericrch_id): |
64 |
f.close() |
65 |
|
66 |
|
67 |
-if __name__ == '__main__': |
68 |
+def main(_argv): |
69 |
subarch_title_to_subarch_id = dict() |
70 |
subarch_id_to_pattern_arch_genericrch_id = dict() |
71 |
|
72 |
- for (dirpath, dirnames, filenames) in os.walk('catalyst/arch'): |
73 |
+ for dirpath, _dirnames, filenames in os.walk('catalyst/arch'): |
74 |
for _fn in filenames: |
75 |
if not _fn.endswith('.py'): |
76 |
continue |
77 |
@@ -114,3 +115,7 @@ if __name__ == '__main__': |
78 |
handle_file(fn, subarch_title_to_subarch_id, subarch_id_to_pattern_arch_genericrch_id) |
79 |
|
80 |
dump(subarch_title_to_subarch_id, subarch_id_to_pattern_arch_genericrch_id) |
81 |
+ |
82 |
+ |
83 |
+if __name__ == '__main__': |
84 |
+ main(sys.argv[1:]) |