[PATCH] Cleanup some pylint errors in analog
Vratislav Podzimek
vpodzime at redhat.com
Tue Feb 10 08:43:00 UTC 2015
On Mon, 2015-02-09 at 09:25 -0800, Brian C. Lane wrote:
> ---
> scripts/analog | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/scripts/analog b/scripts/analog
> index eb1962e..6a426a7 100755
> --- a/scripts/analog
> +++ b/scripts/analog
> @@ -24,11 +24,9 @@
> from __future__ import print_function
>
> import getpass
> -import errno
> import optparse
> import os
> import os.path
> -import signal
> import sys
>
> DEFAULT_PORT = 6080
> @@ -194,9 +192,9 @@ def pid_location(unique_id):
> os.mkdir(directory)
> return location
>
> -if __name__ == "__main__":
> +def main():
> try:
> - (options, args) = get_opts()
> + (options, _args) = get_opts()
> except OptParserError as exc:
> exc.parser.error(str(exc))
> sys.exit(1)
> @@ -205,9 +203,9 @@ if __name__ == "__main__":
> if options.output:
> options.output = os.path.abspath(options.output)
> try:
> - with open(options.output, 'w') as file:
> - file.write(config)
> - except IOError as e:
> + with open(options.output, 'w') as f:
> + f.write(config)
> + except IOError:
> print("Can't write into file %s" % options.output, file=sys.stderr)
> sys.exit(1)
> if options.stdout:
> @@ -218,3 +216,6 @@ if __name__ == "__main__":
> })
> else:
> print(config)
> +
> +if __name__ == "__main__":
> + main()
Looks good to me, but I must say my first reaction was "WTH is
scripts/analog?" Have anybody recently tested it works? And is anybody
using it?
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list