From nobody Fri May 3 15:06:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1629819429557996.5828641931746; Tue, 24 Aug 2021 08:37:09 -0700 (PDT) Received: from localhost ([::1]:48730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIYU8-0008HI-FZ for importer@patchew.org; Tue, 24 Aug 2021 11:37:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIYSs-0005t9-S2 for qemu-devel@nongnu.org; Tue, 24 Aug 2021 11:35:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:36089) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIYSr-0004CO-99 for qemu-devel@nongnu.org; Tue, 24 Aug 2021 11:35:50 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-171-5u42YjvENJeV3WHg09IURA-1; Tue, 24 Aug 2021 11:35:45 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5C270760C4; Tue, 24 Aug 2021 15:35:44 +0000 (UTC) Received: from localhost (unknown [10.39.192.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F36C55D9C6; Tue, 24 Aug 2021 15:35:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629819348; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PdkYt9HKesmkc3YpAwfw+wua9WnAJLmtEvhQeo4CKbE=; b=Mp6GtoYrbQT36fcPxvlUTQNDReOtHXLBltCU9MqAHxxTn/ktngTnSOzk9em4QMIPogo2eu 2D2SkhfK/AkQIQosL0NqhLqSSBeX5h67rUWmMbgn+IfMDYcHAVVGc2BOYcdOzxwho9jxpm WSS84xfWsTLWQw8JIn52KlO1hcbdlKE= X-MC-Unique: 5u42YjvENJeV3WHg09IURA-1 From: Hanna Reitz To: qemu-block@nongnu.org Subject: [PATCH 1/2] iotests: Fix unspecified-encoding pylint warnings Date: Tue, 24 Aug 2021 17:35:39 +0200 Message-Id: <20210824153540.177128-2-hreitz@redhat.com> In-Reply-To: <20210824153540.177128-1-hreitz@redhat.com> References: <20210824153540.177128-1-hreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.747, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Hanna Reitz , John Snow , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1629819431026100003 Content-Type: text/plain; charset="utf-8" As of recently, pylint complains when `open()` calls are missing an `encoding=3D` specified. Everything we have should be UTF-8 (and in fact, everything should be UTF-8, period (exceptions apply)), so use that. Signed-off-by: Hanna Reitz Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/qemu-iotests/297 | 2 +- tests/qemu-iotests/iotests.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 index 433b732336..0a49953d27 100755 --- a/tests/qemu-iotests/297 +++ b/tests/qemu-iotests/297 @@ -46,7 +46,7 @@ def is_python_file(filename): if filename.endswith('.py'): return True =20 - with open(filename) as f: + with open(filename, encoding=3D'utf-8') as f: try: first_line =3D f.readline() return re.match('^#!.*python', first_line) is not None diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 4c8971d946..c05c16494b 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -610,7 +610,7 @@ def _post_shutdown(self) -> None: return valgrind_filename =3D f"{test_dir}/{self._popen.pid}.valgrind" if self.exitcode() =3D=3D 99: - with open(valgrind_filename) as f: + with open(valgrind_filename, encoding=3D'utf-8') as f: print(f.read()) else: os.remove(valgrind_filename) @@ -1120,7 +1120,8 @@ def notrun(reason): # Each test in qemu-iotests has a number ("seq") seq =3D os.path.basename(sys.argv[0]) =20 - with open('%s/%s.notrun' % (output_dir, seq), 'w') as outfile: + with open('%s/%s.notrun' % (output_dir, seq), 'w', encoding=3D'utf-8')= \ + as outfile: outfile.write(reason + '\n') logger.warning("%s not run: %s", seq, reason) sys.exit(0) @@ -1134,7 +1135,8 @@ def case_notrun(reason): # Each test in qemu-iotests has a number ("seq") seq =3D os.path.basename(sys.argv[0]) =20 - with open('%s/%s.casenotrun' % (output_dir, seq), 'a') as outfile: + with open('%s/%s.casenotrun' % (output_dir, seq), 'a', encoding=3D'utf= -8') \ + as outfile: outfile.write(' [case not run] ' + reason + '\n') =20 def _verify_image_format(supported_fmts: Sequence[str] =3D (), --=20 2.31.1 From nobody Fri May 3 15:06:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1629819428463372.6357378440541; Tue, 24 Aug 2021 08:37:08 -0700 (PDT) Received: from localhost ([::1]:48658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIYU7-0008Dz-Co for importer@patchew.org; Tue, 24 Aug 2021 11:37:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIYSt-0005tl-Lw for qemu-devel@nongnu.org; Tue, 24 Aug 2021 11:35:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20953) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIYSr-0004CV-Cz for qemu-devel@nongnu.org; Tue, 24 Aug 2021 11:35:51 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-511-LAvK8D60OyOpXbVPAaW1cQ-1; Tue, 24 Aug 2021 11:35:47 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62BAA801E72; Tue, 24 Aug 2021 15:35:46 +0000 (UTC) Received: from localhost (unknown [10.39.192.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0CF9E9473; Tue, 24 Aug 2021 15:35:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629819348; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xz36D1Kr1yct19Nmze++VflIcjIM8Jz9HkcE/Of2Q7o=; b=hOG5oDdl8qzZVyZnPkC5kbkPP1F8ltuwdbj/WyGu6YJscqDJQqay6ZTvOPUpAidgWM3Clq x/LOVKOm0fR25sDbOCsnExf8a61m12gqWZlI1bj4rXnq3o80HW6ET7YGE8ELieJ7zmkmAA kdP8ovZZRzC6O4+OQI79Faq7jJlSjV8= X-MC-Unique: LAvK8D60OyOpXbVPAaW1cQ-1 From: Hanna Reitz To: qemu-block@nongnu.org Subject: [PATCH 2/2] iotests: Fix use-{list,dict}-literal warnings Date: Tue, 24 Aug 2021 17:35:40 +0200 Message-Id: <20210824153540.177128-3-hreitz@redhat.com> In-Reply-To: <20210824153540.177128-1-hreitz@redhat.com> References: <20210824153540.177128-1-hreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.747, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Hanna Reitz , John Snow , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1629819428922100001 Content-Type: text/plain; charset="utf-8" pylint proposes using `[]` instead of `list()` and `{}` instead of `dict()`, because it is faster. That seems simple enough, so heed its advice. Signed-off-by: Hanna Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index c05c16494b..8b44e6c437 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -702,7 +702,7 @@ def hmp_qemu_io(self, drive: str, cmd: str, =20 def flatten_qmp_object(self, obj, output=3DNone, basestr=3D''): if output is None: - output =3D dict() + output =3D {} if isinstance(obj, list): for i, item in enumerate(obj): self.flatten_qmp_object(item, output, basestr + str(i) + '= .') @@ -715,7 +715,7 @@ def flatten_qmp_object(self, obj, output=3DNone, basest= r=3D''): =20 def qmp_to_opts(self, obj): obj =3D self.flatten_qmp_object(obj) - output_list =3D list() + output_list =3D [] for key in obj: output_list +=3D [key + '=3D' + obj[key]] return ','.join(output_list) --=20 2.31.1