From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B289B45811; Mon, 19 Aug 2024 11:37:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9F4014028A; Mon, 19 Aug 2024 11:37:16 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) by mails.dpdk.org (Postfix) with ESMTP id 130B040267 for ; Mon, 19 Aug 2024 11:37:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724060235; x=1755596235; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=gJFuCibTh9lS281RSLyOxATGZNNFe563NENlQHbGI1A=; b=W7+/c9wHddP8aIUyOmpYF+QDvxOUXRQ3URcUNajN5+5FIPUlvPOd7+n1 B7jLAY8E+XZWrg54JEzDMuiy2yAs9zLHVkheBFP+CY2ApQJrNSnk95MD2 p+EXCVon7ZQ4DOQjdkDPHpP3iO+dsLtOYNmzIveXFlC2nsw6FzCmkB9+b f3wEPiP/fcoDNYHXUj5LwNyP826neuvSi8CFeUlvf5G62+prlCWPELKr8 VlNG/RRRPGOBcgzt/kwTCSM7HUzzN8zewj8Ggu2I5VNNZc/TO6Yt27UVg C6J7JvUmMECLu1+jcNDtfsYmpBzjrwGpwAQ+UpvejPtKeBgHqVn895Z/p Q==; X-CSE-ConnectionGUID: 48BdxaTBRZmG+jgyn2xfig== X-CSE-MsgGUID: ikyfChraRSCZU0k/uYwC+A== X-IronPort-AV: E=McAfee;i="6700,10204,11168"; a="33448719" X-IronPort-AV: E=Sophos;i="6.10,158,1719903600"; d="scan'208";a="33448719" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2024 02:36:59 -0700 X-CSE-ConnectionGUID: 83rZABVQSf6ZenQvx7iYXQ== X-CSE-MsgGUID: 35FKPctxSu2RtFxLZ96DWg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,158,1719903600"; d="scan'208";a="59972007" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmviesa006.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 19 Aug 2024 02:36:59 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 19 Aug 2024 02:36:58 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 19 Aug 2024 02:36:57 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Mon, 19 Aug 2024 02:36:57 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.43) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 19 Aug 2024 02:36:57 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eOlXLN7JYPvL4ZmWNPPZkr3BCYQtw0bMi2R6OuNpcsBWJyFSRevRnS1fubT5I6hVV4dWr4wuaWnJXi16wYBt7jV6hkYuqfNq/ulcoNtCg6QU5zJLsHVPV6ruVYuqCf5BFB1eaCEc2Ml2DNthy4HQ1OYG71xBT6WvqPwvBavtre9K7VyeX2qvH4PnlZjbBduxEcUbVijEvxhInWAAaVs5NEc4AfQtp3W0Q/vzYZyMLfRqtTmF1PvEAS/o8UK3z32k81crfxuibZBuE5FJDTfCVg9Jiouxz5gVj+Uhg0jj3I1yFWq6SbA4u6RSF6SS5NuFqzRc+kaLRt+kwh8eCD+zow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kDY1CzzoQz5+jnSMIN5FgiR7wbFZGvVhLk5sbi8S9cM=; b=DI4a8EFnZPOuw8Kq6SCsLdgvDR0rXQ5IXSM40wij2zbcrZrKUftMgWVXUc9+eIxDNvvZnhVu4yqZF387JH82QoX4D497qrZX7zPHhbCuUo05fgBU7FD0jVIQdvg60pZ+hLZZrZa/nDeCuX3v7/GA6mPbwfoLUBM6lERTsDXVWy0Y7LdWBK4s2WN84wBoD3HsQ60T1x5+7HrQD4eQdH28lsM6wL7AQ+MmRkBxffr1X4XOXEO4Q1BSYWyh72VnSidKFcgeC2qUmqB+GNG8tvPA3Zq1QZrRA2FtxeFmpMAvT/2Qsbw0C98M6NLOzZ5Tjw6MspFotuZ3akXmNje0jyQ5RA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB6502.namprd11.prod.outlook.com (2603:10b6:8:89::7) by DS0PR11MB7312.namprd11.prod.outlook.com (2603:10b6:8:11f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Mon, 19 Aug 2024 09:36:50 +0000 Received: from DM4PR11MB6502.namprd11.prod.outlook.com ([fe80::21e4:2d98:c498:2d7a]) by DM4PR11MB6502.namprd11.prod.outlook.com ([fe80::21e4:2d98:c498:2d7a%7]) with mapi id 15.20.7875.019; Mon, 19 Aug 2024 09:36:50 +0000 Message-ID: <26773a01-1d29-4d6e-a5c0-4c854c3d43f5@intel.com> Date: Mon, 19 Aug 2024 11:36:44 +0200 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 1/2] usertools/cpu_layout: update coding style To: Robin Jarry , CC: References: Content-Language: en-US From: "Burakov, Anatoly" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: DU2PR04CA0275.eurprd04.prod.outlook.com (2603:10a6:10:28c::10) To DM4PR11MB6502.namprd11.prod.outlook.com (2603:10b6:8:89::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB6502:EE_|DS0PR11MB7312:EE_ X-MS-Office365-Filtering-Correlation-Id: 18416d78-1573-43d6-739e-08dcc0327397 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?utf-8?B?cG5IeVZZRTQ2S0VXTGN3M2ZnUmhqdy9ZU0oxS0pqb2lHemg4WmFuaC9KVW0z?= =?utf-8?B?NnRjbXNRaWROSlhhTmRzM2prYmFTVzladVFpWlFjdFRIWTl2bitIMnZid3VX?= =?utf-8?B?WmhzQjVFQUtwWFF2d2dmZzIrb0ZRV2cwcmloSGJ2Sm9xNDBEMU1YdSsvWDFv?= =?utf-8?B?ME14YkJ6NlVubkxmNGdLZ3FUeXpzU1BiVzR1UGg0b3hTRW4zYU94T0p4V29x?= =?utf-8?B?VmFha0g4aFoybTlZY1QxUGRMQUh3Y1FTUV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4eG1IbUo5aVA3bnVZWVhlZzZRNmpUamZOcllxN2lQKzk3?= =?utf-8?B?YzZyT1pJb3NjOGtPZWxSVnN4VnJxU1FHOWVQUkRpa0VxWCtkQmhnZE1ZbHYr?= =?utf-8?B?WFBzU2V5T3V0RGcvbGVUbldNSk15V0hINGRCOGJXU3N1TnJUdUVGVVZMZWdt?= =?utf-8?B?bDExdmFQait6NjJKZkNSblh0MWptVGxPdzR4bVh1SUVFMlFBMWxHWDhPcm1w?= =?utf-8?B?Rm4ra3NFOFFzNXk2blc2bjVoZlRWWnFzZ1ZFTENBM3RWdWdxWmtDcDY0MGRr?= =?utf-8?B?RnBhc3VWNjI0L1VnUzhXbUY1am4wN2pGQWdEK2VTWDVCRWRpdHRoN1dEdU13?= =?utf-8?B?YzJuRTlFWGEwV1k2Ylp5L0RqMjk5d0pkaUZwbkx2VWVRaFZhd2czeTl0Skkw?= =?utf-8?B?aGFFck5oMk53angyMWFVbWFmYmNaVGptekVDc1NUWWdteitXTFpNekVTTTY5?= =?utf-8?B?NHBWMnlJVzFBREFBMnowK0tnZU1vcWp6cFJaNE5rMG55ZHVsUlJ0S1pLeHRB?= =?utf-8?B?em5VMkV3amc2TFRWTVlPVWZmYS9kd1VEa3dDMVNLWHkrTmk0d1NXSlRXK3dj?= =?utf-8?B?Zmt3ditRV2Y0WGp3U1U5d2NnRU5wTkZPUEpzYmY3TTZTYnZPSVREL095aXVk?= =?utf-8?B?SEtsUDBXcGNrY3d4VERnQT09?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB6502.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TEFlbEN4aUpOdW9PMU9BT1VzTS9rcVFadGxNeVBOemlJQ2YxS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a3huRXZQSFZpUER2aFhESVZWemloTUcrc2lY?= =?utf-8?B?djdnOTBUTGlLQlpMQUxzS0J5RjhvS1JaNkloeGZ4WlNnS2JiM3lJY3ZicU8x?= =?utf-8?B?R0V4c3A0UmVDSkoya2VlUHZBRFAwNkN6OXd5bU1QSmVKY240STlLUHdjdkpm?= =?utf-8?B?SnlObDdTUmgvclZ5NEl4VVNHdjlSSGdNSjZkUWRka2xKcyt3OXJnM0p3RCtE?= =?utf-8?B?eWh3T1lRTm44VlJib1JCelNCdzhOWVRsUm1rdU8xYkl6c25NR2UzK0FoZ28v?= =?utf-8?B?Wm91bVI4UmxEcnFMUUphKzhvbmlyenBuVDRwYkdMelJOUFBjWFBTajFWc2FX?= =?utf-8?B?SlE9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 18416d78-1573-43d6-739e-08dcc0327397 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB6502.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2024 09:36:50.1286 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vg42A7xKVxJ7djd2oqdMIR3tY9MJ25yQxiYeC+C6+AxiIaD7mPFxs6fQJB8M0WkziI2QCl0V0sTViO35QU80aKuSmTcCZ+QTwGrKtt9hO/c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB7312 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 8/19/2024 11:26 AM, Robin Jarry wrote: > Anatoly Burakov, Aug 14, 2024 at 13:19: >> Update coding style: >> >> - make it PEP-484 compliant >> - address all flake8, mypy etc. warnings >> - use f-strings in place of old-style string interpolation >> - refactor printing to make the code more readable >> >> Signed-off-by: Anatoly Burakov >> --- > > Hi Anatoly, > > thanks for the patch. Did you format the code using black/ruff? I'd like > to start keeping python code formatting consistent across user tools. I don't think I did any formatting with a specific tool. Rather, my IDE had flake8 set up to give me warnings if there are issues with formatting, and it also does formatting, so this would effectively be the same thing. Judging by description of Ruff, it sounds like something I should try out, so thanks for the suggestion. > >>  usertools/cpu_layout.py | 162 ++++++++++++++++++++++++++-------------- >>  1 file changed, 104 insertions(+), 58 deletions(-) >> >> diff --git a/usertools/cpu_layout.py b/usertools/cpu_layout.py >> index 891b9238fa..843b29a134 100755 >> --- a/usertools/cpu_layout.py >> +++ b/usertools/cpu_layout.py >> @@ -3,62 +3,108 @@ >>  # Copyright(c) 2010-2014 Intel Corporation >>  # Copyright(c) 2017 Cavium, Inc. All rights reserved. >> >> -output = " ".ljust(max_core_id_len + len('Core ')) >> -for s in sockets: >> -    output += " --------".ljust(max_core_map_len) >> -    output += " " >> -print(output) >> - >> -for c in cores: >> -    output = "Core %s" % str(c).ljust(max_core_id_len) >> -    for s in sockets: >> -        if (s, c) in core_map: >> -            output += " " + str(core_map[(s, >> c)]).ljust(max_core_map_len) >> +from typing import List, Set, Dict, Tuple >> + >> + >> +def _range_expand(rstr: str) -> List[int]: > > I don't see any reason to prefix the symbols with an underscore in this > script. It will not be used as an importable library. In the general case I prefer not to make such assumptions, but in this particular case I think it's a safe assumption to make. -- Thanks, Anatoly