From mboxrd@z Thu Jan 1 00:00:00 1970 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 70399C3F6B0 for ; Tue, 9 Aug 2022 19:37:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235436AbiHITh2 (ORCPT ); Tue, 9 Aug 2022 15:37:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235535AbiHIThC (ORCPT ); Tue, 9 Aug 2022 15:37:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 509DF24942; Tue, 9 Aug 2022 12:37:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E188D61337; Tue, 9 Aug 2022 19:37:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DA59C433C1; Tue, 9 Aug 2022 19:37:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660073820; bh=7RU30KM7l0MKvkGXYL/0iZfnQboyY+CyJ42jlnIxKfA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aih3hVnI5FTJlnCknNFmJ1FuAG1eAPO6LY0VkAvF4DLbZ0MniUEuh3a/jwRr7gy4t kQCT2XzSbqTSt9BxZr08qIIoZAmr1KqMuvDSTDP3M8bQ44aGwyfN5L9PoFhBdUff2T TdCi0Ip7WNnr64nlX6qjdiy01AA0fMVdHgnTQEVufIjIXgW3SZuH3AZDAll46iwaXz mTGOwGiwxJspYaKmLyrlmu/uJMCQpzeIoAI5oCoD//yAFvNXVHLqzMmWFmr1PHzsbW sq5nuBHCden8b+mDMcV0akUHcuUhqCm1m7XJNlHmhRHevC7qcMZ06dOThtKaZbHxtY Y7k9btN34vLWg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id B2D6E4035A; Tue, 9 Aug 2022 16:36:57 -0300 (-03) Date: Tue, 9 Aug 2022 16:36:57 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Andi Kleen , Zhengjun Xing , Ravi Bangoria , Kan Liang , Adrian Hunter , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, Stephane Eranian Subject: Re: [PATCH v4 01/17] perf jevents: Clean up pytype warnings Message-ID: References: <20220804221816.1802790-1-irogers@google.com> <20220804221816.1802790-2-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220804221816.1802790-2-irogers@google.com> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Aug 04, 2022 at 03:18:00PM -0700, Ian Rogers escreveu: > Improve type hints to clean up pytype warnings. Thanks, applied. - Arnaldo > Signed-off-by: Ian Rogers > --- > tools/perf/pmu-events/jevents.py | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jevents.py > index 83e0dcbeac9a..5b72048d50da 100755 > --- a/tools/perf/pmu-events/jevents.py > +++ b/tools/perf/pmu-events/jevents.py > @@ -6,8 +6,7 @@ import csv > import json > import os > import sys > -from typing import Callable > -from typing import Sequence > +from typing import (Callable, Optional, Sequence) > > # Global command line arguments. > _args = None > @@ -57,7 +56,7 @@ class JsonEvent: > '. '), '.').replace('\n', '\\n').replace( > '\"', '\\"').replace('\r', '\\r') > > - def convert_aggr_mode(aggr_mode: str) -> str: > + def convert_aggr_mode(aggr_mode: str) -> Optional[str]: > """Returns the aggr_mode_class enum value associated with the JSON string.""" > if not aggr_mode: > return None > @@ -67,7 +66,7 @@ class JsonEvent: > } > return aggr_mode_to_enum[aggr_mode] > > - def lookup_msr(num: str) -> str: > + def lookup_msr(num: str) -> Optional[str]: > """Converts the msr number, or first in a list to the appropriate event field.""" > if not num: > return None > @@ -79,7 +78,7 @@ class JsonEvent: > } > return msrmap[int(num.split(',', 1)[0], 0)] > > - def real_event(name: str, event: str) -> str: > + def real_event(name: str, event: str) -> Optional[str]: > """Convert well known event names to an event string otherwise use the event argument.""" > fixed = { > 'inst_retired.any': 'event=0xc0,period=2000003', > @@ -95,7 +94,7 @@ class JsonEvent: > return fixed[name.lower()] > return event > > - def unit_to_pmu(unit: str) -> str: > + def unit_to_pmu(unit: str) -> Optional[str]: > """Convert a JSON Unit to Linux PMU name.""" > if not unit: > return None > @@ -154,7 +153,7 @@ class JsonEvent: > if self.metric_expr: > self.metric_expr = self.metric_expr.replace('\\', '\\\\') > arch_std = jd.get('ArchStdEvent') > - if precise and self.desc and not '(Precise Event)' in self.desc: > + if precise and self.desc and '(Precise Event)' not in self.desc: > extra_desc += ' (Must be precise)' if precise == '2' else (' (Precise ' > 'event)') > event = f'config={llx(configcode)}' if configcode is not None else f'event={llx(eventcode)}' > -- > 2.37.1.559.g78731f0fdb-goog -- - Arnaldo From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0479C19F2D for ; Tue, 9 Aug 2022 19:38:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bEkyHkjQJUPcFTysAW2MQXrer5qbjljVxsjLJIa81+I=; b=xi6BcpDNrbotEP bpa457dKp8Nx3w2h9aU4yDlw0bjx1BOvQts9XrnNreD9KUmsPq3ETr4ZTyGdv4ev0cc6TXXvQTNTM 0/ubD/11Qn8GC19Y6tOKWflZKjgMLfTjq09Ba/LPIZJjS7xQWBsuXu+tAC5yvvZ8KQTU56FyNdUXc OncJqH3nxFedPiZVWoeFv+atlDfLah2sP7l5Pi3Vj6u32ZmsY24HJi7W7EtpyISiCPHKImaXDPcZA IabTLzFUmVN0AT12X6aStDjoOHStjXApJ6xuiVUkbKbY5FsjPBoO1NTqNzI9x2g0LZtBfMou4BWVA HbeUzUV6yhMChz+aqz0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLV2I-005uQ7-Gb; Tue, 09 Aug 2022 19:37:06 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLV2G-005uOC-2G for linux-arm-kernel@bombadil.infradead.org; Tue, 09 Aug 2022 19:37:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jOn1+XY9TNRDp6vYRTWfZIqPAUU42P3qsb6wXETneKs=; b=rxWdGSTmeVT/cxxJOdD3eUUjLu wy7J/lwUGAoXD+fu5ZizmW/lP5H+Rv4t0iJOwnRLOzU44bkPpEtNY1cb00Ftl3BPH42Z9dkIdd09W c0fsBT/BEqTFa6MPYgZ6SI93LESDPpFUNkMWD1Ful950KLzQHykNWtI6vyGmHLPHPoKSCeBvEVNev 21dSQlg6R/Xwqp9xyrTkUM/NOvVYVxwkFWeJ4jMLElUhpsj/gxy8Ygh1Rb6muPVh4+T/gq1eeN9rP pEm4haD79gNwagZn/Xg0oBYXVIyKJdflI5OZnehVFJisx1lqdpG7KGlO6axq0V5M3WaLBWQzVglJy vcwVDUYA==; Received: from [187.19.239.32] (helo=quaco.ghostprotocols.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLV2C-00FmoC-S2; Tue, 09 Aug 2022 19:37:01 +0000 Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id B2D6E4035A; Tue, 9 Aug 2022 16:36:57 -0300 (-03) Date: Tue, 9 Aug 2022 16:36:57 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Andi Kleen , Zhengjun Xing , Ravi Bangoria , Kan Liang , Adrian Hunter , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, Stephane Eranian Subject: Re: [PATCH v4 01/17] perf jevents: Clean up pytype warnings Message-ID: References: <20220804221816.1802790-1-irogers@google.com> <20220804221816.1802790-2-irogers@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220804221816.1802790-2-irogers@google.com> X-Url: http://acmel.wordpress.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Em Thu, Aug 04, 2022 at 03:18:00PM -0700, Ian Rogers escreveu: > Improve type hints to clean up pytype warnings. Thanks, applied. - Arnaldo > Signed-off-by: Ian Rogers > --- > tools/perf/pmu-events/jevents.py | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jevents.py > index 83e0dcbeac9a..5b72048d50da 100755 > --- a/tools/perf/pmu-events/jevents.py > +++ b/tools/perf/pmu-events/jevents.py > @@ -6,8 +6,7 @@ import csv > import json > import os > import sys > -from typing import Callable > -from typing import Sequence > +from typing import (Callable, Optional, Sequence) > > # Global command line arguments. > _args = None > @@ -57,7 +56,7 @@ class JsonEvent: > '. '), '.').replace('\n', '\\n').replace( > '\"', '\\"').replace('\r', '\\r') > > - def convert_aggr_mode(aggr_mode: str) -> str: > + def convert_aggr_mode(aggr_mode: str) -> Optional[str]: > """Returns the aggr_mode_class enum value associated with the JSON string.""" > if not aggr_mode: > return None > @@ -67,7 +66,7 @@ class JsonEvent: > } > return aggr_mode_to_enum[aggr_mode] > > - def lookup_msr(num: str) -> str: > + def lookup_msr(num: str) -> Optional[str]: > """Converts the msr number, or first in a list to the appropriate event field.""" > if not num: > return None > @@ -79,7 +78,7 @@ class JsonEvent: > } > return msrmap[int(num.split(',', 1)[0], 0)] > > - def real_event(name: str, event: str) -> str: > + def real_event(name: str, event: str) -> Optional[str]: > """Convert well known event names to an event string otherwise use the event argument.""" > fixed = { > 'inst_retired.any': 'event=0xc0,period=2000003', > @@ -95,7 +94,7 @@ class JsonEvent: > return fixed[name.lower()] > return event > > - def unit_to_pmu(unit: str) -> str: > + def unit_to_pmu(unit: str) -> Optional[str]: > """Convert a JSON Unit to Linux PMU name.""" > if not unit: > return None > @@ -154,7 +153,7 @@ class JsonEvent: > if self.metric_expr: > self.metric_expr = self.metric_expr.replace('\\', '\\\\') > arch_std = jd.get('ArchStdEvent') > - if precise and self.desc and not '(Precise Event)' in self.desc: > + if precise and self.desc and '(Precise Event)' not in self.desc: > extra_desc += ' (Must be precise)' if precise == '2' else (' (Precise ' > 'event)') > event = f'config={llx(configcode)}' if configcode is not None else f'event={llx(eventcode)}' > -- > 2.37.1.559.g78731f0fdb-goog -- - Arnaldo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel