From patchwork Wed Dec 17 02:27:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 945 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765938534; bh=NA/V5skG8kkfNuOGeDGGC2Yu5/MjM46iEaBUS/wCmn4=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=IZSYiF4LxPg3KkWMrXZziG3ZISfJGj7wN7GQP/k7ovRdg8OC61D611xJxqEOnXXQM O1BVoOues1qbUhEdr4GmWCMFga1GkpmOcuJpFXfxVroWmwu6m2KCtrw6asjcJo8xkH mEeZK/dwhQT63FVYWQAM0aXj5oWjVhivdcOQ6zd/yXovJr/nRC/vorGIvX3m7ZXlfs 7w3cNYgPJqjsmBI9J3K2Z7fCi+wlonf1jvo04XB2IeLnA/5IoMDmFhxODUv5v6TMTD V2XYK2lzd/VnNyGU3BJdhBn4xx3z54R/UkT7rABTBTSYBenc/itiAd216hRPpkqBl9 ZSUXSGEsz9tGA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4F99468BB8 for ; Tue, 16 Dec 2025 19:28:54 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id UuWqrow2GbdN for ; Tue, 16 Dec 2025 19:28:54 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765938534; bh=NA/V5skG8kkfNuOGeDGGC2Yu5/MjM46iEaBUS/wCmn4=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=IZSYiF4LxPg3KkWMrXZziG3ZISfJGj7wN7GQP/k7ovRdg8OC61D611xJxqEOnXXQM O1BVoOues1qbUhEdr4GmWCMFga1GkpmOcuJpFXfxVroWmwu6m2KCtrw6asjcJo8xkH mEeZK/dwhQT63FVYWQAM0aXj5oWjVhivdcOQ6zd/yXovJr/nRC/vorGIvX3m7ZXlfs 7w3cNYgPJqjsmBI9J3K2Z7fCi+wlonf1jvo04XB2IeLnA/5IoMDmFhxODUv5v6TMTD V2XYK2lzd/VnNyGU3BJdhBn4xx3z54R/UkT7rABTBTSYBenc/itiAd216hRPpkqBl9 ZSUXSGEsz9tGA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3E67768AEE for ; Tue, 16 Dec 2025 19:28:54 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765938532; bh=kk7BNNqU+zrrL/LVX6+rZKnWliFINwuCm/kyRAxmoKo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=azOv/GZAd4pzsR3axZMhYsChFqD9irSY4x4sEfIFC3QW2z9fZR9I3RrTqactmLW5n TH0ulC8IVyv02TGRvK+hGYksDHeHzsQiog3g7xoNEhMeNKOHNpAtkXmsuD0EO1VO+n bykpc4riCJWNTECO6Bog8HK6a+8TMFvH7GcaF8nB9V0eB/J9x+BR6xNcTeuz+9P2QK uuj7hOb5tcR1kGsKZ3m1np/3dBlWmdoxoqDpJWWmZhW19kF6dGbWuzLGyg1fGf9utm VZ6Z7kpyB1yFiyWY0Yjg/pfHGt6MvLXCTSlHXBwmIcishWsYcCRimjuST6uTqVBaiR j9XF2YY8WcVYQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2470468AFF; Tue, 16 Dec 2025 19:28:52 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id hekp4Q08mDSd; Tue, 16 Dec 2025 19:28:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765938527; bh=z35H+3PqpD63SShK1qcjxJ9+lmDtuV5k6fwbHzAodow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H7QIdvoBfMjtFXv0TrbZAxbmXDB1KYG6Zg5omB8RMvXDM08lzxYoTLYB8TOQ309Kh NaECQhNUPEhJWOvoHeH5lQ7GkBMrcfVh5qJwSGLN2yMznr+jOtq3QpPrAeHG5l+BJd gikJ51t5TBo1s85eAD8KgkATYFLMIN1lj3yPXwvXXXRatkxl9+diw5qwI06U9ZxMDW LKU3V4/mTcXIKS2JhV2bOJNu1WWneIG405KhVIyrBL2tpQfyq+D+t6I3gB3Zg4+XDC uR8IJ2ozuhK7PXYic60bXPPFkLaf4IDZa3wgV/na4zMdop4un4CyCtVjvLC6xyQMQ3 PMhVFWKBcSZxQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A62896884F; Tue, 16 Dec 2025 19:28:47 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 16 Dec 2025 19:27:51 -0700 Message-ID: <20251217022823.392557-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251217022823.392557-1-sjg@u-boot.org> References: <20251217022823.392557-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: SR2KDERIVVT3BDWOO3ZHXBX6UFR3W6ID X-Message-ID-Hash: SR2KDERIVVT3BDWOO3ZHXBX6UFR3W6ID X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/24] pickman: Move imports to top of control.py List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Move datetime, re, and time imports from inside functions to the top of the file, following Python style guidelines. Also fix a few pylint warnings while here. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- tools/pickman/control.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/tools/pickman/control.py b/tools/pickman/control.py index 96b014dfeca..0353bae9350 100644 --- a/tools/pickman/control.py +++ b/tools/pickman/control.py @@ -6,8 +6,11 @@ """Control module for pickman - handles the main logic.""" from collections import namedtuple +from datetime import date import os +import re import sys +import time import unittest # Allow 'from pickman import xxx' to work via symlink @@ -61,9 +64,9 @@ def compare_branches(master, source): # Get details about the merge-base commit info = run_git(['log', '-1', '--format=%H%n%h%n%s%n%ci', base]) - full_hash, short_hash, subject, date = info.split('\n') + full_hash, short_hash, subject, commit_date = info.split('\n') - return count, Commit(full_hash, short_hash, subject, date) + return count, Commit(full_hash, short_hash, subject, commit_date) def do_add_source(args, dbs): @@ -242,8 +245,6 @@ def format_history_summary(source, commits, branch_name): Returns: str: Formatted summary text """ - from datetime import date - commit_list = '\n'.join( f'- {c.short_hash} {c.subject}' for c in commits @@ -266,9 +267,6 @@ def write_history(source, commits, branch_name, conversation_log): branch_name (str): Name of the cherry-pick branch conversation_log (str): The agent's conversation output """ - import os - import re - summary = format_history_summary(source, commits, branch_name) entry = f"""{summary} @@ -522,8 +520,6 @@ def parse_mr_description(description): Returns: tuple: (source_branch, last_commit_hash) or (None, None) if not parseable """ - import re - # Extract source branch from "## date: source_branch" line source_match = re.search(r'^## [^:]+: (.+)$', description, re.MULTILINE) if not source_match: @@ -664,8 +660,6 @@ def do_poll(args, dbs): Returns: int: 0 on success (never returns unless interrupted) """ - import time - interval = args.interval tout.info(f'Polling every {interval} seconds (Ctrl+C to stop)...') tout.info('')