Gentoo Archives: gentoo-catalyst

From: Brian Dolbec <dolsen@g.o>
To: gentoo-catalyst@l.g.o
Subject: Re: [gentoo-catalyst] [PATCH] lint: fix up unused variables
Date: Tue, 06 Oct 2015 06:37:50
Message-Id: 20151005233658.37bb76f8.dolsen@gentoo.org
In Reply to: [gentoo-catalyst] [PATCH] lint: fix up unused variables by Mike Frysinger
1 On Tue, 6 Oct 2015 00:06:33 -0400
2 Mike Frysinger <vapier@g.o> wrote:
3
4 > This variables aren't actually used which the linter likes to warn
5 > about, so add a _ prefix to their name to silence the warnings.
6 > ---
7 > catalyst/base/resume.py | 2 +-
8 > catalyst/main.py | 2 +-
9 > catalyst/support.py | 2 +-
10 > catalyst/targets/netboot.py | 5 +++--
11 > setup.py | 2 +-
12 > 5 files changed, 7 insertions(+), 6 deletions(-)
13 >
14 > diff --git a/catalyst/base/resume.py b/catalyst/base/resume.py
15 > index 608f574..e3f03e7 100644
16 > --- a/catalyst/base/resume.py
17 > +++ b/catalyst/base/resume.py
18 > @@ -23,7 +23,7 @@ class AutoResumeError(Exception):
19 > def __init__(self, message, print_traceback=False):
20 > if message:
21 > if print_traceback:
22 > - (type,value)=sys.exc_info()[:2]
23 > + (_type, value) = sys.exc_info()[:2]
24 > if value!=None:
25 > print
26 > print "Traceback values
27 > found. listing..." diff --git a/catalyst/main.py b/catalyst/main.py
28 > index dfa0609..04f689e 100644
29 > --- a/catalyst/main.py
30 > +++ b/catalyst/main.py
31 > @@ -182,7 +182,7 @@ def main():
32 >
33 > # parse out the command line arguments
34 > try:
35 > - opts,args = getopt.getopt(sys.argv[1:],
36 > "apPThvdc:C:f:FVs:", ["purge", "purgeonly", "purgetmponly", "help",
37 > "version", "debug",\
38 > + opts, _args = getopt.getopt(sys.argv[1:],
39 > "apPThvdc:C:f:FVs:", ["purge", "purgeonly", "purgetmponly", "help",
40 > "version", "debug", "clear-autoresume", "config=", "cli=", "file=",
41 > "fetch", "verbose","snapshot="]) except getopt.GetoptError:
42 > diff --git a/catalyst/support.py b/catalyst/support.py
43 > index 5563a15..a879eaf 100644
44 > --- a/catalyst/support.py
45 > +++ b/catalyst/support.py
46 > @@ -88,7 +88,7 @@ class CatalystError(Exception):
47 > def __init__(self, message, print_traceback=False):
48 > if message:
49 > if print_traceback:
50 > - (type,value)=sys.exc_info()[:2]
51 > + (_type, value) = sys.exc_info()[:2]
52 > if value!=None:
53 > print
54 > print "Traceback values
55 > found. listing..." diff --git a/catalyst/targets/netboot.py
56 > b/catalyst/targets/netboot.py index c41ed59..b0e322c 100644
57 > --- a/catalyst/targets/netboot.py
58 > +++ b/catalyst/targets/netboot.py
59 > @@ -31,11 +31,12 @@ class netboot(StageBase):
60 > self.required_values=[]
61 >
62 > try:
63 > + # XXX: This code does nothing because the
64 > for loop below is disabled. if "netboot/packages" in addlargs:
65 > if
66 > type(addlargs["netboot/packages"]) == types.StringType:
67 > -
68 > loopy=[addlargs["netboot/packages"]]
69 > + _loopy =
70 > [addlargs["netboot/packages"]] else:
71 > -
72 > loopy=addlargs["netboot/packages"]
73 > + _loopy =
74 > addlargs["netboot/packages"]
75 > # for x in loopy:
76 > #
77 > self.required_values.append("netboot/packages/"+x+"/files") diff
78 > --git a/setup.py b/setup.py index feca894..27ed2de 100755
79 > --- a/setup.py
80 > +++ b/setup.py
81 > @@ -34,7 +34,7 @@ def _files(prefix, root):
82 >
83 > Yielding `(target_dir, (file_source_paths, ...))` tuples.
84 > """
85 > - for dirpath, dirnames, filenames in _os.walk(root):
86 > + for dirpath, _dirnames, filenames in _os.walk(root):
87 > reldir = _os.path.relpath(dirpath, root)
88 > install_directory = _posix_path(
89 > _os.path.join(prefix, reldir))
90
91 good :)
92
93 --
94 Brian Dolbec <dolsen>