Make pylint happy

- fix super-with-arguments
- ignore raise-missing-from - too many intentional usages
This commit is contained in:
Marek Marczykowski-Górecki 2020-08-23 03:31:39 +02:00
parent fe583cd88e
commit e6186239ef
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
19 changed files with 73 additions and 79 deletions

View File

@ -13,6 +13,7 @@ extension-pkg-whitelist=lxml.etree
disable= disable=
bad-continuation, bad-continuation,
raising-format-tuple, raising-format-tuple,
raise-missing-from,
import-outside-toplevel, import-outside-toplevel,
inconsistent-return-statements, inconsistent-return-statements,
duplicate-code, duplicate-code,

View File

@ -167,7 +167,7 @@ class QubesBase(qubesadmin.base.PropertyHolder):
cache_enabled = False cache_enabled = False
def __init__(self): def __init__(self):
super(QubesBase, self).__init__(self, 'admin.property.', 'dom0') super().__init__(self, 'admin.property.', 'dom0')
self.domains = VMCollection(self) self.domains = VMCollection(self)
self.labels = qubesadmin.base.WrapperObjectsCollection( self.labels = qubesadmin.base.WrapperObjectsCollection(
self, 'admin.label.List', qubesadmin.label.Label) self, 'admin.label.List', qubesadmin.label.Label)
@ -454,19 +454,19 @@ class QubesBase(qubesadmin.base.PropertyHolder):
['qvm-appmenus', '--init', '--update', ['qvm-appmenus', '--init', '--update',
'--source', src_vm.name, dst_vm.name] '--source', src_vm.name, dst_vm.name]
subprocess.check_output(appmenus_cmd, stderr=subprocess.STDOUT) subprocess.check_output(appmenus_cmd, stderr=subprocess.STDOUT)
except OSError: except OSError as e:
# this file needs to be python 2.7 compatible, # this file needs to be python 2.7 compatible,
# so no FileNotFoundError # so no FileNotFoundError
self.log.error('Failed to clone appmenus, qvm-appmenus missing') self.log.error('Failed to clone appmenus, qvm-appmenus missing')
if not ignore_errors: if not ignore_errors:
raise qubesadmin.exc.QubesException( raise qubesadmin.exc.QubesException(
'Failed to clone appmenus') 'Failed to clone appmenus') from e
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
self.log.error('Failed to clone appmenus: %s', self.log.error('Failed to clone appmenus: %s',
e.output.decode()) e.output.decode())
if not ignore_errors: if not ignore_errors:
raise qubesadmin.exc.QubesException( raise qubesadmin.exc.QubesException(
'Failed to clone appmenus') 'Failed to clone appmenus') from e
except qubesadmin.exc.QubesException: except qubesadmin.exc.QubesException:
if not ignore_errors: if not ignore_errors:

View File

@ -38,7 +38,7 @@ class Core2VM(qubesadmin.backup.BackupVM):
'''VM object''' '''VM object'''
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods
def __init__(self): def __init__(self):
super(Core2VM, self).__init__() super().__init__()
self.backup_content = False self.backup_content = False
@property @property
@ -148,7 +148,7 @@ class Core2Qubes(qubesadmin.backup.BackupApp):
raise ValueError("store path required") raise ValueError("store path required")
self.qid_map = {} self.qid_map = {}
self.log = logging.getLogger('qubesadmin.backup.core2') self.log = logging.getLogger('qubesadmin.backup.core2')
super(Core2Qubes, self).__init__(store) super().__init__(store)
def load_globals(self, element): def load_globals(self, element):
'''Load global settings '''Load global settings

View File

@ -57,7 +57,7 @@ class Core3Qubes(qubesadmin.backup.BackupApp):
raise ValueError("store path required") raise ValueError("store path required")
self.log = logging.getLogger('qubesadmin.backup.core3') self.log = logging.getLogger('qubesadmin.backup.core3')
self.labels = {} self.labels = {}
super(Core3Qubes, self).__init__(store) super().__init__(store)
@staticmethod @staticmethod
def get_property(xml_obj, prop): def get_property(xml_obj, prop):

View File

@ -82,7 +82,7 @@ _tar_file_size_re = re.compile(r"^[^ ]+ [^ ]+/[^ ]+ *([0-9]+) .*")
class BackupCanceledError(QubesException): class BackupCanceledError(QubesException):
'''Exception raised when backup/restore was cancelled''' '''Exception raised when backup/restore was cancelled'''
def __init__(self, msg, tmpdir=None): def __init__(self, msg, tmpdir=None):
super(BackupCanceledError, self).__init__(msg) super().__init__(msg)
self.tmpdir = tmpdir self.tmpdir = tmpdir
def init_supported_hmac_and_crypto(): def init_supported_hmac_and_crypto():
@ -361,7 +361,7 @@ class ExtractWorker3(Process):
:param bool verify_only: only verify data integrity, do not extract :param bool verify_only: only verify data integrity, do not extract
:param dict handlers: handlers for actual data :param dict handlers: handlers for actual data
''' '''
super(ExtractWorker3, self).__init__() super().__init__()
#: queue with files to extract #: queue with files to extract
self.queue = queue self.queue = queue
#: paths on the queue are relative to this dir #: paths on the queue are relative to this dir
@ -904,14 +904,14 @@ class BackupRestore(object):
USERNAME_MISMATCH = object() USERNAME_MISMATCH = object()
def __init__(self, vm, subdir=None): def __init__(self, vm, subdir=None):
super(BackupRestore.Dom0ToRestore, self).__init__(vm) super().__init__(vm)
if subdir: if subdir:
self.subdir = subdir self.subdir = subdir
self.username = os.path.basename(subdir) self.username = os.path.basename(subdir)
def __init__(self, app, backup_location, backup_vm, passphrase, def __init__(self, app, backup_location, backup_vm, passphrase,
location_is_service=False, force_compression_filter=None): location_is_service=False, force_compression_filter=None):
super(BackupRestore, self).__init__() super().__init__()
#: qubes.Qubes instance #: qubes.Qubes instance
self.app = app self.app = app

View File

@ -345,7 +345,7 @@ class PropertyHolder(object):
def __setattr__(self, key, value): def __setattr__(self, key, value):
if key.startswith('_') or key in self._local_properties(): if key.startswith('_') or key in self._local_properties():
return super(PropertyHolder, self).__setattr__(key, value) return super().__setattr__(key, value)
if value is qubesadmin.DEFAULT: if value is qubesadmin.DEFAULT:
try: try:
self.qubesd_call( self.qubesd_call(
@ -371,7 +371,7 @@ class PropertyHolder(object):
def __delattr__(self, name): def __delattr__(self, name):
if name.startswith('_') or name in self._local_properties(): if name.startswith('_') or name in self._local_properties():
return super(PropertyHolder, self).__delattr__(name) return super().__delattr__(name)
try: try:
self.qubesd_call( self.qubesd_call(
self._method_dest, self._method_dest,

View File

@ -115,7 +115,7 @@ class UnknownDevice(DeviceInfo):
**kwargs): **kwargs):
if description is None: if description is None:
description = "Unknown device" description = "Unknown device"
super(UnknownDevice, self).__init__(backend_domain, devclass, ident, super().__init__(backend_domain, devclass, ident,
description, **kwargs) description, **kwargs)
@ -295,7 +295,7 @@ class DeviceManager(dict):
""" """
def __init__(self, vm): def __init__(self, vm):
super(DeviceManager, self).__init__() super().__init__()
self._vm = vm self._vm = vm
def __missing__(self, key): def __missing__(self, key):

View File

@ -25,7 +25,7 @@ class QubesException(Exception):
'''Base exception for all Qubes-related errors.''' '''Base exception for all Qubes-related errors.'''
def __init__(self, message_format, *args, **kwargs): def __init__(self, message_format, *args, **kwargs):
# TODO: handle translations # TODO: handle translations
super(QubesException, self).__init__( super().__init__(
message_format % tuple(int(d) if d.isdigit() else d for d in args), message_format % tuple(int(d) if d.isdigit() else d for d in args),
**kwargs) **kwargs)
@ -164,7 +164,7 @@ class DeviceAlreadyAttached(QubesException, KeyError):
class BackupRestoreError(QubesException): class BackupRestoreError(QubesException):
'''Restoring a backup failed''' '''Restoring a backup failed'''
def __init__(self, msg, backup_log=None): def __init__(self, msg, backup_log=None):
super(BackupRestoreError, self).__init__(msg) super().__init__(msg)
self.backup_log = backup_log self.backup_log = backup_log
# pylint: disable=too-many-ancestors # pylint: disable=too-many-ancestors
@ -177,8 +177,7 @@ class QubesPropertyAccessError(QubesDaemonAccessError, AttributeError):
'''Failed to read/write property value, cause is unknown (insufficient '''Failed to read/write property value, cause is unknown (insufficient
permissions, no such property, invalid value, other)''' permissions, no such property, invalid value, other)'''
def __init__(self, prop): def __init__(self, prop):
super(QubesPropertyAccessError, self).__init__( super().__init__('Failed to access \'%s\' property' % prop)
'Failed to access \'%s\' property' % prop)
# legacy name # legacy name
QubesDaemonNoResponseError = QubesDaemonAccessError QubesDaemonNoResponseError = QubesDaemonAccessError

View File

@ -35,7 +35,7 @@ class Features(object):
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods
def __init__(self, vm): def __init__(self, vm):
super(Features, self).__init__() super().__init__()
self.vm = vm self.vm = vm
def __delitem__(self, key): def __delitem__(self, key):

View File

@ -53,7 +53,7 @@ class RuleChoice(RuleOption):
'''Base class for multiple-choices rule elements''' '''Base class for multiple-choices rule elements'''
# pylint: disable=abstract-method # pylint: disable=abstract-method
def __init__(self, value): def __init__(self, value):
super(RuleChoice, self).__init__(value) super().__init__(value)
self.allowed_values = \ self.allowed_values = \
[v for k, v in self.__class__.__dict__.items() [v for k, v in self.__class__.__dict__.items()
if not k.startswith('__') and isinstance(v, str) and if not k.startswith('__') and isinstance(v, str) and
@ -148,7 +148,7 @@ class DstHost(RuleOption):
except socket.error: except socket.error:
raise ValueError('Invalid IP address: ' + host) raise ValueError('Invalid IP address: ' + host)
super(DstHost, self).__init__(value) super().__init__(value)
@property @property
def rule(self): def rule(self):
@ -175,7 +175,7 @@ class DstPorts(RuleOption):
raise ValueError('Ports out of range') raise ValueError('Ports out of range')
if self.range[0] > self.range[1]: if self.range[0] > self.range[1]:
raise ValueError('Invalid port range') raise ValueError('Invalid port range')
super(DstPorts, self).__init__( super().__init__(
str(self.range[0]) if self.range[0] == self.range[1] str(self.range[0]) if self.range[0] == self.range[1]
else '{!s}-{!s}'.format(*self.range)) else '{!s}-{!s}'.format(*self.range))
@ -188,7 +188,7 @@ class DstPorts(RuleOption):
class IcmpType(RuleOption): class IcmpType(RuleOption):
'''ICMP packet type''' '''ICMP packet type'''
def __init__(self, value): def __init__(self, value):
super(IcmpType, self).__init__(value) super().__init__(value)
value = int(value) value = int(value)
if value < 0 or value > 255: if value < 0 or value > 255:
raise ValueError('ICMP type out of range') raise ValueError('ICMP type out of range')
@ -212,7 +212,7 @@ class SpecialTarget(RuleChoice):
class Expire(RuleOption): class Expire(RuleOption):
'''Rule expire time''' '''Rule expire time'''
def __init__(self, value): def __init__(self, value):
super(Expire, self).__init__(value) super().__init__(value)
self.datetime = datetime.datetime.utcfromtimestamp(int(value)) self.datetime = datetime.datetime.utcfromtimestamp(int(value))
@property @property

View File

@ -46,7 +46,7 @@ class Label(object):
qubesd_response = self.app.qubesd_call( qubesd_response = self.app.qubesd_call(
'dom0', 'admin.label.Get', self._name, None) 'dom0', 'admin.label.Get', self._name, None)
except qubesadmin.exc.QubesDaemonNoResponseError: except qubesadmin.exc.QubesDaemonNoResponseError:
raise AttributeError raise qubesadmin.exc.QubesPropertyAccessError('label.color')
self._color = qubesd_response.decode() self._color = qubesd_response.decode()
return self._color return self._color
@ -63,13 +63,13 @@ class Label(object):
@property @property
def index(self): def index(self):
'''color specification as in HTML (``#abcdef``)''' '''label numeric identifier'''
if self._index is None: if self._index is None:
try: try:
qubesd_response = self.app.qubesd_call( qubesd_response = self.app.qubesd_call(
'dom0', 'admin.label.Index', self._name, None) 'dom0', 'admin.label.Index', self._name, None)
except qubesadmin.exc.QubesDaemonNoResponseError: except qubesadmin.exc.QubesDaemonNoResponseError:
raise AttributeError raise qubesadmin.exc.QubesPropertyAccessError('label.index')
self._index = int(qubesd_response.decode()) self._index = int(qubesd_response.decode())
return self._index return self._index

View File

@ -91,7 +91,7 @@ class QubesSpinner(AbstractSpinner):
This spinner uses standard ASCII control characters''' This spinner uses standard ASCII control characters'''
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(QubesSpinner, self).__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.hidelen = 0 self.hidelen = 0
self.cub1 = '\b' self.cub1 = '\b'
@ -120,7 +120,7 @@ class QubesSpinnerEnterpriseEdition(QubesSpinner):
if charset is None: if charset is None:
charset = ENTERPRISE_CHARSET if self.stream_isatty else '.' charset = ENTERPRISE_CHARSET if self.stream_isatty else '.'
super(QubesSpinnerEnterpriseEdition, self).__init__(stream, charset) super().__init__(stream, charset)
if self.stream_isatty: if self.stream_isatty:
try: try:

View File

@ -31,7 +31,7 @@ class Tags(object):
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods
def __init__(self, vm): def __init__(self, vm):
super(Tags, self).__init__() super().__init__()
self.vm = vm self.vm = vm
def remove(self, elem): def remove(self, elem):

View File

@ -62,7 +62,7 @@ class PropertyAction(argparse.Action):
metavar='NAME=VALUE', metavar='NAME=VALUE',
required=False, required=False,
help='set property to a value'): help='set property to a value'):
super(PropertyAction, self).__init__(option_strings, 'properties', super().__init__(option_strings, 'properties',
metavar=metavar, default={}, help=help) metavar=metavar, default={}, help=help)
def __call__(self, parser, namespace, values, option_string=None): def __call__(self, parser, namespace, values, option_string=None):
@ -99,7 +99,7 @@ class SinglePropertyAction(argparse.Action):
if const is not None: if const is not None:
nargs = 0 nargs = 0
super(SinglePropertyAction, self).__init__(option_strings, 'properties', super().__init__(option_strings, 'properties',
metavar=metavar, help=help, default={}, const=const, metavar=metavar, help=help, default={}, const=const,
nargs=nargs) nargs=nargs)
@ -141,7 +141,7 @@ class VmNameAction(QubesAction):
nargs, "Passed unexpected value {!s} as {!s} nargs ".format( nargs, "Passed unexpected value {!s} as {!s} nargs ".format(
nargs, dest)) nargs, dest))
super(VmNameAction, self).__init__(option_strings, dest=dest, help=help, super().__init__(option_strings, dest=dest, help=help,
nargs=nargs, **kwargs) nargs=nargs, **kwargs)
def __call__(self, parser, namespace, values, option_string=None): def __call__(self, parser, namespace, values, option_string=None):
@ -200,11 +200,11 @@ class RunningVmNameAction(VmNameAction):
raise argparse.ArgumentError( raise argparse.ArgumentError(
nargs, "Passed unexpected value {!s} as {!s} nargs ".format( nargs, "Passed unexpected value {!s} as {!s} nargs ".format(
nargs, dest)) nargs, dest))
super(RunningVmNameAction, self).__init__( super().__init__(
option_strings, dest=dest, help=help, nargs=nargs, **kwargs) option_strings, dest=dest, help=help, nargs=nargs, **kwargs)
def parse_qubes_app(self, parser, namespace): def parse_qubes_app(self, parser, namespace):
super(RunningVmNameAction, self).parse_qubes_app(parser, namespace) super().parse_qubes_app(parser, namespace)
for vm in namespace.domains: for vm in namespace.domains:
if not vm.is_running(): if not vm.is_running():
parser.error_runtime("domain {!r} is not running".format( parser.error_runtime("domain {!r} is not running".format(
@ -220,7 +220,7 @@ class VolumeAction(QubesAction):
def __init__(self, help='A pool & volume id combination', def __init__(self, help='A pool & volume id combination',
required=True, **kwargs): required=True, **kwargs):
# pylint: disable=redefined-builtin # pylint: disable=redefined-builtin
super(VolumeAction, self).__init__(help=help, required=required, super().__init__(help=help, required=required,
**kwargs) **kwargs)
def __call__(self, parser, namespace, values, option_string=None): def __call__(self, parser, namespace, values, option_string=None):
@ -261,7 +261,7 @@ class VMVolumeAction(QubesAction):
def __init__(self, help='A pool & volume id combination', def __init__(self, help='A pool & volume id combination',
required=True, **kwargs): required=True, **kwargs):
# pylint: disable=redefined-builtin # pylint: disable=redefined-builtin
super(VMVolumeAction, self).__init__(help=help, required=required, super().__init__(help=help, required=required,
**kwargs) **kwargs)
def __call__(self, parser, namespace, values, option_string=None): def __call__(self, parser, namespace, values, option_string=None):
@ -339,7 +339,7 @@ class QubesArgumentParser(argparse.ArgumentParser):
def __init__(self, vmname_nargs=None, **kwargs): def __init__(self, vmname_nargs=None, **kwargs):
super(QubesArgumentParser, self).__init__(add_help=False, **kwargs) super().__init__(add_help=False, **kwargs)
self._vmname_nargs = vmname_nargs self._vmname_nargs = vmname_nargs
@ -370,7 +370,7 @@ class QubesArgumentParser(argparse.ArgumentParser):
# pylint: disable=arguments-differ,signature-differs # pylint: disable=arguments-differ,signature-differs
# hack for tests # hack for tests
app = kwargs.pop('app', None) app = kwargs.pop('app', None)
namespace = super(QubesArgumentParser, self).parse_args(*args, **kwargs) namespace = super().parse_args(*args, **kwargs)
self.set_qubes_verbosity(namespace) self.set_qubes_verbosity(namespace)
if app is not None: if app is not None:
@ -472,8 +472,7 @@ class AliasedSubParsersAction(argparse._SubParsersAction):
dest = name dest = name
if aliases: if aliases:
dest += ' (%s)' % ','.join(aliases) dest += ' (%s)' % ','.join(aliases)
super(AliasedSubParsersAction._AliasedPseudoAction, self).\ super().__init__(option_strings=[], dest=dest, help=help)
__init__(option_strings=[], dest=dest, help=help)
def __call__(self, parser, namespace, values, option_string=None): def __call__(self, parser, namespace, values, option_string=None):
pass pass
@ -485,8 +484,7 @@ class AliasedSubParsersAction(argparse._SubParsersAction):
else: else:
aliases = [] aliases = []
local_parser = super(AliasedSubParsersAction, self).add_parser( local_parser = super().add_parser(name, **kwargs)
name, **kwargs)
# Make the aliases work. # Make the aliases work.
for alias in aliases: for alias in aliases:
@ -532,7 +530,7 @@ class VmNameGroup(argparse._MutuallyExclusiveGroup):
def __init__(self, container, required, vm_action=VmNameAction, help=None): def __init__(self, container, required, vm_action=VmNameAction, help=None):
# pylint: disable=redefined-builtin # pylint: disable=redefined-builtin
super(VmNameGroup, self).__init__(container, required=required) super().__init__(container, required=required)
if not help: if not help:
help = 'perform the action on all qubes' help = 'perform the action on all qubes'
self.add_argument('--all', action='store_true', dest='all_domains', self.add_argument('--all', action='store_true', dest='all_domains',

View File

@ -163,7 +163,7 @@ class DeviceAction(qubesadmin.tools.QubesAction):
required=True, allow_unknown=False, **kwargs): required=True, allow_unknown=False, **kwargs):
# pylint: disable=redefined-builtin # pylint: disable=redefined-builtin
self.allow_unknown = allow_unknown self.allow_unknown = allow_unknown
super(DeviceAction, self).__init__(help=help, required=required, super().__init__(help=help, required=required,
**kwargs) **kwargs)
def __call__(self, parser, namespace, values, option_string=None): def __call__(self, parser, namespace, values, option_string=None):

View File

@ -141,9 +141,7 @@ class PropertyColumn(Column):
def __init__(self, name): def __init__(self, name):
ls_head = name.replace('_', '-').upper() ls_head = name.replace('_', '-').upper()
super(PropertyColumn, self).__init__( super().__init__(head=ls_head, attr=name)
head=ls_head,
attr=name)
def __repr__(self): def __repr__(self):
return '{}(head={!r}'.format( return '{}(head={!r}'.format(
@ -201,9 +199,7 @@ class FlagsColumn(Column):
# pylint: disable=no-self-use # pylint: disable=no-self-use
def __init__(self): def __init__(self):
super(FlagsColumn, self).__init__( super().__init__(head='FLAGS', doc=self.__class__.__doc__)
head='FLAGS',
doc=self.__class__.__doc__)
@flag(1) @flag(1)
@ -505,7 +501,7 @@ class _HelpColumnsAction(argparse.Action):
dest=argparse.SUPPRESS, dest=argparse.SUPPRESS,
default=argparse.SUPPRESS, default=argparse.SUPPRESS,
help='list all available columns with short descriptions and exit'): help='list all available columns with short descriptions and exit'):
super(_HelpColumnsAction, self).__init__( super().__init__(
option_strings=option_strings, option_strings=option_strings,
dest=dest, dest=dest,
default=default, default=default,
@ -536,7 +532,7 @@ class _HelpFormatsAction(argparse.Action):
dest=argparse.SUPPRESS, dest=argparse.SUPPRESS,
default=argparse.SUPPRESS, default=argparse.SUPPRESS,
help='list all available formats with their definitions and exit'): help='list all available formats with their definitions and exit'):
super(_HelpFormatsAction, self).__init__( super().__init__(
option_strings=option_strings, option_strings=option_strings,
dest=dest, dest=dest,
default=default, default=default,

View File

@ -36,11 +36,11 @@ class _Info(qubesadmin.tools.PoolsAction):
def __init__(self, option_strings, help='print pool info and exit', def __init__(self, option_strings, help='print pool info and exit',
**kwargs): **kwargs):
# pylint: disable=redefined-builtin # pylint: disable=redefined-builtin
super(_Info, self).__init__(option_strings, help=help, **kwargs) super().__init__(option_strings, help=help, **kwargs)
def __call__(self, parser, namespace, values, option_string=None): def __call__(self, parser, namespace, values, option_string=None):
setattr(namespace, 'command', 'info') setattr(namespace, 'command', 'info')
super(_Info, self).__call__(parser, namespace, values, option_string) super().__call__(parser, namespace, values, option_string)
def pool_info(pool): def pool_info(pool):
@ -62,11 +62,11 @@ class _Remove(argparse.Action):
''' Action for argument parser that removes a pool ''' ''' Action for argument parser that removes a pool '''
def __init__(self, option_strings, dest=None, default=None, metavar=None): def __init__(self, option_strings, dest=None, default=None, metavar=None):
super(_Remove, self).__init__(option_strings=option_strings, super().__init__(option_strings=option_strings,
dest=dest, dest=dest,
metavar=metavar, metavar=metavar,
default=default, default=default,
help='remove pool') help='remove pool')
def __call__(self, parser, namespace, name, option_string=None): def __call__(self, parser, namespace, name, option_string=None):
setattr(namespace, 'command', 'remove') setattr(namespace, 'command', 'remove')
@ -77,12 +77,12 @@ class _Add(argparse.Action):
''' Action for argument parser that adds a pool. ''' ''' Action for argument parser that adds a pool. '''
def __init__(self, option_strings, dest=None, default=None, metavar=None): def __init__(self, option_strings, dest=None, default=None, metavar=None):
super(_Add, self).__init__(option_strings=option_strings, super().__init__(option_strings=option_strings,
dest=dest, dest=dest,
metavar=metavar, metavar=metavar,
default=default, default=default,
nargs=2, nargs=2,
help='add pool') help='add pool')
def __call__(self, parser, namespace, values, option_string=None): def __call__(self, parser, namespace, values, option_string=None):
name, driver = values name, driver = values
@ -95,23 +95,23 @@ class _Set(qubesadmin.tools.PoolsAction):
''' Action for argument parser that sets pool options. ''' ''' Action for argument parser that sets pool options. '''
def __init__(self, option_strings, dest=None, default=None, metavar=None): def __init__(self, option_strings, dest=None, default=None, metavar=None):
super(_Set, self).__init__(option_strings=option_strings, super().__init__(option_strings=option_strings,
dest=dest, dest=dest,
metavar=metavar, metavar=metavar,
default=default, default=default,
help='modify pool (use -o to specify ' help='modify pool (use -o to specify '
'modifications)') 'modifications)')
def __call__(self, parser, namespace, name, option_string=None): def __call__(self, parser, namespace, name, option_string=None):
setattr(namespace, 'command', 'set') setattr(namespace, 'command', 'set')
super(_Set, self).__call__(parser, namespace, name, option_string) super().__call__(parser, namespace, name, option_string)
class _Options(argparse.Action): class _Options(argparse.Action):
''' Action for argument parser that parsers options. ''' ''' Action for argument parser that parsers options. '''
def __init__(self, option_strings, dest, default, metavar='options'): def __init__(self, option_strings, dest, default, metavar='options'):
super(_Options, self).__init__( super().__init__(
option_strings=option_strings, option_strings=option_strings,
dest=dest, dest=dest,
metavar=metavar, metavar=metavar,

View File

@ -42,7 +42,7 @@ class DriveAction(argparse.Action):
metavar='IMAGE', metavar='IMAGE',
required=False, required=False,
help='Attach drive'): help='Attach drive'):
super(DriveAction, self).__init__(option_strings, dest, super().__init__(option_strings, dest,
metavar=metavar, help=help) metavar=metavar, help=help)
self.prefix = prefix self.prefix = prefix

View File

@ -53,7 +53,7 @@ class QubesVM(qubesadmin.base.PropertyHolder):
firewall = None firewall = None
def __init__(self, app, name, klass=None, power_state=None): def __init__(self, app, name, klass=None, power_state=None):
super(QubesVM, self).__init__(app, 'admin.vm.property.', name) super().__init__(app, 'admin.vm.property.', name)
self._volumes = None self._volumes = None
self._klass = klass self._klass = klass
self._power_state_cache = power_state self._power_state_cache = power_state
@ -373,7 +373,7 @@ class QubesVM(qubesadmin.base.PropertyHolder):
# use cached value if available # use cached value if available
if self._klass is None: if self._klass is None:
# pylint: disable=no-member # pylint: disable=no-member
self._klass = super(QubesVM, self).klass self._klass = super().klass
return self._klass return self._klass
class DispVMWrapper(QubesVM): class DispVMWrapper(QubesVM):
@ -398,7 +398,7 @@ class DispVMWrapper(QubesVM):
# Service call may wait for session start, give it more time # Service call may wait for session start, give it more time
# than default 5s # than default 5s
kwargs['connect_timeout'] = self.qrexec_timeout kwargs['connect_timeout'] = self.qrexec_timeout
return super(DispVMWrapper, self).run_service(service, **kwargs) return super().run_service(service, **kwargs)
def cleanup(self): def cleanup(self):
'''Cleanup after DispVM usage''' '''Cleanup after DispVM usage'''