From patchwork Thu Jun 1 20:27:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 688131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AB95C7EE23 for ; Thu, 1 Jun 2023 20:28:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232321AbjFAU2o (ORCPT ); Thu, 1 Jun 2023 16:28:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbjFAU2n (ORCPT ); Thu, 1 Jun 2023 16:28:43 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BA76128 for ; Thu, 1 Jun 2023 13:27:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685651276; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IH1I3acNZ/TnBBcb1Ef9K+M/EqDg4dnqPx6vrGJKG/w=; b=W44OFfmPdp6wFToCm+rkQJhuDH5UBmNgAzgho2AjXHwkQLS5jo1ERvCfgxWIC8ZlGIrrvs ilAsv+7d/e66sByirvsxVogOuDrT6TUxKhW4qnEzUjqjivj9rm/WFOoP+sh2RQXVbpuV9j VGbi6brdJ5ZsBVrA8VdR83Nn8vJ3wzk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-664-QgcG9CjONH6XhNhX9sq9pw-1; Thu, 01 Jun 2023 16:27:55 -0400 X-MC-Unique: QgcG9CjONH6XhNhX9sq9pw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2418D1C05152 for ; Thu, 1 Jun 2023 20:27:55 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 064F1C154D9; Thu, 1 Jun 2023 20:27:54 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH v2 01/10] rteval: Use f-strings in rtevalclient.py Date: Thu, 1 Jun 2023 16:27:27 -0400 Message-Id: <20230601202734.813515-2-ashelat@redhat.com> In-Reply-To: <20230601202734.813515-1-ashelat@redhat.com> References: <20230601202734.813515-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Use f-strings in rtevalclient.py Signed-off-by: Anubhav Shelat Signed-off-by: John Kacur --- rteval/rtevalclient.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rteval/rtevalclient.py b/rteval/rtevalclient.py index 26c953005326..7ff7d2700cfc 100644 --- a/rteval/rtevalclient.py +++ b/rteval/rtevalclient.py @@ -61,7 +61,7 @@ class rtevalclient: cmpr = compr.compress(fbuf.getvalue()) data = base64.b64encode(cmpr + compr.flush()) ret = self.srv.SendReport(self.hostname, data) - print("rtevalclient::SendReport() - Sent %i bytes (XML document length: %i bytes, compression ratio: %.02f%%)" % (len(data), doclen, (1-(float(len(data)) / float(doclen)))*100 )) + print(f"rtevalclient::SendReport() - Sent {len(data)} bytes (XML document length: {doclen} bytes, compression ratio: {(1-(float(len(data)) / float(doclen)))*100}:.2f)") return ret def SendDataAsFile(self, fname, data, decompr = False): From patchwork Thu Jun 1 20:27:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 688130 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9B26C77B7E for ; Thu, 1 Jun 2023 20:28:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229741AbjFAU2u (ORCPT ); Thu, 1 Jun 2023 16:28:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbjFAU2s (ORCPT ); Thu, 1 Jun 2023 16:28:48 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A13DB18D for ; Thu, 1 Jun 2023 13:28:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685651280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u5jojIhgYXpojgeDOl/uB2Vg72JmUsl9GK9YBHbiJRw=; b=YgOg1RmRm6dZiI9Zkfuo3hoU1lk+tmK0F4bB/W7pD6vXOjzlCo5dHkCHSt6xGGXatE4wAb CKPBs1DA5sGWubsi2m7xyGjFpS9jykC6mmPh07dne/3Q0hdn/tUfK+uNxAc+UZm+a6+Iug 3Mwk3XwHQ9IAnfrGsQ+bMuy3uGxBER8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-461-WkBFrDahP5SFTFwe8KyOBg-1; Thu, 01 Jun 2023 16:27:59 -0400 X-MC-Unique: WkBFrDahP5SFTFwe8KyOBg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 53BDB101A53A for ; Thu, 1 Jun 2023 20:27:59 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31348C154D9; Thu, 1 Jun 2023 20:27:59 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH v2 02/10] rteval: Use f-strings in rtevalConfig Date: Thu, 1 Jun 2023 16:27:28 -0400 Message-Id: <20230601202734.813515-3-ashelat@redhat.com> In-Reply-To: <20230601202734.813515-1-ashelat@redhat.com> References: <20230601202734.813515-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Use f-strings in rtevalConfig.py Signed-off-by: Anubhav Shelat Signed-off-by: John Kacur --- rteval/rtevalConfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rteval/rtevalConfig.py b/rteval/rtevalConfig.py index de88924642ca..41f1a567720f 100644 --- a/rteval/rtevalConfig.py +++ b/rteval/rtevalConfig.py @@ -115,7 +115,7 @@ class rtevalCfgSection: "Simple method for dumping config when object is used as a string" if not self.__cfgdata: return "# empty" - return "\n".join(["%s: %s" % (k, v) for k, v in list(self.__cfgdata.items())]) + "\n" + return "\n".join([f"{k}: {v}" for k, v in list(self.__cfgdata.items())]) + "\n" def __setattr__(self, key, val): From patchwork Thu Jun 1 20:27:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 688129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8E22C77B7E for ; Thu, 1 Jun 2023 20:28:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232556AbjFAU2w (ORCPT ); Thu, 1 Jun 2023 16:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232524AbjFAU2u (ORCPT ); Thu, 1 Jun 2023 16:28:50 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 036F4134 for ; Thu, 1 Jun 2023 13:28:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685651280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YODz8Xh2vnjPLXNUN/Kl69VYCg6jX1oU9RSU3IE59qQ=; b=Y9r+YRGzZtMDejgr08ScuAS5Zl+LgsRCNWBvsTJDvtD2W9AmUuVqei3Zt6kpXr4fdpdzAy 97v8u6cJ2v7JNbWY7ngQUlT6XOPmsDhbxMOWvM6tq8Mlhx3o7wbD86jQzjK7dOjAXzVvnk b1s8GwOZtGlbV2j5p5hjERNxwRNj3lc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-643-plvLMV6ENoKcWDTK_6rIwg-1; Thu, 01 Jun 2023 16:27:59 -0400 X-MC-Unique: plvLMV6ENoKcWDTK_6rIwg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8178A800BFF for ; Thu, 1 Jun 2023 20:27:59 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EEE6C154D9; Thu, 1 Jun 2023 20:27:59 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH v2 03/10] rteval: Use f-strings in cputopology Date: Thu, 1 Jun 2023 16:27:29 -0400 Message-Id: <20230601202734.813515-4-ashelat@redhat.com> In-Reply-To: <20230601202734.813515-1-ashelat@redhat.com> References: <20230601202734.813515-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Use f-strings in cputopology Signed-off-by: Anubhav Shelat Signed-off-by: John Kacur --- rteval/sysinfo/cputopology.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rteval/sysinfo/cputopology.py b/rteval/sysinfo/cputopology.py index ced7e1f295b7..2bb632312320 100644 --- a/rteval/sysinfo/cputopology.py +++ b/rteval/sysinfo/cputopology.py @@ -124,9 +124,7 @@ def unit_test(rootdir): x.saveFormatFileEnc('-', 'UTF-8', 1) print(" ---- getCPUcores() / getCPUscokets() ---- ") - print("CPU cores: %i (online: %i) - CPU sockets: %i" % (cputop.cpu_getCores(False), - cputop.cpu_getCores(True), - cputop.cpu_getSockets())) + print(f"CPU cores: {cputop.cpu_getCores(False)} (online: {cputop.cpu_getCores(True)}) - CPU sockets: {cputop.cpu_getSockets()}") return 0 except Exception as e: # import traceback From patchwork Thu Jun 1 20:27:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 689628 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA196C7EE29 for ; Thu, 1 Jun 2023 20:28:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232511AbjFAU2v (ORCPT ); Thu, 1 Jun 2023 16:28:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232484AbjFAU2s (ORCPT ); Thu, 1 Jun 2023 16:28:48 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02BCD8E for ; Thu, 1 Jun 2023 13:28:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685651280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tPgrce9Pn1FWVVZjRJocjaUdAB4mwM3JhGCt5cpjPWA=; b=GbcpKcfJxit8MBIfW7hgBzeMTJF2l+CFedFf63KA+ftlm7kDw/At51DAItWA4ZJUIUVLZT gaMwuNXghkXUrn9rUqsiUS1o+0/GLshe78a9HuRiSjFhV+pZc8p+jISfXnjpsKY+fRvABZ lzs+HwXWxe5nl3fbvdVlNWpK5JUCnB8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-643-7V4TcBpGP_-8OahrTalqQA-1; Thu, 01 Jun 2023 16:28:00 -0400 X-MC-Unique: 7V4TcBpGP_-8OahrTalqQA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ADC11185A78F for ; Thu, 1 Jun 2023 20:27:59 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8ED3EC154D9; Thu, 1 Jun 2023 20:27:59 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH v2 04/10] rteval: Use f-strings in kernel.py Date: Thu, 1 Jun 2023 16:27:30 -0400 Message-Id: <20230601202734.813515-5-ashelat@redhat.com> In-Reply-To: <20230601202734.813515-1-ashelat@redhat.com> References: <20230601202734.813515-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Use f-strings in kernel.py Signed-off-by: Anubhav Shelat Signed-off-by: John Kacur --- rteval/sysinfo/kernel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rteval/sysinfo/kernel.py b/rteval/sysinfo/kernel.py index f2e9d72ac2ef..ba5cadda40c5 100644 --- a/rteval/sysinfo/kernel.py +++ b/rteval/sysinfo/kernel.py @@ -47,8 +47,8 @@ class KernelInfo: policies = {'DLN': 'deadline', 'FF':'fifo', 'RR':'rrobin', 'TS':'other', '?':'unknown'} ret_kthreads = {} self.__log(Log.DEBUG, "getting kthread status") - cmd = '%s -eocommand,pid,policy,rtprio,comm' % getcmdpath('ps') - self.__log(Log.DEBUG, "cmd: %s" % cmd) + cmd = f"{getcmdpath('ps')} -eocommand,pid,policy,rtprio,comm" + self.__log(Log.DEBUG, f"cmd: {cmd}") c = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) for p in c.stdout: v = p.strip().split() From patchwork Thu Jun 1 20:27:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 689626 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6FD9C77B7E for ; Thu, 1 Jun 2023 20:28:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232542AbjFAU2z (ORCPT ); Thu, 1 Jun 2023 16:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232529AbjFAU2w (ORCPT ); Thu, 1 Jun 2023 16:28:52 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B008D198 for ; Thu, 1 Jun 2023 13:28:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685651281; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n0Z1yVlmIom9I0PFayqN7xLRtdMQMwSaZrgiuOlj0a0=; b=bT0x0io/lqof6k+QFsvToUoPnfXKu+OmRKS+nSrousee2oaMmhAHdmjvxUSS0dLW4K8hGi yWiztJS9dk9Cgdm3QMJjcGlnJV3XNAeyWWfV129kIk/eyz1FfxXlYUx9GZ5rY3gh/b+IqO goq94247KHJ6blDZoN7bBImULWuxmeM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-643-COy9LbF9M22wFVHdGeSu0A-1; Thu, 01 Jun 2023 16:28:00 -0400 X-MC-Unique: COy9LbF9M22wFVHdGeSu0A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DB270811E85 for ; Thu, 1 Jun 2023 20:27:59 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAD20C04492; Thu, 1 Jun 2023 20:27:59 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH v2 05/10] rteval: Use f-strings in memory.py Date: Thu, 1 Jun 2023 16:27:31 -0400 Message-Id: <20230601202734.813515-6-ashelat@redhat.com> In-Reply-To: <20230601202734.813515-1-ashelat@redhat.com> References: <20230601202734.813515-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Use f-strings in memory.py Signed-off-by: Anubhav Shelat Signed-off-by: John Kacur --- rteval/sysinfo/memory.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rteval/sysinfo/memory.py b/rteval/sysinfo/memory.py index 7c5fd6f315cf..cc2fa2cfa4be 100644 --- a/rteval/sysinfo/memory.py +++ b/rteval/sysinfo/memory.py @@ -49,7 +49,7 @@ class MemoryInfo: if l.startswith('MemTotal:'): parts = l.split() if parts[2].lower() != 'kb': - raise RuntimeError("Units changed from kB! (%s)" % parts[2]) + raise RuntimeError(f"Units changed from kB! ({parts[2]})") rawsize = int(parts[1]) f.close() break @@ -76,7 +76,7 @@ class MemoryInfo: memsize = self.mem_get_size() mem_n = libxml2.newNode("memory_size") - mem_n.addContent("%.3f" % memsize[0]) + mem_n.addContent(f"{memsize[0]:.3f}") mem_n.newProp("unit", memsize[1]) rep_n.addChild(mem_n) @@ -88,8 +88,8 @@ def unit_test(rootdir): import sys try: mi = MemoryInfo() - print("Numa nodes: %i" % mi.mem_get_numa_nodes()) - print("Memory: %i %s" % mi.mem_get_size()) + print(f"Numa nodes: {mi.mem_get_numa_nodes()}") + print(f"Memory: {int(mi.mem_get_size()[0])} {mi.mem_get_size()[1]}") except Exception as e: import traceback traceback.print_exc(file=sys.stdout) From patchwork Thu Jun 1 20:27:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 689629 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC85CC7EE23 for ; Thu, 1 Jun 2023 20:28:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232478AbjFAU2s (ORCPT ); Thu, 1 Jun 2023 16:28:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbjFAU2r (ORCPT ); Thu, 1 Jun 2023 16:28:47 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D7CE195 for ; Thu, 1 Jun 2023 13:28:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685651281; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PwhbVf7tWp9Sx6kiVtr3dP3sLSJnDuHYn/CiwUNsw+U=; b=i8WIaCcABhzq4hQviCt0FQvxb668cFHqCZy5L2NO8IZssP+99dG6GPaFgVN3uYKwLNhdCZ 3/BoD390sSai0CbeQV0kgrHjhhoba+w/nnTa5OYjD0nkKsPUsQzKfFYoPWRDwVkwTrQveN RGha6Nj/1662scMRWXTLkoieGEllrX4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-467-1CMMaTouNYKirPCd5JVZ_Q-1; Thu, 01 Jun 2023 16:28:00 -0400 X-MC-Unique: 1CMMaTouNYKirPCd5JVZ_Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1973F8015D8 for ; Thu, 1 Jun 2023 20:28:00 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6B24C154D9; Thu, 1 Jun 2023 20:27:59 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH v2 06/10] rteval: Use f-strings in osinfo Date: Thu, 1 Jun 2023 16:27:32 -0400 Message-Id: <20230601202734.813515-7-ashelat@redhat.com> In-Reply-To: <20230601202734.813515-1-ashelat@redhat.com> References: <20230601202734.813515-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Use f-strings in osinfo.py Signed-off-by: Anubhav Shelat Signed-off-by: John Kacur --- rteval/sysinfo/osinfo.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rteval/sysinfo/osinfo.py b/rteval/sysinfo/osinfo.py index ead5e3939cfa..83dc78b96fdd 100644 --- a/rteval/sysinfo/osinfo.py +++ b/rteval/sysinfo/osinfo.py @@ -55,9 +55,9 @@ class OSInfo: shutil.copyfile(dpath, os.path.join(repdir, "dmesg")) return if os.path.exists('/usr/bin/dmesg'): - subprocess.call('/usr/bin/dmesg > %s' % os.path.join(repdir, "dmesg"), shell=True) + subprocess.call(f'/usr/bin/dmesg > {os.path.join(repdir, "dmesg")}', shell=True) return - print("dmesg file not found at %s and no dmesg exe found!" % dpath) + print(f"dmesg file not found at {dpath} and no dmesg exe found!") @@ -69,16 +69,16 @@ class OSInfo: else: raise RuntimeError("Can't find sosreport/sysreport") - self.__logger.log(Log.DEBUG, "report tool: %s" % exe) + self.__logger.log(Log.DEBUG, f"report tool: {exe}") options = ['-k', 'rpm.rpmva=off', '--name=rteval', '--batch'] self.__logger.log(Log.INFO, "Generating SOS report") - self.__logger.log(Log.INFO, "using command %s" % " ".join([exe]+options)) + self.__logger.log(Log.INFO, f"using command {' '.join([exe]+options)}") subprocess.call([exe] + options) for s in glob('/tmp/s?sreport-rteval-*'): - self.__logger.log(Log.DEBUG, "moving %s to %s" % (s, repdir)) + self.__logger.log(Log.DEBUG, f"moving {s} to {repdir}") shutil.move(s, repdir) @@ -118,7 +118,7 @@ def unit_test(rootdir): log = Log() log.SetLogVerbosity(Log.DEBUG|Log.INFO) osi = OSInfo(logger=log) - print("Base OS: %s" % osi.get_base_os()) + print(f"Base OS: {osi.get_base_os()}") print("Testing OSInfo::copy_dmesg('/tmp'): ", end=' ') osi.copy_dmesg('/tmp') From patchwork Thu Jun 1 20:27:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 689627 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA2FBC7EE2E for ; Thu, 1 Jun 2023 20:28:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232537AbjFAU2x (ORCPT ); Thu, 1 Jun 2023 16:28:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232496AbjFAU2v (ORCPT ); Thu, 1 Jun 2023 16:28:51 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C4AF197 for ; Thu, 1 Jun 2023 13:28:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685651281; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fIeTBMkR8JhU5vah/ui8Jku9ZedIAO0g44XbS7QFzeA=; b=PqZjWbnkPWjSBeJZeu3xwKMLqSPB2ZDTBeO7UsxyAHClctb2jBwQBDg4O8ZaZpZ9kvKULw bnZ+ofIyneamkwLk/KsHPS5O9R5NwiAo0hYm4N/V0+O2PXYvT/aM19fVgmQsYx7sx1Y+OH hO08NEoRHFUphyhz5CHh9FB5TpYjGqk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-672-oUDfVq7OOFqsa4woApV4TQ-1; Thu, 01 Jun 2023 16:28:00 -0400 X-MC-Unique: oUDfVq7OOFqsa4woApV4TQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 43A643813F20 for ; Thu, 1 Jun 2023 20:28:00 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 253ACC154D9; Thu, 1 Jun 2023 20:28:00 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH v2 07/10] rteval: Use f-strings in services.py Date: Thu, 1 Jun 2023 16:27:33 -0400 Message-Id: <20230601202734.813515-8-ashelat@redhat.com> In-Reply-To: <20230601202734.813515-1-ashelat@redhat.com> References: <20230601202734.813515-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Use f-strings in services.py Signed-off-by: Anubhav Shelat Signed-off-by: John Kacur --- rteval/sysinfo/services.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rteval/sysinfo/services.py b/rteval/sysinfo/services.py index c85980e19165..a87b4abeea76 100644 --- a/rteval/sysinfo/services.py +++ b/rteval/sysinfo/services.py @@ -55,17 +55,17 @@ class SystemServices: break if not servicesdir: raise RuntimeError("No services dir (init.d) found on your system") - self.__log(Log.DEBUG, "Services located in %s, going through each service file to check status" % servicesdir) + self.__log(Log.DEBUG, f"Services located in {servicesdir}, going through each service file to check status") ret_services = {} for service in glob.glob(os.path.join(servicesdir, '*')): servicename = os.path.basename(service) if not [1 for p in reject if fnmatch.fnmatch(servicename, p)] \ and os.access(service, os.X_OK): - cmd = '%s -qs "\(^\|\W\)status)" %s' % (getcmdpath('grep'), service) + cmd = f'{getcmdpath("grep")} -qs "\(^\|\W\)status)" {service}' c = subprocess.Popen(cmd, shell=True, encoding='utf-8') c.wait() if c.returncode == 0: - cmd = ['env', '-i', 'LANG="%s"' % os.environ['LANG'], 'PATH="%s"' % os.environ['PATH'], 'TERM="%s"' % os.environ['TERM'], service, 'status'] + cmd = ['env', '-i', f'LANG="{os.environ["LANG"]}"', f'PATH="{os.environ["PATH"]}"', f'TERM="{os.environ["TERM"]}"', service, 'status'] c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8') c.wait() if c.returncode == 0 and (c.stdout.read() or c.stderr.read()): @@ -79,8 +79,8 @@ class SystemServices: def __get_services_systemd(self): ret_services = {} - cmd = '%s list-unit-files -t service --no-legend' % getcmdpath('systemctl') - self.__log(Log.DEBUG, "cmd: %s" % cmd) + cmd = f'{getcmdpath("systemctl")} list-unit-files -t service --no-legend' + self.__log(Log.DEBUG, f"cmd: {cmd}") c = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8') for p in c.stdout: # p are lines like b'servicename.service status' @@ -133,7 +133,7 @@ def unit_test(rootdir): return 0 except Exception as err: - print("** EXCEPTION: %s" % str(err)) + print(f"** EXCEPTION: {str(err)}") return 1 From patchwork Thu Jun 1 20:27:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 688128 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB9F8C7EE23 for ; Thu, 1 Jun 2023 20:28:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232552AbjFAU2y (ORCPT ); Thu, 1 Jun 2023 16:28:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232484AbjFAU2w (ORCPT ); Thu, 1 Jun 2023 16:28:52 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD081189 for ; Thu, 1 Jun 2023 13:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685651282; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=axx1XRtQrYGyTMCm6dkt6vCwJ6R10WhsaMgu9FrLrGo=; b=MUXanFLNK1ZRq0AWWMIclO4E7P981OJ56Y9rIaN/D9bdU1qlcVr/g5KTh5e+F71cjtMV7Q AL8eN1Hk9HH//g1xcPFjNKFLqOGiC0dXbNHfy1uIKhOzFyURKE7axZdy6VGuskxZKClfsk g0Tj/YEG9/4XcegHvnolasbWF0ChlWk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-589-OspKPa-7PIexhj7AGDEX4A-1; Thu, 01 Jun 2023 16:28:00 -0400 X-MC-Unique: OspKPa-7PIexhj7AGDEX4A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6EE97811E7F for ; Thu, 1 Jun 2023 20:28:00 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F732C154D9; Thu, 1 Jun 2023 20:28:00 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH v2 08/10] rteval: Use f-strings in tools.py Date: Thu, 1 Jun 2023 16:27:34 -0400 Message-Id: <20230601202734.813515-9-ashelat@redhat.com> In-Reply-To: <20230601202734.813515-1-ashelat@redhat.com> References: <20230601202734.813515-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Use f-strings in tools.py Signed-off-by: Anubhav Shelat Signed-off-by: John Kacur --- rteval/sysinfo/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rteval/sysinfo/tools.py b/rteval/sysinfo/tools.py index 3993da413d8a..aa00b3d3eafc 100644 --- a/rteval/sysinfo/tools.py +++ b/rteval/sysinfo/tools.py @@ -40,5 +40,5 @@ def getcmdpath(which): pathSave[which] = cmdfile break if not pathSave[which]: - raise RuntimeError("Command '%s' is unknown on this system" % which) + raise RuntimeError(f"Command '{which}' is unknown on this system") return pathSave[which] From patchwork Thu Jun 1 20:27:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 688127 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64B56C7EE2F for ; Thu, 1 Jun 2023 20:28:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232529AbjFAU24 (ORCPT ); Thu, 1 Jun 2023 16:28:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232523AbjFAU2w (ORCPT ); Thu, 1 Jun 2023 16:28:52 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 217D8199 for ; Thu, 1 Jun 2023 13:28:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685651282; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bGwHwqxRVENN0/67TDjlWY1dABIsmuKaifQxjaGJZq0=; b=eMittaa4ZRmWixzPOhBwzBUZx3mXST6uA/WDX6WFGFZOxcRbtyrVCs7OLGLOnxeYXFgovo 8zaIl0d1auqeQsSzX/s3EERD6ImF3YAZ4mp+x0fSt0WC3zZ+LasU+1MkDiZo98uLQ9JHLU XjAke13Q8N2Y34UjJJP+6V8rmLQV8fk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-205-7sedtibXPbeXZ_kiptGp2w-1; Thu, 01 Jun 2023 16:28:00 -0400 X-MC-Unique: 7sedtibXPbeXZ_kiptGp2w-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9A5DD101A53A for ; Thu, 1 Jun 2023 20:28:00 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B547C154D9; Thu, 1 Jun 2023 20:28:00 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH v2 09/10] Added code to check if the proc/net/if_inet6 file exists while loading IPv6 addresses in the IPv6Addresses class Date: Thu, 1 Jun 2023 16:27:35 -0400 Message-Id: <20230601202734.813515-10-ashelat@redhat.com> In-Reply-To: <20230601202734.813515-1-ashelat@redhat.com> References: <20230601202734.813515-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Added code to check if the proc/net/if_inet6 file exists while loading IPv6 addresses in the IPv6Addresses class. If it doesn't, then the system has IPv6 disabled, and that chunk of code is passed. Signed-off-by: Anubhav Shelat Signed-off-by: John Kacur --- rteval/sysinfo/newnet.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/rteval/sysinfo/newnet.py b/rteval/sysinfo/newnet.py index 63417d9e59f1..2911400ceb6c 100644 --- a/rteval/sysinfo/newnet.py +++ b/rteval/sysinfo/newnet.py @@ -72,19 +72,23 @@ class IPv6Addresses(): and a list of ipv6addresses ''' MYP = '/proc/net/if_inet6' - with open(MYP, 'r') as f: - mystr = f.readline().strip() - while len(mystr) > 0: - ipv6addr , _, _, _, _, intf = mystr.split() - ipv6addr = compress_iv6(ipv6addr) - if intf == 'lo': - mystr = f.readline().strip() - continue - if intf not in self.data: - self.data[intf] = [ipv6addr] - else: - self.data[intf].append(ipv6addr) + try: + with open(MYP, 'r') as f: mystr = f.readline().strip() + while len(mystr) > 0: + ipv6addr , _, _, _, _, intf = mystr.split() + ipv6addr = compress_iv6(ipv6addr) + if intf == 'lo': + mystr = f.readline().strip() + continue + if intf not in self.data: + self.data[intf] = [ipv6addr] + else: + self.data[intf].append(ipv6addr) + mystr = f.readline().strip() + # if IPv6 is disabled, the if_net6 files does not exist, so we can pass + except FileNotFoundError: + pass class IPv4Addresses(): ''' Obtains a list of IPv4 addresses from the proc file system ''' From patchwork Thu Jun 1 20:27:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anubhav Shelat X-Patchwork-Id: 689625 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C34D3C7EE23 for ; Thu, 1 Jun 2023 20:29:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232172AbjFAU3T (ORCPT ); Thu, 1 Jun 2023 16:29:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231985AbjFAU3S (ORCPT ); Thu, 1 Jun 2023 16:29:18 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97A981BD for ; Thu, 1 Jun 2023 13:28:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685651289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8VWG2fXNVhB4XfbfQNvpqvx10l3d1E9bX/ANPHSpf0g=; b=g4yiPFGg1xXWLw5xp46nTs1Z4hbJPlYsdFMsIg5O6dAcEiy4YbmgyhDO73OYDFy0cvC+ga zlAhz2qeUFfsh41dbu9NXe/aUiCkzIK+4D0HMDCky3ckLfuBvt1SNGVsFfRi4VQuRINe3r c62XRlmUEAsBnzX9oxkXRMvMOSn/VJ4= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-368-tIEc0IoSNNGeHJpdFzhEpQ-1; Thu, 01 Jun 2023 16:28:01 -0400 X-MC-Unique: tIEc0IoSNNGeHJpdFzhEpQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C49B13C025CE for ; Thu, 1 Jun 2023 20:28:00 +0000 (UTC) Received: from ashelat.remote.csb (unknown [10.22.34.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id A614AC154D9; Thu, 1 Jun 2023 20:28:00 +0000 (UTC) From: Anubhav Shelat To: linux-rt-users@vger.kernel.org Cc: Anubhav Shelat Subject: [PATCH v2 10/10] rteval: Use f-strings in __init__.py Date: Thu, 1 Jun 2023 16:27:36 -0400 Message-Id: <20230601202734.813515-11-ashelat@redhat.com> In-Reply-To: <20230601202734.813515-1-ashelat@redhat.com> References: <20230601202734.813515-1-ashelat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Use f-strings in __init__.py Signed-off-by: Anubhav Shelat --- rteval/sysinfo/__init__.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/rteval/sysinfo/__init__.py b/rteval/sysinfo/__init__.py index 5767e5b7f6fe..31059c564d59 100644 --- a/rteval/sysinfo/__init__.py +++ b/rteval/sysinfo/__init__.py @@ -83,27 +83,23 @@ if __name__ == "__main__": print(f"\tRunning on {si.get_base_os()}") print(f"\tNUMA nodes: {si.mem_get_numa_nodes()}") - print("\tMemory available: %03.2f %s\n" % si.mem_get_size()) + print(f"\tMemory available: {si.mem_get_size()[0]:03.2f} {si.mem_get_size()[1]}\n") print("\tServices: ") for (s, r) in list(si.services_get().items()): - print("\t\t%s: %s" % (s, r)) + print(f"\t\t{s}: {r}") (curr, avail) = si.kernel_get_clocksources() - print("\tCurrent clocksource: %s" % curr) - print("\tAvailable clocksources: %s" % avail) + print(f"\tCurrent clocksource: {curr}") + print(f"\tAvailable clocksources: {avail}") print("\tModules:") for m in si.kernel_get_modules(): - print("\t\t%s: %s" % (m['modname'], m['modstate'])) + print(f"\t\t{m['modname']}: {m['modstate']}") print("\tKernel threads:") for (p, i) in list(si.kernel_get_kthreads().items()): - print("\t\t%-30.30s pid: %-5.5s policy: %-7.7s prio: %-3.3s" % ( - str(i["name"])+":", p, i["policy"], i["priority"] - )) + print(f"\t\t{str(i['name'])[:30]+':':<30} pid: {str(p)[:5]:<5} policy: {str(i['policy'])[:7]:<7} prio: {str(i['priority'])[:3]:<3}") - print("\n\tCPU topology info - cores: %i online: %i sockets: %i" % ( - si.cpu_getCores(False), si.cpu_getCores(True), si.cpu_getSockets() - )) + print(f"\n\tCPU topology info - cores: {si.cpu_getCores(False)} online: {si.cpu_getCores(True)} sockets: {si.cpu_getSockets()}") xml = si.MakeReport() xml_d = libxml2.newDoc("1.0")