Gentoo Archives: gentoo-catalyst

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