Make pylint happy
- ignore raise-missing-from - fix super-with-arguments
This commit is contained in:
parent
6b9528316f
commit
1500ed8fcb
@ -22,6 +22,7 @@ disable=
|
|||||||
logging-format-interpolation,
|
logging-format-interpolation,
|
||||||
missing-docstring,
|
missing-docstring,
|
||||||
not-an-iterable,
|
not-an-iterable,
|
||||||
|
raise-missing-from,
|
||||||
star-args,
|
star-args,
|
||||||
wrong-import-order
|
wrong-import-order
|
||||||
|
|
||||||
|
@ -543,7 +543,7 @@ class PropertyHolder(qubes.events.Emitter):
|
|||||||
continue
|
continue
|
||||||
propvalues[key] = kwargs.pop(key)
|
propvalues[key] = kwargs.pop(key)
|
||||||
|
|
||||||
super(PropertyHolder, self).__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
for key, value in propvalues.items():
|
for key, value in propvalues.items():
|
||||||
setattr(self, key, value)
|
setattr(self, key, value)
|
||||||
|
@ -914,7 +914,7 @@ class Qubes(qubes.PropertyHolder):
|
|||||||
qubes.config.system_path[
|
qubes.config.system_path[
|
||||||
'qubes_store_filename']))
|
'qubes_store_filename']))
|
||||||
|
|
||||||
super(Qubes, self).__init__(xml=None, **kwargs)
|
super().__init__(xml=None, **kwargs)
|
||||||
|
|
||||||
self.__load_timestamp = None
|
self.__load_timestamp = None
|
||||||
self.__locked_fh = None
|
self.__locked_fh = None
|
||||||
|
@ -69,7 +69,7 @@ _re_alphanum = re.compile(r'^[A-Za-z0-9-]*$')
|
|||||||
|
|
||||||
class BackupCanceledError(qubes.exc.QubesException):
|
class BackupCanceledError(qubes.exc.QubesException):
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ class BackupHeader:
|
|||||||
class SendWorker:
|
class SendWorker:
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
def __init__(self, queue, base_dir, backup_stdout):
|
def __init__(self, queue, base_dir, backup_stdout):
|
||||||
super(SendWorker, self).__init__()
|
super().__init__()
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
self.base_dir = base_dir
|
self.base_dir = base_dir
|
||||||
self.backup_stdout = backup_stdout
|
self.backup_stdout = backup_stdout
|
||||||
@ -317,7 +317,7 @@ class Backup:
|
|||||||
If vms = None, use default list based on vm.include_in_backups property;
|
If vms = None, use default list based on vm.include_in_backups property;
|
||||||
exclude_list is always applied
|
exclude_list is always applied
|
||||||
"""
|
"""
|
||||||
super(Backup, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
#: progress of the backup - bytes handled of the current VM
|
#: progress of the backup - bytes handled of the current VM
|
||||||
self.chunk_size = 100 * 1024 * 1024
|
self.chunk_size = 100 * 1024 * 1024
|
||||||
|
@ -411,7 +411,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):
|
||||||
@ -427,7 +427,7 @@ class UnknownDevice(DeviceInfo):
|
|||||||
frontend_domain=None):
|
frontend_domain=None):
|
||||||
if description is None:
|
if description is None:
|
||||||
description = "Unknown device"
|
description = "Unknown device"
|
||||||
super(UnknownDevice, self).__init__(backend_domain, ident, description,
|
super().__init__(backend_domain, ident, description,
|
||||||
frontend_domain)
|
frontend_domain)
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ class Emitter(metaclass=EmitterMeta):
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(Emitter, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
if not hasattr(self, 'events_enabled'):
|
if not hasattr(self, 'events_enabled'):
|
||||||
self.events_enabled = False
|
self.events_enabled = False
|
||||||
self.__handlers__ = collections.defaultdict(set)
|
self.__handlers__ = collections.defaultdict(set)
|
||||||
|
36
qubes/exc.py
36
qubes/exc.py
@ -29,7 +29,7 @@ class QubesException(Exception):
|
|||||||
class QubesVMNotFoundError(QubesException, KeyError):
|
class QubesVMNotFoundError(QubesException, KeyError):
|
||||||
'''Domain cannot be found in the system'''
|
'''Domain cannot be found in the system'''
|
||||||
def __init__(self, vmname):
|
def __init__(self, vmname):
|
||||||
super(QubesVMNotFoundError, self).__init__(
|
super().__init__(
|
||||||
'No such domain: {!r}'.format(vmname))
|
'No such domain: {!r}'.format(vmname))
|
||||||
self.vmname = vmname
|
self.vmname = vmname
|
||||||
|
|
||||||
@ -41,13 +41,13 @@ class QubesVMNotFoundError(QubesException, KeyError):
|
|||||||
class QubesVMError(QubesException):
|
class QubesVMError(QubesException):
|
||||||
'''Some problem with domain state.'''
|
'''Some problem with domain state.'''
|
||||||
def __init__(self, vm, msg):
|
def __init__(self, vm, msg):
|
||||||
super(QubesVMError, self).__init__(msg)
|
super().__init__(msg)
|
||||||
self.vm = vm
|
self.vm = vm
|
||||||
|
|
||||||
class QubesVMInUseError(QubesVMError):
|
class QubesVMInUseError(QubesVMError):
|
||||||
'''VM is in use, cannot remove.'''
|
'''VM is in use, cannot remove.'''
|
||||||
def __init__(self, vm, msg=None):
|
def __init__(self, vm, msg=None):
|
||||||
super(QubesVMInUseError, self).__init__(vm,
|
super().__init__(vm,
|
||||||
msg or 'Domain is in use: {!r}'.format(vm.name))
|
msg or 'Domain is in use: {!r}'.format(vm.name))
|
||||||
|
|
||||||
class QubesVMNotStartedError(QubesVMError):
|
class QubesVMNotStartedError(QubesVMError):
|
||||||
@ -57,7 +57,7 @@ class QubesVMNotStartedError(QubesVMError):
|
|||||||
(that is, either running or paused).
|
(that is, either running or paused).
|
||||||
'''
|
'''
|
||||||
def __init__(self, vm, msg=None):
|
def __init__(self, vm, msg=None):
|
||||||
super(QubesVMNotStartedError, self).__init__(vm,
|
super().__init__(vm,
|
||||||
msg or 'Domain is powered off: {!r}'.format(vm.name))
|
msg or 'Domain is powered off: {!r}'.format(vm.name))
|
||||||
|
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ class QubesVMNotRunningError(QubesVMNotStartedError):
|
|||||||
halted or paused.
|
halted or paused.
|
||||||
'''
|
'''
|
||||||
def __init__(self, vm, msg=None):
|
def __init__(self, vm, msg=None):
|
||||||
super(QubesVMNotRunningError, self).__init__(vm,
|
super().__init__(vm,
|
||||||
msg or 'Domain not running (either powered off or paused): {!r}' \
|
msg or 'Domain not running (either powered off or paused): {!r}' \
|
||||||
.format(vm.name))
|
.format(vm.name))
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ class QubesVMNotPausedError(QubesVMNotStartedError):
|
|||||||
This exception is thrown when machine should be paused, but is not.
|
This exception is thrown when machine should be paused, but is not.
|
||||||
'''
|
'''
|
||||||
def __init__(self, vm, msg=None):
|
def __init__(self, vm, msg=None):
|
||||||
super(QubesVMNotPausedError, self).__init__(vm,
|
super().__init__(vm,
|
||||||
msg or 'Domain is not paused: {!r}'.format(vm.name))
|
msg or 'Domain is not paused: {!r}'.format(vm.name))
|
||||||
|
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ class QubesVMNotSuspendedError(QubesVMError):
|
|||||||
halted or running.
|
halted or running.
|
||||||
'''
|
'''
|
||||||
def __init__(self, vm, msg=None):
|
def __init__(self, vm, msg=None):
|
||||||
super(QubesVMNotSuspendedError, self).__init__(vm,
|
super().__init__(vm,
|
||||||
msg or 'Domain is not suspended: {!r}'.format(vm.name))
|
msg or 'Domain is not suspended: {!r}'.format(vm.name))
|
||||||
|
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ class QubesVMNotHaltedError(QubesVMError):
|
|||||||
running or paused).
|
running or paused).
|
||||||
'''
|
'''
|
||||||
def __init__(self, vm, msg=None):
|
def __init__(self, vm, msg=None):
|
||||||
super(QubesVMNotHaltedError, self).__init__(vm,
|
super().__init__(vm,
|
||||||
msg or 'Domain is not powered off: {!r}'.format(vm.name))
|
msg or 'Domain is not powered off: {!r}'.format(vm.name))
|
||||||
|
|
||||||
class QubesVMShutdownTimeoutError(QubesVMError):
|
class QubesVMShutdownTimeoutError(QubesVMError):
|
||||||
@ -109,21 +109,21 @@ class QubesVMShutdownTimeoutError(QubesVMError):
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
def __init__(self, vm, msg=None):
|
def __init__(self, vm, msg=None):
|
||||||
super(QubesVMShutdownTimeoutError, self).__init__(vm,
|
super().__init__(vm,
|
||||||
msg or 'Domain shutdown timed out: {!r}'.format(vm.name))
|
msg or 'Domain shutdown timed out: {!r}'.format(vm.name))
|
||||||
|
|
||||||
|
|
||||||
class QubesNoTemplateError(QubesVMError):
|
class QubesNoTemplateError(QubesVMError):
|
||||||
'''Cannot start domain, because there is no template'''
|
'''Cannot start domain, because there is no template'''
|
||||||
def __init__(self, vm, msg=None):
|
def __init__(self, vm, msg=None):
|
||||||
super(QubesNoTemplateError, self).__init__(vm,
|
super().__init__(vm,
|
||||||
msg or 'Template for the domain {!r} not found'.format(vm.name))
|
msg or 'Template for the domain {!r} not found'.format(vm.name))
|
||||||
|
|
||||||
|
|
||||||
class QubesPoolInUseError(QubesException):
|
class QubesPoolInUseError(QubesException):
|
||||||
'''VM is in use, cannot remove.'''
|
'''VM is in use, cannot remove.'''
|
||||||
def __init__(self, pool, msg=None):
|
def __init__(self, pool, msg=None):
|
||||||
super(QubesPoolInUseError, self).__init__(
|
super().__init__(
|
||||||
msg or 'Storage pool is in use: {!r}'.format(pool.name))
|
msg or 'Storage pool is in use: {!r}'.format(pool.name))
|
||||||
|
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ class QubesPropertyValueError(QubesValueError):
|
|||||||
'''Cannot set value of qubes.property, because user-supplied value is wrong.
|
'''Cannot set value of qubes.property, because user-supplied value is wrong.
|
||||||
'''
|
'''
|
||||||
def __init__(self, holder, prop, value, msg=None):
|
def __init__(self, holder, prop, value, msg=None):
|
||||||
super(QubesPropertyValueError, self).__init__(
|
super().__init__(
|
||||||
msg or 'Invalid value {!r} for property {!r} of {!r}'.format(
|
msg or 'Invalid value {!r} for property {!r} of {!r}'.format(
|
||||||
value, prop.__name__, holder))
|
value, prop.__name__, holder))
|
||||||
self.holder = holder
|
self.holder = holder
|
||||||
@ -147,7 +147,7 @@ class QubesNoSuchPropertyError(QubesException, AttributeError):
|
|||||||
'''Requested property does not exist
|
'''Requested property does not exist
|
||||||
'''
|
'''
|
||||||
def __init__(self, holder, prop_name, msg=None):
|
def __init__(self, holder, prop_name, msg=None):
|
||||||
super(QubesNoSuchPropertyError, self).__init__(
|
super().__init__(
|
||||||
msg or 'Invalid property {!r} of {!s}'.format(
|
msg or 'Invalid property {!r} of {!s}'.format(
|
||||||
prop_name, holder))
|
prop_name, holder))
|
||||||
self.holder = holder
|
self.holder = holder
|
||||||
@ -157,14 +157,14 @@ class QubesNoSuchPropertyError(QubesException, AttributeError):
|
|||||||
class QubesNotImplementedError(QubesException, NotImplementedError):
|
class QubesNotImplementedError(QubesException, NotImplementedError):
|
||||||
'''Thrown at user when some feature is not implemented'''
|
'''Thrown at user when some feature is not implemented'''
|
||||||
def __init__(self, msg=None):
|
def __init__(self, msg=None):
|
||||||
super(QubesNotImplementedError, self).__init__(
|
super().__init__(
|
||||||
msg or 'This feature is not available')
|
msg or 'This feature is not available')
|
||||||
|
|
||||||
|
|
||||||
class BackupCancelledError(QubesException):
|
class BackupCancelledError(QubesException):
|
||||||
'''Thrown at user when backup was manually cancelled'''
|
'''Thrown at user when backup was manually cancelled'''
|
||||||
def __init__(self, msg=None):
|
def __init__(self, msg=None):
|
||||||
super(BackupCancelledError, self).__init__(
|
super().__init__(
|
||||||
msg or 'Backup cancelled')
|
msg or 'Backup cancelled')
|
||||||
|
|
||||||
|
|
||||||
@ -172,21 +172,21 @@ class BackupAlreadyRunningError(QubesException):
|
|||||||
'''Thrown at user when they try to run the same backup twice at
|
'''Thrown at user when they try to run the same backup twice at
|
||||||
the same time'''
|
the same time'''
|
||||||
def __init__(self, msg=None):
|
def __init__(self, msg=None):
|
||||||
super(BackupAlreadyRunningError, self).__init__(
|
super().__init__(
|
||||||
msg or 'Backup already running')
|
msg or 'Backup already running')
|
||||||
|
|
||||||
|
|
||||||
class QubesMemoryError(QubesVMError, MemoryError):
|
class QubesMemoryError(QubesVMError, MemoryError):
|
||||||
'''Cannot start domain, because not enough memory is available'''
|
'''Cannot start domain, because not enough memory is available'''
|
||||||
def __init__(self, vm, msg=None):
|
def __init__(self, vm, msg=None):
|
||||||
super(QubesMemoryError, self).__init__(vm,
|
super().__init__(vm,
|
||||||
msg or 'Not enough memory to start domain {!r}'.format(vm.name))
|
msg or 'Not enough memory to start domain {!r}'.format(vm.name))
|
||||||
|
|
||||||
|
|
||||||
class QubesFeatureNotFoundError(QubesException, KeyError):
|
class QubesFeatureNotFoundError(QubesException, KeyError):
|
||||||
'''Feature not set for a given domain'''
|
'''Feature not set for a given domain'''
|
||||||
def __init__(self, domain, feature):
|
def __init__(self, domain, feature):
|
||||||
super(QubesFeatureNotFoundError, self).__init__(
|
super().__init__(
|
||||||
'Feature not set for domain {}: {}'.format(domain, feature))
|
'Feature not set for domain {}: {}'.format(domain, feature))
|
||||||
self.feature = feature
|
self.feature = feature
|
||||||
self.vm = domain
|
self.vm = domain
|
||||||
|
@ -36,7 +36,7 @@ class JustEvaluateAllowResolution(parser.AllowResolution):
|
|||||||
|
|
||||||
class AdminExtension(qubes.ext.Extension):
|
class AdminExtension(qubes.ext.Extension):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(AdminExtension, self).__init__()
|
super().__init__()
|
||||||
# during tests, __init__() of the extension can be called multiple
|
# during tests, __init__() of the extension can be called multiple
|
||||||
# times, because there are multiple Qubes() object instances
|
# times, because there are multiple Qubes() object instances
|
||||||
if not hasattr(self, 'policy_cache'):
|
if not hasattr(self, 'policy_cache'):
|
||||||
|
@ -44,7 +44,7 @@ SYSTEM_DISKS_DOM0_KERNEL = SYSTEM_DISKS + ('xvdd',)
|
|||||||
|
|
||||||
class BlockDevice(qubes.devices.DeviceInfo):
|
class BlockDevice(qubes.devices.DeviceInfo):
|
||||||
def __init__(self, backend_domain, ident):
|
def __init__(self, backend_domain, ident):
|
||||||
super(BlockDevice, self).__init__(backend_domain=backend_domain,
|
super().__init__(backend_domain=backend_domain,
|
||||||
ident=ident)
|
ident=ident)
|
||||||
self._description = None
|
self._description = None
|
||||||
self._mode = None
|
self._mode = None
|
||||||
|
@ -140,7 +140,7 @@ class PCIDevice(qubes.devices.DeviceInfo):
|
|||||||
assert dev_match
|
assert dev_match
|
||||||
ident = '{bus}_{device}.{function}'.format(**dev_match.groupdict())
|
ident = '{bus}_{device}.{function}'.format(**dev_match.groupdict())
|
||||||
|
|
||||||
super(PCIDevice, self).__init__(backend_domain, ident, None)
|
super().__init__(backend_domain, ident, None)
|
||||||
|
|
||||||
# lazy loading
|
# lazy loading
|
||||||
self._description = None
|
self._description = None
|
||||||
@ -171,7 +171,7 @@ class PCIDevice(qubes.devices.DeviceInfo):
|
|||||||
|
|
||||||
class PCIDeviceExtension(qubes.ext.Extension):
|
class PCIDeviceExtension(qubes.ext.Extension):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(PCIDeviceExtension, self).__init__()
|
super().__init__()
|
||||||
# lazy load this
|
# lazy load this
|
||||||
self.pci_classes = {}
|
self.pci_classes = {}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class RuleChoice(RuleOption):
|
|||||||
# pylint: disable=abstract-method
|
# pylint: disable=abstract-method
|
||||||
def __init__(self, untrusted_value):
|
def __init__(self, untrusted_value):
|
||||||
# preliminary validation
|
# preliminary validation
|
||||||
super(RuleChoice, self).__init__(untrusted_value)
|
super().__init__(untrusted_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
|
||||||
@ -152,7 +152,7 @@ class DstHost(RuleOption):
|
|||||||
except socket.error:
|
except socket.error:
|
||||||
raise ValueError('Invalid IP address: ' + untrusted_host)
|
raise ValueError('Invalid IP address: ' + untrusted_host)
|
||||||
|
|
||||||
super(DstHost, self).__init__(value)
|
super().__init__(value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def rule(self):
|
def rule(self):
|
||||||
@ -173,7 +173,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 '-'.join(map(str, self.range)))
|
else '-'.join(map(str, self.range)))
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ class IcmpType(RuleOption):
|
|||||||
untrusted_value = int(untrusted_value)
|
untrusted_value = int(untrusted_value)
|
||||||
if untrusted_value < 0 or untrusted_value > 255:
|
if untrusted_value < 0 or untrusted_value > 255:
|
||||||
raise ValueError('ICMP type out of range')
|
raise ValueError('ICMP type out of range')
|
||||||
super(IcmpType, self).__init__(untrusted_value)
|
super().__init__(untrusted_value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def rule(self):
|
def rule(self):
|
||||||
@ -204,7 +204,7 @@ class SpecialTarget(RuleChoice):
|
|||||||
|
|
||||||
class Expire(RuleOption):
|
class Expire(RuleOption):
|
||||||
def __init__(self, untrusted_value):
|
def __init__(self, untrusted_value):
|
||||||
super(Expire, self).__init__(untrusted_value)
|
super().__init__(untrusted_value)
|
||||||
self.datetime = datetime.datetime.fromtimestamp(int(untrusted_value))
|
self.datetime = datetime.datetime.fromtimestamp(int(untrusted_value))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -248,7 +248,7 @@ class Rule(qubes.PropertyHolder):
|
|||||||
:param xml: XML element describing rule, or None
|
:param xml: XML element describing rule, or None
|
||||||
:param kwargs: rule elements
|
:param kwargs: rule elements
|
||||||
'''
|
'''
|
||||||
super(Rule, self).__init__(xml, **kwargs)
|
super().__init__(xml, **kwargs)
|
||||||
self.load_properties()
|
self.load_properties()
|
||||||
self.events_enabled = True
|
self.events_enabled = True
|
||||||
# validate dependencies
|
# validate dependencies
|
||||||
|
@ -52,7 +52,7 @@ class DBusHandler(logging.Handler):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(DBusHandler, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
self._notify_object = dbus.SessionBus().get_object(
|
self._notify_object = dbus.SessionBus().get_object(
|
||||||
'org.freedesktop.Notifications', '/org/freedesktop/Notifications')
|
'org.freedesktop.Notifications', '/org/freedesktop/Notifications')
|
||||||
|
@ -27,7 +27,7 @@ BUF_SIZE = 409600
|
|||||||
|
|
||||||
class TarSparseInfo(tarfile.TarInfo):
|
class TarSparseInfo(tarfile.TarInfo):
|
||||||
def __init__(self, name="", sparsemap=None):
|
def __init__(self, name="", sparsemap=None):
|
||||||
super(TarSparseInfo, self).__init__(name)
|
super().__init__(name)
|
||||||
if sparsemap is not None:
|
if sparsemap is not None:
|
||||||
self.type = tarfile.REGTYPE
|
self.type = tarfile.REGTYPE
|
||||||
self.sparsemap = sparsemap
|
self.sparsemap = sparsemap
|
||||||
@ -65,7 +65,7 @@ class TarSparseInfo(tarfile.TarInfo):
|
|||||||
def tobuf(self, format=tarfile.PAX_FORMAT, encoding=tarfile.ENCODING,
|
def tobuf(self, format=tarfile.PAX_FORMAT, encoding=tarfile.ENCODING,
|
||||||
errors="strict"):
|
errors="strict"):
|
||||||
# pylint: disable=redefined-builtin
|
# pylint: disable=redefined-builtin
|
||||||
header_buf = super(TarSparseInfo, self).tobuf(format, encoding, errors)
|
header_buf = super().tobuf(format, encoding, errors)
|
||||||
return header_buf + self.sparsemap_buf
|
return header_buf + self.sparsemap_buf
|
||||||
|
|
||||||
def get_sparse_map(input_file):
|
def get_sparse_map(input_file):
|
||||||
|
@ -58,7 +58,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):
|
||||||
@ -90,7 +90,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)
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ class HelpPropertiesAction(argparse.Action):
|
|||||||
default=argparse.SUPPRESS,
|
default=argparse.SUPPRESS,
|
||||||
help='list all available properties with short descriptions'
|
help='list all available properties with short descriptions'
|
||||||
' and exit'):
|
' and exit'):
|
||||||
super(HelpPropertiesAction, self).__init__(
|
super().__init__(
|
||||||
option_strings=option_strings,
|
option_strings=option_strings,
|
||||||
dest=dest,
|
dest=dest,
|
||||||
default=default,
|
default=default,
|
||||||
@ -165,7 +165,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):
|
||||||
@ -215,11 +215,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(
|
||||||
@ -235,7 +235,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):
|
||||||
@ -319,7 +319,7 @@ class QubesArgumentParser(argparse.ArgumentParser):
|
|||||||
def __init__(self, want_app=True, want_app_no_instance=False,
|
def __init__(self, want_app=True, want_app_no_instance=False,
|
||||||
want_force_root=False, vmname_nargs=None, **kwargs):
|
want_force_root=False, vmname_nargs=None, **kwargs):
|
||||||
|
|
||||||
super(QubesArgumentParser, self).__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
self._want_app = want_app
|
self._want_app = want_app
|
||||||
self._want_app_no_instance = want_app_no_instance
|
self._want_app_no_instance = want_app_no_instance
|
||||||
@ -352,7 +352,7 @@ class QubesArgumentParser(argparse.ArgumentParser):
|
|||||||
self.set_defaults(verbose=1, quiet=0)
|
self.set_defaults(verbose=1, quiet=0)
|
||||||
|
|
||||||
def parse_args(self, args=None, namespace=None):
|
def parse_args(self, args=None, namespace=None):
|
||||||
namespace = super(QubesArgumentParser, self).parse_args(args, namespace)
|
namespace = super().parse_args(args, namespace)
|
||||||
|
|
||||||
if self._want_app and not self._want_app_no_instance:
|
if self._want_app and not self._want_app_no_instance:
|
||||||
self.set_qubes_verbosity(namespace)
|
self.set_qubes_verbosity(namespace)
|
||||||
@ -437,8 +437,7 @@ class AliasedSubParsersAction(argparse._SubParsersAction):
|
|||||||
dest = name
|
dest = name
|
||||||
if aliases:
|
if aliases:
|
||||||
dest += ' (%s)' % ','.join(aliases)
|
dest += ' (%s)' % ','.join(aliases)
|
||||||
sup = super(AliasedSubParsersAction._AliasedPseudoAction, self)
|
super().__init__(option_strings=[], dest=dest, help=help)
|
||||||
sup.__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):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
@ -450,8 +449,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:
|
||||||
@ -497,7 +495,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',
|
||||||
|
@ -103,7 +103,7 @@ class Tags(set):
|
|||||||
# using official documentation, but use only our (overloaded) methods.
|
# using official documentation, but use only our (overloaded) methods.
|
||||||
#
|
#
|
||||||
def __init__(self, vm, seq=()):
|
def __init__(self, vm, seq=()):
|
||||||
super(Tags, self).__init__()
|
super().__init__()
|
||||||
self.vm = vm
|
self.vm = vm
|
||||||
self.update(seq)
|
self.update(seq)
|
||||||
|
|
||||||
@ -148,12 +148,12 @@ class Tags(set):
|
|||||||
raise ValueError('Invalid character in tag')
|
raise ValueError('Invalid character in tag')
|
||||||
if elem in self:
|
if elem in self:
|
||||||
return
|
return
|
||||||
super(Tags, self).add(elem)
|
super().add(elem)
|
||||||
self.vm.fire_event('domain-tag-add:' + elem, tag=elem)
|
self.vm.fire_event('domain-tag-add:' + elem, tag=elem)
|
||||||
|
|
||||||
def remove(self, elem):
|
def remove(self, elem):
|
||||||
'''Remove a tag'''
|
'''Remove a tag'''
|
||||||
super(Tags, self).remove(elem)
|
super().remove(elem)
|
||||||
self.vm.fire_event('domain-tag-delete:' + elem, tag=elem)
|
self.vm.fire_event('domain-tag-delete:' + elem, tag=elem)
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -212,7 +212,7 @@ class BaseVM(qubes.PropertyHolder):
|
|||||||
#: mother :py:class:`qubes.Qubes` object
|
#: mother :py:class:`qubes.Qubes` object
|
||||||
self.app = app
|
self.app = app
|
||||||
|
|
||||||
super(BaseVM, self).__init__(xml, **kwargs)
|
super().__init__(xml, **kwargs)
|
||||||
|
|
||||||
#: dictionary of features of this qube
|
#: dictionary of features of this qube
|
||||||
self.features = qubes.features.Features(self, features)
|
self.features = qubes.features.Features(self, features)
|
||||||
@ -454,7 +454,7 @@ class VMProperty(qubes.property):
|
|||||||
raise TypeError(
|
raise TypeError(
|
||||||
"'vmclass' should specify a subclass of qubes.vm.BaseVM")
|
"'vmclass' should specify a subclass of qubes.vm.BaseVM")
|
||||||
|
|
||||||
super(VMProperty, self).__init__(name,
|
super().__init__(name,
|
||||||
saver=(lambda self_, prop, value:
|
saver=(lambda self_, prop, value:
|
||||||
self._none_value if value is None else value.name),
|
self._none_value if value is None else value.name),
|
||||||
**kwargs)
|
**kwargs)
|
||||||
@ -470,7 +470,7 @@ class VMProperty(qubes.property):
|
|||||||
value = None
|
value = None
|
||||||
if value is None:
|
if value is None:
|
||||||
if self.allow_none:
|
if self.allow_none:
|
||||||
super(VMProperty, self).__set__(instance, value)
|
super().__set__(instance, value)
|
||||||
return
|
return
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
'Property {!r} does not allow setting to {!r}'.format(
|
'Property {!r} does not allow setting to {!r}'.format(
|
||||||
@ -489,7 +489,7 @@ class VMProperty(qubes.property):
|
|||||||
vm.__class__.__name__,
|
vm.__class__.__name__,
|
||||||
self.vmclass.__name__))
|
self.vmclass.__name__))
|
||||||
|
|
||||||
super(VMProperty, self).__set__(instance, vm)
|
super().__set__(instance, vm)
|
||||||
|
|
||||||
def sanitize(self, *, untrusted_newvalue):
|
def sanitize(self, *, untrusted_newvalue):
|
||||||
try:
|
try:
|
||||||
|
@ -92,7 +92,7 @@ class AppVM(qubes.vm.mix.dvmtemplate.DVMTemplateMixin,
|
|||||||
if 'vid' in self.volume_config[name]:
|
if 'vid' in self.volume_config[name]:
|
||||||
del self.volume_config[name]['vid']
|
del self.volume_config[name]['vid']
|
||||||
|
|
||||||
super(AppVM, self).__init__(app, xml, **kwargs)
|
super().__init__(app, xml, **kwargs)
|
||||||
|
|
||||||
@qubes.events.handler('domain-load')
|
@qubes.events.handler('domain-load')
|
||||||
def on_domain_loaded(self, event):
|
def on_domain_loaded(self, event):
|
||||||
|
@ -122,7 +122,7 @@ class DispVM(qubes.vm.qubesvm.QubesVM):
|
|||||||
and 'pool' in config:
|
and 'pool' in config:
|
||||||
self.volume_config[name]['pool'] = config['pool']
|
self.volume_config[name]['pool'] = config['pool']
|
||||||
|
|
||||||
super(DispVM, self).__init__(app, xml, *args, **kwargs)
|
super().__init__(app, xml, *args, **kwargs)
|
||||||
|
|
||||||
if xml is None:
|
if xml is None:
|
||||||
# by default inherit properties from the DispVM template
|
# by default inherit properties from the DispVM template
|
||||||
@ -229,7 +229,7 @@ class DispVM(qubes.vm.qubesvm.QubesVM):
|
|||||||
'template for DispVM ({}) needs to have '
|
'template for DispVM ({}) needs to have '
|
||||||
'template_for_dispvms=True'.format(self.template.name))
|
'template_for_dispvms=True'.format(self.template.name))
|
||||||
|
|
||||||
yield from super(DispVM, self).start(**kwargs)
|
yield from super().start(**kwargs)
|
||||||
except:
|
except:
|
||||||
# Cleanup also on failed startup
|
# Cleanup also on failed startup
|
||||||
yield from self._auto_cleanup()
|
yield from self._auto_cleanup()
|
||||||
|
@ -237,7 +237,7 @@ class NetVMMixin(qubes.events.Emitter):
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self._firewall = None
|
self._firewall = None
|
||||||
super(NetVMMixin, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
@qubes.events.handler('domain-load')
|
@qubes.events.handler('domain-load')
|
||||||
def on_domain_load_netvm_loop_check(self, event):
|
def on_domain_load_netvm_loop_check(self, event):
|
||||||
|
@ -864,7 +864,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
kwargs['virt_mode'] = 'pv'
|
kwargs['virt_mode'] = 'pv'
|
||||||
node_hvm.getparent().remove(node_hvm)
|
node_hvm.getparent().remove(node_hvm)
|
||||||
|
|
||||||
super(QubesVM, self).__init__(app, xml, **kwargs)
|
super().__init__(app, xml, **kwargs)
|
||||||
|
|
||||||
if volume_config is None:
|
if volume_config is None:
|
||||||
volume_config = {}
|
volume_config = {}
|
||||||
@ -950,7 +950,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
|
|
||||||
def __xml__(self):
|
def __xml__(self):
|
||||||
# pylint: disable=no-member
|
# pylint: disable=no-member
|
||||||
element = super(QubesVM, self).__xml__()
|
element = super().__xml__()
|
||||||
# pylint: enable=no-member
|
# pylint: enable=no-member
|
||||||
|
|
||||||
if hasattr(self, 'volumes'):
|
if hasattr(self, 'volumes'):
|
||||||
|
@ -59,4 +59,4 @@ class StandaloneVM(qubes.vm.mix.dvmtemplate.DVMTemplateMixin,
|
|||||||
'rw': False,
|
'rw': False,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super(StandaloneVM, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
@ -84,7 +84,7 @@ class TemplateVM(QubesVM):
|
|||||||
'rw': False
|
'rw': False
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super(TemplateVM, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
@qubes.events.handler('property-set:default_user',
|
@qubes.events.handler('property-set:default_user',
|
||||||
'property-set:kernel',
|
'property-set:kernel',
|
||||||
|
Loading…
Reference in New Issue
Block a user