diff mbox series

[v1] dep/QMP: fix pylama errors

Message ID 1638793747-3143-1-git-send-email-juraj.linkes@pantheon.tech (mailing list archive)
State Accepted
Headers show
Series [v1] dep/QMP: fix pylama errors | expand

Checks

Context Check Description
ci/Intel-dts-suite-test fail Testing issues

Commit Message

Juraj Linkeš Dec. 6, 2021, 12:29 p.m. UTC
Pylama found the following errors:
dep/QMP/qmp.py:114: [E] E1136 Value 'err' is unsubscriptable [pylint]
dep/QMP/qmp.py:153: [E] E1136 Value 'err' is unsubscriptable [pylint]
dep/QMP/qmp.py:173: [E] E1136 Value 'err' is unsubscriptable [pylint]
- replace the deprecated Exception and fix errno

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
Lijuan, please add additional people to review if needed.
---
 dep/QMP/qmp.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Tu, Lijuan Jan. 14, 2022, 8:10 a.m. UTC | #1
> -----Original Message-----
> From: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Sent: 2021年12月6日 20:29
> To: Tu, Lijuan <lijuan.tu@intel.com>; ohilyard@iol.unh.edu
> Cc: dts@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech>
> Subject: [PATCH v1] dep/QMP: fix pylama errors
> 
> Pylama found the following errors:
> dep/QMP/qmp.py:114: [E] E1136 Value 'err' is unsubscriptable [pylint]
> dep/QMP/qmp.py:153: [E] E1136 Value 'err' is unsubscriptable [pylint]
> dep/QMP/qmp.py:173: [E] E1136 Value 'err' is unsubscriptable [pylint]
> - replace the deprecated Exception and fix errno
> 
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>

Applied
diff mbox series

Patch

diff --git a/dep/QMP/qmp.py b/dep/QMP/qmp.py
index 3fd5f1b2..63d3117d 100755
--- a/dep/QMP/qmp.py
+++ b/dep/QMP/qmp.py
@@ -1,5 +1,5 @@ 
 # QEMU Monitor Protocol Python class
-# 
+#
 # Copyright (C) 2009, 2010 Red Hat Inc.
 #
 # Authors:
@@ -110,8 +110,8 @@  class QEMUMonitorProtocol:
         """
         try:
             self.__sock.sendall(str.encode(json.dumps(qmp_cmd)))
-        except socket.error as err:
-            if err[0] == errno.EPIPE:
+        except OSError as err:
+            if err.errno == errno.EPIPE:
                 return
             raise socket.error(err)
         return self.__json_read()
@@ -149,8 +149,8 @@  class QEMUMonitorProtocol:
         self.__sock.setblocking(0)
         try:
             self.__json_read()
-        except socket.error as err:
-            if err[0] == errno.EAGAIN:
+        except OSError as err:
+            if err.errno == errno.EAGAIN:
                 # No data available
                 pass
         self.__sock.setblocking(1)
@@ -169,8 +169,8 @@  class QEMUMonitorProtocol:
         self.__sock.setblocking(0)
         try:
             self.__json_read()
-        except socket.error as err:
-            if err[0] == errno.EAGAIN:
+        except OSError as err:
+            if err.errno == errno.EAGAIN:
                 # No data available
                 pass
         self.__sock.setblocking(1)