All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Update check-python-tox test for pylint 2.10
@ 2021-08-21 19:04 John Snow
  2021-08-21 19:04 ` [PATCH 1/1] python: Update " John Snow
  0 siblings, 1 reply; 2+ messages in thread
From: John Snow @ 2021-08-21 19:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Snow, G S Niteesh Babu, Eduardo Habkost, Cleber Rosa

The 'check-python-tox' CI test will probably start showing warnings
without this. This can go into the next release, just ignore the CI
warning until the tree opens.

John Snow (1):
  python: Update for pylint 2.10

 python/qemu/machine/machine.py | 6 ++++--
 python/setup.cfg               | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

-- 
2.31.1




^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] python: Update for pylint 2.10
  2021-08-21 19:04 [PATCH 0/1] Update check-python-tox test for pylint 2.10 John Snow
@ 2021-08-21 19:04 ` John Snow
  0 siblings, 0 replies; 2+ messages in thread
From: John Snow @ 2021-08-21 19:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Snow, G S Niteesh Babu, Eduardo Habkost, Cleber Rosa

A few new annoyances. Of note is the new warning for an unspecified
encoding when opening a text file, which actually does indicate a
potentially real problem; see
https://www.python.org/dev/peps/pep-0597/#motivation

I was under the impression that open would try to figure out the
encoding of a file for you -- apparently this is completely false. It
uses the platform's preferred encoding, whatever that may be.

What we ought to use here, I believe, is sys.stderr.encoding.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 python/qemu/machine/machine.py | 6 ++++--
 python/setup.cfg               | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index 971ed7e8c6..1f47fc5a2b 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -25,6 +25,7 @@
 import signal
 import socket
 import subprocess
+import sys
 import tempfile
 from types import TracebackType
 from typing import (
@@ -284,7 +285,8 @@ def get_pid(self) -> Optional[int]:
 
     def _load_io_log(self) -> None:
         if self._qemu_log_path is not None:
-            with open(self._qemu_log_path, "r") as iolog:
+            with open(self._qemu_log_path, "r",
+                      encoding=sys.stdout.encoding) as iolog:
                 self._iolog = iolog.read()
 
     @property
@@ -565,7 +567,7 @@ def _qmp(self) -> QEMUMonitorProtocol:
 
     @classmethod
     def _qmp_args(cls, _conv_keys: bool = True, **args: Any) -> Dict[str, Any]:
-        qmp_args = dict()
+        qmp_args = {}
         for key, value in args.items():
             if _conv_keys:
                 qmp_args[key.replace('_', '-')] = value
diff --git a/python/setup.cfg b/python/setup.cfg
index 14bab90288..f220419755 100644
--- a/python/setup.cfg
+++ b/python/setup.cfg
@@ -104,6 +104,7 @@ good-names=i,
 [pylint.similarities]
 # Ignore imports when computing similarities.
 ignore-imports=yes
+ignore-signatures=yes
 
 [isort]
 force_grid_wrap=4
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-21 19:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-21 19:04 [PATCH 0/1] Update check-python-tox test for pylint 2.10 John Snow
2021-08-21 19:04 ` [PATCH 1/1] python: Update " John Snow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.