From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 660BA3ACF14 for ; Mon, 9 Mar 2026 16:56:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773075368; cv=none; b=MDvLZA0pJ/oD8DcwgaANlMNcVSdFfFjRa4wZG4c1VU+hRhnfy5l0Kq+HHh5Hg/+eG9xnV2y0GUEEPaeb/PAPFl8cR0C1DPZdhHwD0DIWN2d570YKpi2ExCl3OvaIJjaCRgl6HVjuNyCvEAFNNE3VPWW+r1/XbX3UIzajUngsTqg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773075368; c=relaxed/simple; bh=dRr8SStoRZls3+slMxETe+hGVnNj1UNyuU2pUvKsvis=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=Tcvx0Jy9s2G5Ynp+cmcgnLPQc/s3FUv+88/lCYvPep8wxYXf1J04YTYrTsEWmmJS81StHJLlm35Kf5PRoHRe2+eLuaVIcdieIhSW7azrGiI+iCia91cs3jpUGlUM3gXF0v/NF4eNdhcc8GjNSJNMERnaN3vP6MGxwmAM6SD5Vsw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=G3TdOvOM; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="G3TdOvOM" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2ae4988e039so57561385ad.1 for ; Mon, 09 Mar 2026 09:56:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773075367; x=1773680167; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:references:cc:to:subject:from :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=+kcfZXOS73GCcH3OQqmXVNvwNk/1zURgtKz5sokOakQ=; b=G3TdOvOMBOO9IMb75DvaeRqGHFiORKg2+AC8s6TPkGncvvcugtZ547hzY/23Y4GQib Vqny4VUqxr5ZY0LPw9YnmHeWehZfxI3Q7yNZ+rdEwJzjqetHlel0lLzP3oRzWU9z1oak zYucuX4SrJM9ssslfoaEZz/vWRGPMDLcEqByZRO0mKb95gVLzcwLVljJqJLYJYPnHXWq RhMkjo+oqQWSfdCWgmRykQGvR9W+JCWtyUHGt8oP7Bz+/V+vScTbO9D9+z+GN2cxvbpR WYWC8WVjy+1KBaHIoQz8SbV4K3eA7NqBNMvsypMeKte/6BHjv4syMuY6GXK7X+CY+x6s pVlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773075367; x=1773680167; h=content-transfer-encoding:in-reply-to:references:cc:to:subject:from :user-agent:mime-version:date:message-id:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+kcfZXOS73GCcH3OQqmXVNvwNk/1zURgtKz5sokOakQ=; b=ph03AUeuw3FQqCgOouT6/BiKG5w2p5Z69TPehf/9tlrEXbjcle5CZmNvxwXSnEgZtC Xt6NJUzS+8MC3ATyy52RzY8n+2kPBB9W/pEloTZVE8jYbtP0DFQraU4hLCSxRZ9WXrBd vWH7Sxxp+zaCgCQDq7LKlAZEupJ/3PNOmqc2xqtpPiJ0gP79i5fVTq3ZnXainosvZnU5 dcE4Q9BrLayYwjsfb+ngCykxJxuBVHFvYTivQQWnROLdyh8/EeWjnBphQWvTDVkWcRQu a6psC+afiZ44LI7QvBWcYh4i17EiiyLJxJ9mAyuHWJAohwCPuS6fIA7O6zQg9RjY+b4W 1JgQ== X-Forwarded-Encrypted: i=1; AJvYcCWcj2ODPwz+OUTHj0+GELDbzjICFsiaBOj/2lK/jBBP6NGd2AEGJKu885vnq2xRSErVZrj4Y3mWhH77sEU=@vger.kernel.org X-Gm-Message-State: AOJu0YwUl4nvMFFj+T2f4Z65+c94uOa9sYHUWPqmbKS3ZI8xzdRIHmN+ AHQJi43MIhtm2I5L85Vm9Hgy926Mu/3ctnvF9mexjLOuOyOSgymAr2KwK4HqBOoAt1UDGnJK X-Gm-Gg: ATEYQzyupC+XsZwoLi9xIKE4eo1n/lBrgnMrw3IuddSRKT5KKCa96VSnzVxei1p7Css 3X5zhJ7jEbkmGgap7+pLz9MYvsJCgy/rlLRiff1do1iiwNUavs4gKfdDOjwMRukgIocMBVd4C8U eYZtTBo60wUWjs9tsflBI3Kx8e/ucQAi1fUNsGLGrfljWSlGwkH1ZJxgh7Gl76K/Z41xGAv453O mSX0T38ZFrhfuGeooZtSZZW9u9e7Om/k5pIbXUCDqWimdGf798nZ7jXXH8TdAvuldWgkjwjFkUE CQaaamfN7IZvlxhcpDkmpNsfOTi1XfuILtlOqhSQ0pYYIxSwiRXVj8F2Mb/aKFVeSscN84UuSIK Iu+iNb0OYHBhy3usyh/rcMFDl/hZjhhLu86pNUhqSH1tY/Rdpc5qh9FtjP4aCsXu6ixRGJPKUrX UCEvbc+tf2JKSpS3uM0JHfkEsVL/s2TY7uCFZmNTuGuCRd3gsgCel5DXZ2hQ== X-Received: by 2002:a17:903:37cc:b0:2a7:5f26:aaf9 with SMTP id d9443c01a7336-2aea1de8092mr2161755ad.14.1773075366517; Mon, 09 Mar 2026 09:56:06 -0700 (PDT) Received: from [10.79.58.83] (wf121-083.ust.hk. [175.159.121.83]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ae83e57b09sm155892475ad.4.2026.03.09.09.56.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Mar 2026 09:56:06 -0700 (PDT) Message-ID: Date: Tue, 10 Mar 2026 00:56:04 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Haoyang Liu Subject: Re: [PATCH v2] tools/docs/checktransupdate.py: fix all issues reported by pylint To: Jonathan Corbet , Shuah Khan , Mauro Carvalho Chehab , Dongliang Mu , Yanteng Si Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260308104135.9037-1-tttturtleruss@gmail.com> <20260309074716.10739-1-tttturtleruss@gmail.com> <87cy1dxaka.fsf@trenco.lwn.net> In-Reply-To: <87cy1dxaka.fsf@trenco.lwn.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 3/9/2026 11:54 PM, Jonathan Corbet wrote: > Haoyang LIU writes: > >> This patch fixes all issues reported by pylint, including: >> 1. Format issue in logging. >> 2. Variable name style issue. > I'm somewhat unconvinced about that second change. We haven't come up > with a coding style for Python code in the kernel, but I think we do > want it to look at least a bit like kernel code and not just defer all > decisions to tools like pylint. I'm not really opposed to this change > either, mind you, but the process of getting there worries me a bit. Dear Jon, My initial thought was that 'HASH' looks like a global-style constant, while it's actually a local variable. However, the lowercase 'hash' has conflict with python built-in hash function, so I renamed it to hash_re to indicate that it's a regular expression. > >> Fixes: 63e96ce050e5 ("scripts: fix all issues reported by pylint") >> Signed-off-by: Haoyang LIU >> --- >> V1 -> V2: fix variable name style name and keep the format consistent with other logging format >> >> tools/docs/checktransupdate.py | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/tools/docs/checktransupdate.py b/tools/docs/checktransupdate.py >> index e894652369a5..cc07cda667fc 100755 >> --- a/tools/docs/checktransupdate.py >> +++ b/tools/docs/checktransupdate.py >> @@ -76,11 +76,11 @@ def get_origin_from_trans_smartly(origin_path, t_from_head): >> (2) Update the translation through commit HASH (TITLE) >> """ >> # catch flag for 12-bit commit hash >> - HASH = r'([0-9a-f]{12})' >> + hash_re = r'([0-9a-f]{12})' >> # pattern 1: contains "update to commit HASH" >> - pat_update_to = re.compile(rf'update to commit {HASH}') >> + pat_update_to = re.compile(rf'update to commit {hash_re}') >> # pattern 2: contains "Update the translation through commit HASH" >> - pat_update_translation = re.compile(rf'Update the translation through commit {HASH}') >> + pat_update_translation = re.compile(rf'Update the translation through commit {hash_re}') >> >> origin_commit_hash = None >> for line in t_from_head["message"]: >> @@ -131,7 +131,7 @@ def check_per_file(file_path): >> opath = get_origin_path(file_path) >> >> if not os.path.isfile(opath): >> - logging.error("Cannot find the origin path for {file_path}") >> + logging.error("Cannot find the origin path for %s", file_path) > Why was this change made? The first time around, you'd simply added the > obviously missing "f", which seems better? I used the "%s" style mainly to keep the logging format consistent with the other logging statements in this file, which follow the same pattern. To me, using f-string or lazy format. Sincerely, Haoyang > > Thanks, > > jon