From nobody Mon Oct 27 13:56:30 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1761238850; cv=none; d=zohomail.com; s=zohoarc; b=eWt9ih3mqRy4iIpcApaeGcHTZl94p1B1Ik/Qk4eDFTl++nWNxk6zPRaMFig/t8cymfaBJ1dyoJiT6KHnIcTzszE49Ry0rRUZYmBF0y2aEPC5G/mYUklmpqiIE8tkVqj7Fs/OKeG2ySbZqNkkUL6cECzni4s7pD1iFpizYk9YVcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761238850; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2jgKdiMkswKfHdeVn84I4j71Yy3RosUUcW+e/xTiSbM=; b=eHPhllMv7DutFZbs0VsBL02p8eAmg4kcIfBOyvH6bfWRGcr6wIn9Mr0k/s9JMqPc0a0J2dgwkLHqeWWZgNNIX/Lk3vRSqbpqCmH9lOqlnJr7FoJR8+Uwr2yx62K/3HhhveKKiMbhDnwpHCNbCk9P+0IW57nPFxq3PHOuLY+QHPM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761238850061425.1325044196427; Thu, 23 Oct 2025 10:00:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vByfZ-0004qR-Ma; Thu, 23 Oct 2025 13:00:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vByfW-0004lk-0B for qemu-devel@nongnu.org; Thu, 23 Oct 2025 13:00:06 -0400 Received: from forwardcorp1d.mail.yandex.net ([2a02:6b8:c41:1300:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vByfS-0005iC-VZ for qemu-devel@nongnu.org; Thu, 23 Oct 2025 13:00:05 -0400 Received: from mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net [IPv6:2a02:6b8:c42:65a0:0:640:e1de:0]) by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id 0A46F8086B; Thu, 23 Oct 2025 20:00:01 +0300 (MSK) Received: from davydov-max-lin.yandex.net (unknown [2a02:6bf:8011:f00:ef9:2188:6644:f7b6]) by mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id 8xbwbU0ImGk0-Jw1D5jFi; Thu, 23 Oct 2025 20:00:00 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1761238800; bh=2jgKdiMkswKfHdeVn84I4j71Yy3RosUUcW+e/xTiSbM=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=B8rEgs22F3d80qr6IzsN6kFdJ2xrvE2/6GqPh7W8yukM5Fs5zBWAyIZ5F94vhJdvO yODavFL/+3UVlMcCxU1QNsL3NCwBAi12JhPlcm2X7G9ecidoNFq9/hWZQRzhjRF3sd tLEW/M76sLfOzHrNGePLBvWw4BQgo8uc4RiAlil8= Authentication-Results: mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Maksim Davydov To: qemu-devel@nongnu.org Cc: crosa@redhat.com, jsnow@redhat.com, davydov-max@yandex-team.ru, philmd@linaro.org, vsementsov@yandex-team.ru Subject: [PATCH 2/2] scripts/compare-mt: stop using global variables Date: Thu, 23 Oct 2025 19:58:46 +0300 Message-Id: <20251023165846.326295-3-davydov-max@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251023165846.326295-1-davydov-max@yandex-team.ru> References: <20251023165846.326295-1-davydov-max@yandex-team.ru> MIME-Version: 1.0 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=2a02:6b8:c41:1300:1:45:d181:df01; envelope-from=davydov-max@yandex-team.ru; helo=forwardcorp1d.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1761238853367158500 Content-Type: text/plain; charset="utf-8" All variables inside the main if-structure are global that can be confusing or be the reason of an issue. So, all code inside this structure was moved to the separate function to detect all usages of these global variables. All these usages were deleted. Signed-off-by: Maksim Davydov Reviewed-by: Vladimir Sementsov-Ogievskiy --- scripts/compare-machine-types.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/scripts/compare-machine-types.py b/scripts/compare-machine-typ= es.py index dba9e03548..e6fcea22e1 100755 --- a/scripts/compare-machine-types.py +++ b/scripts/compare-machine-types.py @@ -264,7 +264,6 @@ def __init__(self, vm: QEMUMachine, req_mt: List[str], all_mt: bool) -> None: self._vm =3D vm self._binary =3D vm.binary - self._qemu_args =3D args.qemu_args.split(' ') =20 self._qemu_drivers =3D VMPropertyGetter(vm) self.req_mt =3D get_req_mt(self._qemu_drivers, vm, req_mt, all_mt) @@ -482,17 +481,17 @@ def fill_prop_table(configs: List[Configuration], =20 def print_table(table: pd.DataFrame, table_format: str) -> None: if table_format =3D=3D 'json': - print(comp_table.to_json()) + print(table.to_json()) elif table_format =3D=3D 'csv': - print(comp_table.to_csv()) + print(table.to_csv()) else: - print(comp_table.to_markdown(index=3DFalse, stralign=3D'center', - colalign=3D('center',), headers=3D'ke= ys', - tablefmt=3D'fancy_grid', - disable_numparse=3DTrue)) + print(table.to_markdown(index=3DFalse, stralign=3D'center', + colalign=3D('center',), headers=3D'keys', + tablefmt=3D'fancy_grid', + disable_numparse=3DTrue)) =20 =20 -if __name__ =3D=3D '__main__': +def main() -> None: args =3D parse_args() with ExitStack() as stack: vms =3D [stack.enter_context(QEMUMachine(binary=3Dbinary, qmp_time= r=3D15, @@ -506,3 +505,7 @@ def print_table(table: pd.DataFrame, table_format: str)= -> None: comp_table =3D fill_prop_table(configurations, args.raw) if not comp_table.empty: print_table(comp_table, args.format) + + +if __name__ =3D=3D '__main__': + main() --=20 2.34.1