Gentoo Archives: gentoo-catalyst

From: Mike Frysinger <vapier@g.o>
To: gentoo-catalyst@l.g.o
Subject: [gentoo-catalyst] [PATCH 9/9] lint: fix redefined-outer-name warnings
Date: Mon, 12 Oct 2015 04:36:36
Message-Id: 1444624562-26162-9-git-send-email-vapier@gentoo.org
In Reply to: [gentoo-catalyst] [PATCH 1/9] convert octals to py3 compat by Mike Frysinger
1 The doc module just needs a main func to hold all the variables
2 instead of coding it all in global scope.
3 ---
4 .pylintrc | 3 +--
5 catalyst/log.py | 4 ++++
6 doc/make_subarch_table_guidexml.py | 9 +++++++--
7 3 files changed, 12 insertions(+), 4 deletions(-)
8
9 diff --git a/.pylintrc b/.pylintrc
10 index 2a03f23..e657daf 100644
11 --- a/.pylintrc
12 +++ b/.pylintrc
13 @@ -32,10 +32,9 @@ load-plugins=
14 # bad-continuation -- might be hard with tab indentation policy
15 # invalid-name -- need to manage constants better
16 # line-too-long -- figure out a length and stick to it
17 -# redefined-outer-name -- clean up code to not do this
18 # super-init-not-called -- fix the classes __init__ structure
19 # no-init -- update classes w/missing __init__ functions
20 -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
21 +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
22
23
24 [REPORTS]
25 diff --git a/catalyst/log.py b/catalyst/log.py
26 index 5938199..d640dec 100644
27 --- a/catalyst/log.py
28 +++ b/catalyst/log.py
29 @@ -98,6 +98,10 @@ class CatalystFormatter(logging.Formatter):
30 return msg
31
32
33 +# We define |debug| in global scope so people can call log.debug(), but it
34 +# makes the linter complain when we have a |debug| keyword. Since we don't
35 +# use that func in here, it's not a problem, so silence the warning.
36 +# pylint: disable=redefined-outer-name
37 def setup_logging(level, output=None, debug=False, color=None):
38 """Initialize the logging module using the |level| level"""
39 # The incoming level will be things like "info", but setLevel wants
40 diff --git a/doc/make_subarch_table_guidexml.py b/doc/make_subarch_table_guidexml.py
41 index a6a9022..0699d2a 100755
42 --- a/doc/make_subarch_table_guidexml.py
43 +++ b/doc/make_subarch_table_guidexml.py
44 @@ -6,6 +6,7 @@
45
46 import os
47 import re
48 +import sys
49 import textwrap
50
51
52 @@ -99,11 +100,11 @@ def dump(subarch_title_to_subarch_id, subarch_id_to_pattern_arch_genericrch_id):
53 f.close()
54
55
56 -if __name__ == '__main__':
57 +def main(_argv):
58 subarch_title_to_subarch_id = dict()
59 subarch_id_to_pattern_arch_genericrch_id = dict()
60
61 - for (dirpath, dirnames, filenames) in os.walk('catalyst/arch'):
62 + for dirpath, _dirnames, filenames in os.walk('catalyst/arch'):
63 for _fn in filenames:
64 if not _fn.endswith('.py'):
65 continue
66 @@ -114,3 +115,7 @@ if __name__ == '__main__':
67 handle_file(fn, subarch_title_to_subarch_id, subarch_id_to_pattern_arch_genericrch_id)
68
69 dump(subarch_title_to_subarch_id, subarch_id_to_pattern_arch_genericrch_id)
70 +
71 +
72 +if __name__ == '__main__':
73 + main(sys.argv[1:])
74 --
75 2.5.2

Replies