From 6f2f57caead89f99c25a95d1d2b6039bb13956aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Sun, 16 Feb 2020 16:07:44 +0100 Subject: [PATCH] services: make PEP8 happier --- qubes/ext/services.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/qubes/ext/services.py b/qubes/ext/services.py index 52557d89..76c313d0 100644 --- a/qubes/ext/services.py +++ b/qubes/ext/services.py @@ -18,18 +18,20 @@ # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, see . -'''Extension responsible for qvm-service framework''' +"""Extension responsible for qvm-service framework""" import qubes.ext + class ServicesExtension(qubes.ext.Extension): - '''This extension export features with 'service.' prefix to QubesDB in + """This extension export features with 'service.' prefix to QubesDB in /qubes-service/ tree. - ''' + """ + # pylint: disable=no-self-use @qubes.ext.handler('domain-qdb-create') def on_domain_qdb_create(self, vm, event): - '''Actually export features''' + """Actually export features""" # pylint: disable=unused-argument for feature, value in vm.features.items(): if not feature.startswith('service.'): @@ -37,15 +39,15 @@ class ServicesExtension(qubes.ext.Extension): service = feature[len('service.'):] # forcefully convert to '0' or '1' vm.untrusted_qdb.write('/qubes-service/{}'.format(service), - str(int(bool(value)))) + str(int(bool(value)))) # always set meminfo-writer according to maxmem vm.untrusted_qdb.write('/qubes-service/meminfo-writer', - '1' if vm.maxmem > 0 else '0') + '1' if vm.maxmem > 0 else '0') @qubes.ext.handler('domain-feature-set:*') def on_domain_feature_set(self, vm, event, feature, value, oldvalue=None): - '''Update /qubes-service/ QubesDB tree in runtime''' + """Update /qubes-service/ QubesDB tree in runtime""" # pylint: disable=unused-argument # TODO: remove this compatibility hack in Qubes 4.1 @@ -68,11 +70,11 @@ class ServicesExtension(qubes.ext.Extension): service = feature[len('service.'):] # forcefully convert to '0' or '1' vm.untrusted_qdb.write('/qubes-service/{}'.format(service), - str(int(bool(value)))) + str(int(bool(value)))) @qubes.ext.handler('domain-feature-delete:*') def on_domain_feature_delete(self, vm, event, feature): - '''Update /qubes-service/ QubesDB tree in runtime''' + """Update /qubes-service/ QubesDB tree in runtime""" # pylint: disable=unused-argument if not vm.is_running(): return @@ -86,7 +88,7 @@ class ServicesExtension(qubes.ext.Extension): @qubes.ext.handler('domain-load') def on_domain_load(self, vm, event): - '''Migrate meminfo-writer service into maxmem''' + """Migrate meminfo-writer service into maxmem""" # pylint: disable=no-self-use,unused-argument if 'service.meminfo-writer' in vm.features: # if was set to false, force maxmem=0 @@ -97,7 +99,7 @@ class ServicesExtension(qubes.ext.Extension): @qubes.ext.handler('features-request') def supported_services(self, vm, event, untrusted_features): - '''Handle advertisement of supported services''' + """Handle advertisement of supported services""" # pylint: disable=no-self-use,unused-argument if getattr(vm, 'template', None):