public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-catalyst] [PATCH] lint: fix up unused variables
@ 2015-10-06  4:06 Mike Frysinger
  2015-10-06  6:36 ` Brian Dolbec
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2015-10-06  4:06 UTC (permalink / raw
  To: gentoo-catalyst

This variables aren't actually used which the linter likes to warn about,
so add a _ prefix to their name to silence the warnings.
---
 catalyst/base/resume.py     | 2 +-
 catalyst/main.py            | 2 +-
 catalyst/support.py         | 2 +-
 catalyst/targets/netboot.py | 5 +++--
 setup.py                    | 2 +-
 5 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/catalyst/base/resume.py b/catalyst/base/resume.py
index 608f574..e3f03e7 100644
--- a/catalyst/base/resume.py
+++ b/catalyst/base/resume.py
@@ -23,7 +23,7 @@ class AutoResumeError(Exception):
 	def __init__(self, message, print_traceback=False):
 		if message:
 			if print_traceback:
-				(type,value)=sys.exc_info()[:2]
+				(_type, value) = sys.exc_info()[:2]
 				if value!=None:
 					print
 					print "Traceback values found.  listing..."
diff --git a/catalyst/main.py b/catalyst/main.py
index dfa0609..04f689e 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -182,7 +182,7 @@ def main():
 
 	# parse out the command line arguments
 	try:
-		opts,args = getopt.getopt(sys.argv[1:], "apPThvdc:C:f:FVs:", ["purge", "purgeonly", "purgetmponly", "help", "version", "debug",\
+		opts, _args = getopt.getopt(sys.argv[1:], "apPThvdc:C:f:FVs:", ["purge", "purgeonly", "purgetmponly", "help", "version", "debug",
 			"clear-autoresume", "config=", "cli=", "file=", "fetch", "verbose","snapshot="])
 
 	except getopt.GetoptError:
diff --git a/catalyst/support.py b/catalyst/support.py
index 5563a15..a879eaf 100644
--- a/catalyst/support.py
+++ b/catalyst/support.py
@@ -88,7 +88,7 @@ class CatalystError(Exception):
 	def __init__(self, message, print_traceback=False):
 		if message:
 			if print_traceback:
-				(type,value)=sys.exc_info()[:2]
+				(_type, value) = sys.exc_info()[:2]
 				if value!=None:
 					print
 					print "Traceback values found.  listing..."
diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
index c41ed59..b0e322c 100644
--- a/catalyst/targets/netboot.py
+++ b/catalyst/targets/netboot.py
@@ -31,11 +31,12 @@ class netboot(StageBase):
 		self.required_values=[]
 
 		try:
+			# XXX: This code does nothing because the for loop below is disabled.
 			if "netboot/packages" in addlargs:
 				if type(addlargs["netboot/packages"]) == types.StringType:
-					loopy=[addlargs["netboot/packages"]]
+					_loopy = [addlargs["netboot/packages"]]
 				else:
-					loopy=addlargs["netboot/packages"]
+					_loopy = addlargs["netboot/packages"]
 
 		#	for x in loopy:
 		#		self.required_values.append("netboot/packages/"+x+"/files")
diff --git a/setup.py b/setup.py
index feca894..27ed2de 100755
--- a/setup.py
+++ b/setup.py
@@ -34,7 +34,7 @@ def _files(prefix, root):
 
 	Yielding `(target_dir, (file_source_paths, ...))` tuples.
 	"""
-	for dirpath, dirnames, filenames in _os.walk(root):
+	for dirpath, _dirnames, filenames in _os.walk(root):
 		reldir = _os.path.relpath(dirpath, root)
 		install_directory = _posix_path(
 			_os.path.join(prefix, reldir))
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [gentoo-catalyst] [PATCH] lint: fix up unused variables
  2015-10-06  4:06 [gentoo-catalyst] [PATCH] lint: fix up unused variables Mike Frysinger
@ 2015-10-06  6:36 ` Brian Dolbec
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2015-10-06  6:36 UTC (permalink / raw
  To: gentoo-catalyst

On Tue,  6 Oct 2015 00:06:33 -0400
Mike Frysinger <vapier@gentoo.org> wrote:

> This variables aren't actually used which the linter likes to warn
> about, so add a _ prefix to their name to silence the warnings.
> ---
>  catalyst/base/resume.py     | 2 +-
>  catalyst/main.py            | 2 +-
>  catalyst/support.py         | 2 +-
>  catalyst/targets/netboot.py | 5 +++--
>  setup.py                    | 2 +-
>  5 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/catalyst/base/resume.py b/catalyst/base/resume.py
> index 608f574..e3f03e7 100644
> --- a/catalyst/base/resume.py
> +++ b/catalyst/base/resume.py
> @@ -23,7 +23,7 @@ class AutoResumeError(Exception):
>  	def __init__(self, message, print_traceback=False):
>  		if message:
>  			if print_traceback:
> -				(type,value)=sys.exc_info()[:2]
> +				(_type, value) = sys.exc_info()[:2]
>  				if value!=None:
>  					print
>  					print "Traceback values
> found.  listing..." diff --git a/catalyst/main.py b/catalyst/main.py
> index dfa0609..04f689e 100644
> --- a/catalyst/main.py
> +++ b/catalyst/main.py
> @@ -182,7 +182,7 @@ def main():
>  
>  	# parse out the command line arguments
>  	try:
> -		opts,args = getopt.getopt(sys.argv[1:],
> "apPThvdc:C:f:FVs:", ["purge", "purgeonly", "purgetmponly", "help",
> "version", "debug",\
> +		opts, _args = getopt.getopt(sys.argv[1:],
> "apPThvdc:C:f:FVs:", ["purge", "purgeonly", "purgetmponly", "help",
> "version", "debug", "clear-autoresume", "config=", "cli=", "file=",
> "fetch", "verbose","snapshot="]) except getopt.GetoptError:
> diff --git a/catalyst/support.py b/catalyst/support.py
> index 5563a15..a879eaf 100644
> --- a/catalyst/support.py
> +++ b/catalyst/support.py
> @@ -88,7 +88,7 @@ class CatalystError(Exception):
>  	def __init__(self, message, print_traceback=False):
>  		if message:
>  			if print_traceback:
> -				(type,value)=sys.exc_info()[:2]
> +				(_type, value) = sys.exc_info()[:2]
>  				if value!=None:
>  					print
>  					print "Traceback values
> found.  listing..." diff --git a/catalyst/targets/netboot.py
> b/catalyst/targets/netboot.py index c41ed59..b0e322c 100644
> --- a/catalyst/targets/netboot.py
> +++ b/catalyst/targets/netboot.py
> @@ -31,11 +31,12 @@ class netboot(StageBase):
>  		self.required_values=[]
>  
>  		try:
> +			# XXX: This code does nothing because the
> for loop below is disabled. if "netboot/packages" in addlargs:
>  				if
> type(addlargs["netboot/packages"]) == types.StringType:
> -
> loopy=[addlargs["netboot/packages"]]
> +					_loopy =
> [addlargs["netboot/packages"]] else:
> -
> loopy=addlargs["netboot/packages"]
> +					_loopy =
> addlargs["netboot/packages"] 
>  		#	for x in loopy:
>  		#
> self.required_values.append("netboot/packages/"+x+"/files") diff
> --git a/setup.py b/setup.py index feca894..27ed2de 100755
> --- a/setup.py
> +++ b/setup.py
> @@ -34,7 +34,7 @@ def _files(prefix, root):
>  
>  	Yielding `(target_dir, (file_source_paths, ...))` tuples.
>  	"""
> -	for dirpath, dirnames, filenames in _os.walk(root):
> +	for dirpath, _dirnames, filenames in _os.walk(root):
>  		reldir = _os.path.relpath(dirpath, root)
>  		install_directory = _posix_path(
>  			_os.path.join(prefix, reldir))

good :)

-- 
Brian Dolbec <dolsen>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-06  6:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-06  4:06 [gentoo-catalyst] [PATCH] lint: fix up unused variables Mike Frysinger
2015-10-06  6:36 ` Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox