From patchwork Thu Aug 29 16:04:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Santana X-Patchwork-Id: 1978555 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=C70XztN5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvmMH59Jcz1yXd for ; Fri, 30 Aug 2024 02:04:59 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 47B21419E5; Thu, 29 Aug 2024 16:04:57 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id rp5JHcLlxOF8; Thu, 29 Aug 2024 16:04:55 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org C0E29419DA Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=C70XztN5 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id C0E29419DA; Thu, 29 Aug 2024 16:04:55 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7A866C0012; Thu, 29 Aug 2024 16:04:55 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id E2DC2C0011 for ; Thu, 29 Aug 2024 16:04:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C9D0D419DA for ; Thu, 29 Aug 2024 16:04:53 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id xKAuHXcvzwg2 for ; Thu, 29 Aug 2024 16:04:53 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=msantana@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org A6612419D5 Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org A6612419D5 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id A6612419D5 for ; Thu, 29 Aug 2024 16:04:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724947491; 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; bh=mPLiKdgXIK+wY3C1QGlt+ib7OwxrHnyMrnZa53y33wg=; b=C70XztN5UP66xk/T1nOWMbzz51N8KDMdB36kN28HFUOPjn7k58nCBwIfyoJVLXZsIafKUX UXbg/UdVB2ujHLMeiVSnGXAe+0HQA0XM+E+nPVJihoLFM2rpHkCWeFIpQ/3YDtVq2OuMBX 7phqlc0FeONdiDVbvPsJR8dqhNFny1Q= Received: from mail-oa1-f69.google.com (mail-oa1-f69.google.com [209.85.160.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-551-UoM00AeONGCKgvBF6IT19w-1; Thu, 29 Aug 2024 12:04:49 -0400 X-MC-Unique: UoM00AeONGCKgvBF6IT19w-1 Received: by mail-oa1-f69.google.com with SMTP id 586e51a60fabf-27779b496eeso744319fac.0 for ; Thu, 29 Aug 2024 09:04:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724947488; x=1725552288; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mPLiKdgXIK+wY3C1QGlt+ib7OwxrHnyMrnZa53y33wg=; b=wb7rcLtPXSNtzoWE3DpKSFSlfBOBIAV4xrsTVwjvsU89UpvYyjjM9HWuykixI/7AJu E6OiKZC7lhZmdU83OsHf+HCmBGncweZ8KYVGxZ/t3wHNqRL2wCXkeAko+m4gwpP0ppS4 nNwMOAfQIv2nsS8w+zdDYmPYqyqFiarbrq+UQgAt/thk0t/iWerwNNwBz1ZFFHwbVmjl FgV8+gAJwMlzG1Qz48wbjVKWx7rAHS7PH75SbB5GcZKpW8B05fCci9PVx0nlaleA0ZA2 UrtD5ex+D2XkAp7bMGkozIp3ZIusTzR/IYAinFoxO3Pz5ERA5UOoGCqGZYBAJlhY2qSs Bwmg== X-Gm-Message-State: AOJu0YySNKOWtKPbpHNnybDPr1v110RWPh/A5uK27a0wZOUM+sbLuvHL Q4frEpo/n63FKkGlg5m3skqildJDqebyUmDXS+3Y6tBXexjlBMHpA2l4+rjXh+MCt4gXOCQSA+E d5NQEL8JyyrcbwcgqOBXJbcpTYBzZN+YF069KJ68AbNWOePT+tj80gk+jlSB0TDdYCjTqDDfYpT k8ihNCvHCtLhDsklRy5h6RInnCbqQhVsZLmRnpUv4= X-Received: by 2002:a05:6871:691:b0:25e:b984:22e9 with SMTP id 586e51a60fabf-2779323b811mr1090068fac.5.1724947488488; Thu, 29 Aug 2024 09:04:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFp+Yvbob9fr8SEi3dV9qs3d2bCZJF+pi95UE8imJcvEiEorH5ICDylWMGdnqlGFxOZgZQe2A== X-Received: by 2002:a05:6871:691:b0:25e:b984:22e9 with SMTP id 586e51a60fabf-2779323b811mr1090049fac.5.1724947488094; Thu, 29 Aug 2024 09:04:48 -0700 (PDT) Received: from work.redhat.com (c-24-91-72-234.hsd1.ma.comcast.net. [24.91.72.234]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-70f60b2e5bcsm336575a34.0.2024.08.29.09.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 09:04:47 -0700 (PDT) From: Michael Santana To: ovs-dev@openvswitch.org Date: Thu, 29 Aug 2024 12:04:33 -0400 Message-ID: <20240829160433.1915883-1-msantana@redhat.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH] ovs-dpctl-top: Fix Python3.12 invalid syntax warning X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Python3.12 is throwing syntax warnings in ovs-dpctl-top [root@localhost ~]# python --version Python 3.12.5 [root@localhost ~]# ovs-dpctl-top --help > /dev/null /usr/bin/ovs-dpctl-top:392: SyntaxWarning: invalid escape sequence '\w' FIELDS_CMPND = re.compile("([\w]+)\((.+)\)") /usr/bin/ovs-dpctl-top:394: SyntaxWarning: invalid escape sequence '\w' FIELDS_CMPND_ELEMENT = re.compile("([\w:]+)=([/\.\w:]+)") /usr/bin/ovs-dpctl-top:395: SyntaxWarning: invalid escape sequence '\w' FIELDS_ELEMENT = re.compile("([\w]+):([-\.\w]+)") The warning seems to be new to python3.12 Python 3.12.5 (main, Aug 23 2024, 00:00:00) >>> import re >>> re.compile("([\w]+)\((.+)\)") :1: SyntaxWarning: invalid escape sequence '\w' re.compile('([\\w]+)\\((.+)\\)') >>> re.compile(r"([\w]+)\((.+)\)") re.compile('([\\w]+)\\((.+)\\)') Python 3.11.4 (main, Jun 7 2023, 00:00:00) >>> import re >>> re.compile("([\w]+)\((.+)\)") re.compile('([\\w]+)\\((.+)\\)') Prepending the string with r tells python treat the string as a raw string literal and to not try to scape \w, \(, etc, and gets rid of the warning Signed-off-by: Michael Santana Acked-by: Simon Horman Acked-by: Eelco Chaudron --- utilities/ovs-dpctl-top.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utilities/ovs-dpctl-top.in b/utilities/ovs-dpctl-top.in index ec57eccd6..1708c2f37 100755 --- a/utilities/ovs-dpctl-top.in +++ b/utilities/ovs-dpctl-top.in @@ -389,10 +389,10 @@ def args_get(): # Code to parse a single line in dump-flow ### # key(values) -FIELDS_CMPND = re.compile("([\w]+)\((.+)\)") +FIELDS_CMPND = re.compile(r"([\w]+)\((.+)\)") # key:value -FIELDS_CMPND_ELEMENT = re.compile("([\w:]+)=([/\.\w:]+)") -FIELDS_ELEMENT = re.compile("([\w]+):([-\.\w]+)") +FIELDS_CMPND_ELEMENT = re.compile(r"([\w:]+)=([/\.\w:]+)") +FIELDS_ELEMENT = re.compile(r"([\w]+):([-\.\w]+)") def flow_line_iter(line):