From 2d736f5aa876f16984b133a059ceeeca7f3cda09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 5 Oct 2019 21:57:48 +0200 Subject: [PATCH] Make pylint happy --- .pylintrc | 1 + qubesadmin/backup/restore.py | 6 ++---- qubesadmin/base.py | 2 +- qubesadmin/events/__init__.py | 3 +-- qubesadmin/tools/qvm_backup_restore.py | 2 +- qubesadmin/tools/qvm_ls.py | 3 ++- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.pylintrc b/.pylintrc index 669487d..5e1d5fc 100644 --- a/.pylintrc +++ b/.pylintrc @@ -13,6 +13,7 @@ extension-pkg-whitelist=lxml.etree disable= bad-continuation, raising-format-tuple, + import-outside-toplevel, inconsistent-return-statements, duplicate-code, fixme, diff --git a/qubesadmin/backup/restore.py b/qubesadmin/backup/restore.py index 49d6eb0..4a7c1ab 100644 --- a/qubesadmin/backup/restore.py +++ b/qubesadmin/backup/restore.py @@ -555,10 +555,8 @@ class ExtractWorker3(Process): file_size = int(match.groups()[0]) size_func(file_size) break - else: - self.log.warning( - 'unexpected tar output (no file size report): %s', - line) + self.log.warning( + 'unexpected tar output (no file size report): %s', line) return data_func(tar2_process.stdout) diff --git a/qubesadmin/base.py b/qubesadmin/base.py index 6b36da9..a674699 100644 --- a/qubesadmin/base.py +++ b/qubesadmin/base.py @@ -359,7 +359,7 @@ class WrapperObjectsCollection(object): def keys(self): '''Get list of names.''' self.refresh_cache() - return [key for key in self._names_list] + return list(self._names_list) def items(self): '''Get list of (key, value) pairs''' diff --git a/qubesadmin/events/__init__.py b/qubesadmin/events/__init__.py index a8d63bf..647c927 100644 --- a/qubesadmin/events/__init__.py +++ b/qubesadmin/events/__init__.py @@ -176,8 +176,7 @@ class EventsDispatcher(object): except asyncio.IncompleteReadError as err: if err.partial == b'': break - else: - raise + raise if not subject: subject = None diff --git a/qubesadmin/tools/qvm_backup_restore.py b/qubesadmin/tools/qvm_backup_restore.py index d09df4d..61eaada 100644 --- a/qubesadmin/tools/qvm_backup_restore.py +++ b/qubesadmin/tools/qvm_backup_restore.py @@ -256,7 +256,7 @@ def main(args=None, app=None): if args.pass_file is None: if input("Do you want to proceed? [y/N] ").upper() != "Y": - exit(0) + sys.exit(0) try: backup.restore_do(restore_info) diff --git a/qubesadmin/tools/qvm_ls.py b/qubesadmin/tools/qvm_ls.py index f739fa7..8d1a308 100644 --- a/qubesadmin/tools/qvm_ls.py +++ b/qubesadmin/tools/qvm_ls.py @@ -634,7 +634,8 @@ def main(args=None, app=None): if set(dom.tags).intersection(set(args.tags))] pwrstates = {state: getattr(args, state) for state in DOMAIN_POWER_STATES} - domains = filter(lambda x: matches_power_states(x, **pwrstates), domains) + domains = [d for d in domains + if matches_power_states(d, **pwrstates)] table = Table(domains, columns, spinner, args.raw_data) table.write_table(sys.stdout)