summaryrefslogtreecommitdiffstats
path: root/deluge/argparserbase.py
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/argparserbase.py')
-rw-r--r--deluge/argparserbase.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/deluge/argparserbase.py b/deluge/argparserbase.py
index 547c1c71c..5dc433086 100644
--- a/deluge/argparserbase.py
+++ b/deluge/argparserbase.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
#
@@ -7,8 +6,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import argparse
import logging
import os
@@ -95,7 +92,7 @@ def _get_version_detail():
except ImportError:
pass
version_str += 'Python: %s\n' % platform.python_version()
- version_str += 'OS: %s %s\n' % (platform.system(), common.get_os_version())
+ version_str += f'OS: {platform.system()} {common.get_os_version()}\n'
return version_str
@@ -109,8 +106,8 @@ class DelugeTextHelpFormatter(argparse.RawDescriptionHelpFormatter):
line instead. This way list formatting is not mangled by textwrap.wrap.
"""
wrapped_lines = []
- for l in text.splitlines():
- wrapped_lines.extend(textwrap.wrap(l, width, subsequent_indent=' '))
+ for line in text.splitlines():
+ wrapped_lines.extend(textwrap.wrap(line, width, subsequent_indent=' '))
return wrapped_lines
def _format_action_invocation(self, action):
@@ -137,7 +134,7 @@ class DelugeTextHelpFormatter(argparse.RawDescriptionHelpFormatter):
default = action.dest.upper()
args_string = self._format_args(action, default)
opt = ', '.join(action.option_strings)
- parts.append('%s %s' % (opt, args_string))
+ parts.append(f'{opt} {args_string}')
return ', '.join(parts)
@@ -165,7 +162,7 @@ class ArgParserBase(argparse.ArgumentParser):
self.log_stream = kwargs['log_stream']
del kwargs['log_stream']
- super(ArgParserBase, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
self.common_setup = False
self.process_arg_group = False
@@ -202,7 +199,7 @@ class ArgParserBase(argparse.ArgumentParser):
self.group.add_argument(
'-L',
'--loglevel',
- choices=[l for k in deluge.log.levels for l in (k, k.upper())],
+ choices=[level for k in deluge.log.levels for level in (k, k.upper())],
help=_('Set the log level (none, error, warning, info, debug)'),
metavar='<level>',
)
@@ -246,7 +243,7 @@ class ArgParserBase(argparse.ArgumentParser):
argparse.Namespace: The parsed arguments.
"""
- options = super(ArgParserBase, self).parse_args(args=args)
+ options = super().parse_args(args=args)
return self._handle_ui_options(options)
def parse_known_ui_args(self, args, withhold=None):
@@ -262,7 +259,7 @@ class ArgParserBase(argparse.ArgumentParser):
"""
if withhold:
args = [a for a in args if a not in withhold]
- options, remaining = super(ArgParserBase, self).parse_known_args(args=args)
+ options, remaining = super().parse_known_args(args=args)
options.remaining = remaining
# Handle common and process group options
return self._handle_ui_options(options)