Make pylint ♥
This commit is contained in:
parent
5bc7a8f9e3
commit
79407a8717
@ -221,7 +221,8 @@ class Core2Qubes(qubes.Qubes):
|
||||
for pcidev in pcidevs:
|
||||
try:
|
||||
dev = self.domains[0].devices['pci'][pcidev]
|
||||
assignment = qubes.devices.DeviceAssignment(backend_domain=dev.backend_domain, ident=dev.ident)
|
||||
assignment = qubes.devices.DeviceAssignment(
|
||||
backend_domain=dev.backend_domain, ident=dev.ident)
|
||||
vm.devices["pci"].attach(assignment)
|
||||
except qubes.exc.QubesException as e:
|
||||
self.log.error("VM {}: {}".format(vm.name, str(e)))
|
||||
|
@ -292,7 +292,7 @@ class DeviceInfo(object):
|
||||
''' Holds all information about a device '''
|
||||
# pylint: disable=too-few-public-methods
|
||||
def __init__(self, backend_domain, ident, description=None,
|
||||
frontend_domain=None, options = None, **kwargs):
|
||||
frontend_domain=None, options=None, **kwargs):
|
||||
#: domain providing this device
|
||||
self.backend_domain = backend_domain
|
||||
#: device identifier (unique for given domain and device type)
|
||||
@ -308,6 +308,7 @@ class DeviceInfo(object):
|
||||
self.frontend_domain = frontend_domain
|
||||
except AttributeError:
|
||||
pass
|
||||
self.options = options or dict()
|
||||
self.data = kwargs
|
||||
|
||||
if hasattr(self, 'regex'):
|
||||
|
@ -19,6 +19,8 @@
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
''' Qubes PCI Extensions '''
|
||||
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
@ -34,7 +36,7 @@ pci_classes = None
|
||||
|
||||
|
||||
def load_pci_classes():
|
||||
# List of known device classes, subclasses and programming interfaces
|
||||
''' List of known device classes, subclasses and programming interfaces. '''
|
||||
# Syntax:
|
||||
# C class class_name
|
||||
# subclass subclass_name <-- single tab
|
||||
|
@ -93,7 +93,7 @@ class Element(object):
|
||||
for xml in self.xml.xpath('''./rng:attribute |
|
||||
./rng:optional/rng:attribute |
|
||||
./rng:choice/rng:attribute''', namespaces=self.nsmap):
|
||||
required = xml.getparent() == self.xml and 'yes' or 'no'
|
||||
required = 'yes' if xml.getparent() == self.xml else 'no'
|
||||
yield (xml, required)
|
||||
|
||||
|
||||
@ -212,6 +212,7 @@ Quick example, worth thousands lines of specification:
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# pylint: disable=no-value-for-parameter
|
||||
main(*sys.argv[1:])
|
||||
|
||||
# vim: ts=4 sw=4 et
|
||||
|
@ -26,6 +26,7 @@ import qubes.devices
|
||||
import qubes.tests
|
||||
|
||||
class TestDevice(qubes.devices.DeviceInfo):
|
||||
# pylint: disable=too-few-public-methods
|
||||
pass
|
||||
|
||||
|
||||
@ -35,6 +36,7 @@ class TestVMCollection(dict):
|
||||
|
||||
|
||||
class TestApp(object):
|
||||
# pylint: disable=too-few-public-methods
|
||||
def __init__(self):
|
||||
self.domains = TestVMCollection()
|
||||
|
||||
|
@ -352,8 +352,8 @@ class QubesArgumentParser(argparse.ArgumentParser):
|
||||
|
||||
self.set_defaults(verbose=1, quiet=0)
|
||||
|
||||
def parse_args(self, *args, **kwargs):
|
||||
namespace = super(QubesArgumentParser, self).parse_args(*args, **kwargs)
|
||||
def parse_args(self, args=None, namespace=None):
|
||||
namespace = super(QubesArgumentParser, self).parse_args(args, namespace)
|
||||
|
||||
if self._want_app and not self._want_app_no_instance:
|
||||
self.set_qubes_verbosity(namespace)
|
||||
@ -441,9 +441,8 @@ class AliasedSubParsersAction(argparse._SubParsersAction):
|
||||
sup = super(AliasedSubParsersAction._AliasedPseudoAction, self)
|
||||
sup.__init__(option_strings=[], dest=dest, help=help)
|
||||
|
||||
def __call__(self, **kwargs):
|
||||
super(AliasedSubParsersAction._AliasedPseudoAction, self).__call__(
|
||||
**kwargs)
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
raise NotImplementedError
|
||||
|
||||
def add_parser(self, name, **kwargs):
|
||||
if 'aliases' in kwargs:
|
||||
|
@ -38,7 +38,7 @@ class QubesDaemonProtocol(asyncio.Protocol):
|
||||
print('connection_lost(exc={!r})'.format(exc))
|
||||
self.untrusted_buffer.close()
|
||||
|
||||
def data_received(self, untrusted_data):
|
||||
def data_received(self, untrusted_data): # pylint: disable=arguments-differ
|
||||
print('data_received(untrusted_data={!r})'.format(untrusted_data))
|
||||
if self.len_untrusted_buffer + len(untrusted_data) > self.buffer_size:
|
||||
self.app.log.warning('request too long')
|
||||
|
@ -204,7 +204,6 @@ def main(args=None):
|
||||
"and (if encrypted) decrypt the backup: ")
|
||||
|
||||
encoding = sys.stdin.encoding or locale.getpreferredencoding()
|
||||
# pylint: disable=redefined-variable-type
|
||||
passphrase = passphrase.decode(encoding)
|
||||
|
||||
args.app.log.info("Checking backup content...")
|
||||
|
@ -115,8 +115,7 @@ class AdminVM(qubes.vm.qubesvm.QubesVM):
|
||||
try:
|
||||
return self.app.vmm.libvirt_conn.getInfo()[1]
|
||||
except libvirt.libvirtError as e:
|
||||
self.log.warning(
|
||||
'Failed to get memory limit for dom0: {}'.format(e))
|
||||
self.log.warning('Failed to get memory limit for dom0: %s', e)
|
||||
return 4096
|
||||
|
||||
def verify_files(self):
|
||||
@ -127,7 +126,8 @@ class AdminVM(qubes.vm.qubesvm.QubesVM):
|
||||
''' # pylint: disable=no-self-use
|
||||
return True
|
||||
|
||||
def start(self, **kwargs):
|
||||
def start(self, preparing_dvm=False, start_guid=True, notify_function=None,
|
||||
mem_required=None):
|
||||
'''Always raises an exception.
|
||||
|
||||
.. seealso:
|
||||
|
@ -429,6 +429,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
# CORE2: swallowed uses_default_kernelopts
|
||||
kernelopts = qubes.property('kernelopts', type=str, load_stage=4,
|
||||
default=(lambda self: qubes.config.defaults['kernelopts_pcidevs']
|
||||
# pylint: disable=no-member
|
||||
if list(self.devices['pci'].persistent())
|
||||
else self.template.kernelopts if hasattr(self, 'template')
|
||||
else qubes.config.defaults['kernelopts']),
|
||||
@ -443,6 +444,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
# XXX shouldn't this go to standalone VM and TemplateVM, and leave here
|
||||
# only plain property?
|
||||
default_user = qubes.property('default_user', type=str,
|
||||
# pylint: disable=no-member
|
||||
default=(lambda self: self.template.default_user
|
||||
if hasattr(self, 'template') else 'user'),
|
||||
setter=_setter_default_user,
|
||||
|
Loading…
Reference in New Issue
Block a user