From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 3A7F713888F for ; Wed, 28 Oct 2015 14:59:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8B9D221C001; Wed, 28 Oct 2015 14:59:36 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1D63621C001 for ; Wed, 28 Oct 2015 14:59:36 +0000 (UTC) Received: from professor-x (S010634bdfa9ecf80.vc.shawcable.net [96.49.31.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dolsen) by smtp.gentoo.org (Postfix) with ESMTPSA id 5589B340C30 for ; Wed, 28 Oct 2015 14:59:34 +0000 (UTC) Date: Wed, 28 Oct 2015 07:58:44 -0700 From: Brian Dolbec To: gentoo-catalyst@lists.gentoo.org Subject: Re: [gentoo-catalyst] [PATCH 9/9] lint: fix redefined-outer-name warnings Message-ID: <20151028075844.20df2984.dolsen@gentoo.org> In-Reply-To: <1444624562-26162-9-git-send-email-vapier@gentoo.org> References: <1444624562-26162-1-git-send-email-vapier@gentoo.org> <1444624562-26162-9-git-send-email-vapier@gentoo.org> Organization: Gentoo Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archives-Salt: eaf448d9-df68-4d84-92b1-1d66462ce079 X-Archives-Hash: ca2376bb969e9cc1cb26eda96fd6fcdf On Mon, 12 Oct 2015 00:36:02 -0400 Mike Frysinger wrote: > The doc module just needs a main func to hold all the variables > instead of coding it all in global scope. > --- > .pylintrc | 3 +-- > catalyst/log.py | 4 ++++ > doc/make_subarch_table_guidexml.py | 9 +++++++-- > 3 files changed, 12 insertions(+), 4 deletions(-) > > diff --git a/.pylintrc b/.pylintrc > index 2a03f23..e657daf 100644 > --- a/.pylintrc > +++ b/.pylintrc > @@ -32,10 +32,9 @@ load-plugins= > # bad-continuation -- might be hard with tab indentation policy > # invalid-name -- need to manage constants better > # line-too-long -- figure out a length and stick to it > -# redefined-outer-name -- clean up code to not do this > # super-init-not-called -- fix the classes __init__ structure > # no-init -- update classes w/missing __init__ functions > -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 +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 [REPORTS] diff --git a/catalyst/log.py > b/catalyst/log.py index 5938199..d640dec 100644 --- a/catalyst/log.py > +++ b/catalyst/log.py @@ -98,6 +98,10 @@ class > CatalystFormatter(logging.Formatter): return msg +# We define |debug| > in global scope so people can call log.debug(), but it +# makes the > linter complain when we have a |debug| keyword. Since we don't +# > use that func in here, it's not a problem, so silence the warning. +# > pylint: disable=redefined-outer-name def setup_logging(level, > output=None, debug=False, color=None): """Initialize the logging > module using the |level| level""" # The incoming level will be things > like "info", but setLevel wants diff --git > a/doc/make_subarch_table_guidexml.py > b/doc/make_subarch_table_guidexml.py index a6a9022..0699d2a 100755 > --- a/doc/make_subarch_table_guidexml.py +++ > b/doc/make_subarch_table_guidexml.py @@ -6,6 +6,7 @@ import os > import re > +import sys > import textwrap > > > @@ -99,11 +100,11 @@ def dump(subarch_title_to_subarch_id, > subarch_id_to_pattern_arch_genericrch_id): f.close() > > > -if __name__ == '__main__': > +def main(_argv): > subarch_title_to_subarch_id = dict() > subarch_id_to_pattern_arch_genericrch_id = dict() > > - for (dirpath, dirnames, filenames) in > os.walk('catalyst/arch'): > + for dirpath, _dirnames, filenames in > os.walk('catalyst/arch'): for _fn in filenames: > if not _fn.endswith('.py'): > continue > @@ -114,3 +115,7 @@ if __name__ == '__main__': > handle_file(fn, subarch_title_to_subarch_id, > subarch_id_to_pattern_arch_genericrch_id) > dump(subarch_title_to_subarch_id, > subarch_id_to_pattern_arch_genericrch_id) + > + > +if __name__ == '__main__': > + main(sys.argv[1:]) looks good -- Brian Dolbec