python: linter changes for pylint 3.x
authorJohn Snow <jsnow@redhat.com>
Wed, 26 Jun 2024 23:22:27 +0000 (19:22 -0400)
committerJohn Snow <jsnow@redhat.com>
Fri, 12 Jul 2024 20:36:20 +0000 (16:36 -0400)
New bleeding edge versions, new nits to iron out. This addresses the
'check-python-tox' optional GitLab test, while 'check-python-minreqs'
saw no regressions, since it's frozen on an older version of pylint.

Fixes:
qemu/machine/machine.py:345:52: E0606: Possibly using variable 'sock' before assignment (possibly-used-before-assignment)
qemu/utils/qemu_ga_client.py:168:4: R1711: Useless return at end of function or method (useless-return)

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20240626232230.408004-2-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
python/qemu/machine/machine.py
python/qemu/utils/qemu_ga_client.py

index f648f6af451bdf197e03b00ad016f7b532f5ec98..ebb58d5b68c13cd94276a23ba711b39a2a9a6562 100644 (file)
@@ -335,6 +335,7 @@ class QEMUMachine:
 
     def _pre_launch(self) -> None:
         if self._qmp_set:
+            sock = None
             if self._monitor_address is None:
                 self._sock_pair = socket.socketpair()
                 os.set_inheritable(self._sock_pair[0].fileno(), True)
index 9a665e6e99033d4ab956865e8462991269f5d293..cf0fcf9a8bb36d852262d80a7c8dc01affa2b125 100644 (file)
@@ -174,7 +174,7 @@ class QemuGuestAgentClient:
             # On error exception will raise
         except asyncio.TimeoutError:
             # On success command will timed out
-            return
+            pass
 
     def shutdown(self, mode: str = 'powerdown') -> None:
         if mode not in ['powerdown', 'halt', 'reboot']: