[v1] dep/QMP: fix pylama errors
Checks
Commit Message
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
> -----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
@@ -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)