From patchwork Fri Nov 8 12:31:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamir Duberstein X-Patchwork-Id: 13868113 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A3551E47DD for ; Fri, 8 Nov 2024 12:32:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731069148; cv=none; b=TUvi8uB1EkDIIA/6Wv4ARvvRQsW/klRakIkPM6hPmfSH24DcaRpgNfrRACIvqF6XTTECsAJgEB9FA8JMeW6E+u1E+ARCPKBTej1dRKrt2Csdog/O5XJn++678i1GotOFI+US5F2+q/PyPviCcf8XEfYFwp9OfKKkZ6xPVl/Q7N0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731069148; c=relaxed/simple; bh=TiOmfjWkD9eZWure12ije876wWJquasB4D9SrLpkFJo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SgPeDn9LIShQEePSE2ebHHU8Snp+3ow5s11GsNT4vKIDImDuk+rubFUAXmB92dlVYbI/ETadlBFOy2+qPpLCLJtqdr/QsoLEy+YhTrsecXhjFr5xWdmAoG4MrDqu0qnahxcdKqvTeLlbDtVIaRib8zHgbZDl4wup9ulFaQgJW/g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OYLEe3E9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OYLEe3E9" Received: by smtp.kernel.org (Postfix) id E0AAAC4CECD; Fri, 8 Nov 2024 12:32:25 +0000 (UTC) Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id D05F2C4CED2 for ; Fri, 8 Nov 2024 12:32:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org D05F2C4CED2 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qv1-f50.google.com with SMTP id 6a1803df08f44-6cbd550b648so13334686d6.0 for ; Fri, 08 Nov 2024 04:32:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731069144; x=1731673944; darn=kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=W/XeZdsSRz+OxEf9GE2OFP7ZbIH3O55iQETRJ/i/gpc=; b=OYLEe3E9t2AeHtwJBivSApz80QIQs1L8wd/bUEggGE2Bl1yZL4efcXkMSBMfGnujQ4 Tie03bcK9p6b3vpFFkUnCg1Kcqhqfg+dlRlVL90jgDJi+sf8CXo6Qajvh2hGp/yOWRhZ IA+/5X7QG8cKwstzConGDrwQwZRQaRoCppPBeXs0cLvbAyGCtQEKPeYBvieruba3M3/S aFxaAzYzB2DJn0fPfl8FFCJa2AZcPzU+gy+e3EAhjWobLQx0ACZ3O59vfDoQUQHM9t92 xYFBSfIojtY7hNrUJoh9APuk+mPWJv2PBSEV+VUM/4OB+k3aSPH6N7Fjr0Y0J5cv9LgC K3Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731069144; x=1731673944; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W/XeZdsSRz+OxEf9GE2OFP7ZbIH3O55iQETRJ/i/gpc=; b=VEqwVpjr0pLX8Yo6jzhq99DfoIWPXYC7rRuIol+E44TF3EqeQQxEFAYl9OTajJyXja Zd7QRBhZUM+qHlfECcOvGXl7AeQ2YHeLDfEW03HJgNVUDXqR/m1g8QkGdHVjx8As/2AY T2K1dEfDPQnZvFNdM8Nmoa0Rd8gw93JS9IbJQsaPTO32XNXvMlGBtDXUFK6iELfM8Ibb iPCO9MXWlvpG1Xsyflaxj4bfilPmK6O6/sRVqi32hHHttoU7ezvWKfMZ/BpwCIPHAYd8 Q4A3t5GMuCEO89uKozGmgA+ORF4JE44V7wDjBOhX3qLq16GGl8JRMZhaDxKct9errh0Z 3eww== X-Gm-Message-State: AOJu0YzhjmstcoVZh0GS3dB0F2x61YsfyW+OzK52dCv+3Espudk06ayB VxsoR9ll1GKSt85wHevdVUwS/g4oUNBnb/vb1EJ4zq0AdteVAAK5SuN+9Vf1 X-Google-Smtp-Source: AGHT+IHVxa/p7XMNWkpfCEqrU3STpZ9Q156j3b+Q21YNTVCvX/bNtx/pkFyw702IP/f6CPsk5Ywddg== X-Received: by 2002:a05:6214:3207:b0:6cb:faee:76d7 with SMTP id 6a1803df08f44-6d39e12afeamr29697076d6.18.1731069143731; Fri, 08 Nov 2024 04:32:23 -0800 (PST) Received: from 159.1.168.192.in-addr.arpa ([2600:4041:5be7:7c00:348d:4cbf:ba75:f557]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6d3961ef48csm18633436d6.35.2024.11.08.04.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 04:32:23 -0800 (PST) From: Tamir Duberstein Date: Fri, 08 Nov 2024 07:31:28 -0500 Subject: [PATCH RESEND b4 1/5] Add development dependencies Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241108-better-type-annotations-v1-1-ebaf0129d9e1@gmail.com> References: <20241108-better-type-annotations-v1-0-ebaf0129d9e1@gmail.com> In-Reply-To: <20241108-better-type-annotations-v1-0-ebaf0129d9e1@gmail.com> To: "Kernel.org Tools" Cc: Konstantin Ryabitsev , Tamir Duberstein X-Mailer: b4 0.15-dev Signed-off-by: Tamir Duberstein --- pyproject.toml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 31bfe3033650b2b251fcdcbab0456f4a67e914df..7c65c30efdb95fa40cc1f22933bcd62073db4f26 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,13 @@ classifiers = [ "Topic :: Software Development", "Topic :: Utilities", ] -dynamic = ["dependencies", "optional-dependencies"] +dynamic = ["dependencies"] + +[project.optional-dependencies] +dev = [ + "pytest", + "types-requests", +] [tool.setuptools.dynamic] dependencies = { file = ["requirements.in"] } From patchwork Fri Nov 8 12:31:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamir Duberstein X-Patchwork-Id: 13868115 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1E6E1E47D9 for ; Fri, 8 Nov 2024 12:32:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731069149; cv=none; b=m3j4mMy89SUFdaF/ihBJMNvBTz1Z8TXPu3AOv/SdbJPI9IurY38ZxbRrPMcZ0fgjANYO11ZSyVj2zcOvKStsLGRIyW+cg5LcnwlHZpSTKM9YlGYRbannpT6yH2gqAgP44jEyrQp38PeStar5+ZRgvARdUGUWTlJnf530MbGSAII= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731069149; c=relaxed/simple; bh=0awfLOppbvGuE+SGvpO55DBynubQv/bhicz7ZPCvabI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UwsH8EK94RIt4t4/tjL6kCcdrA2IcnO8U00HJcg8R0RAIEUsvMIoXn7tiV+efZIoS6KVi4uS1wGq2do0Cyrm+pr0aQos8YWNBreoGq9jWYB3LdTJsn6vuPoaw5DTFAQpwZbqn+oHXDGC9JTx8nv/76M7DxTrDn1e0SxY72UoWLw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EwahPP6X; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EwahPP6X" Received: by smtp.kernel.org (Postfix) id 5CC78C4CED7; Fri, 8 Nov 2024 12:32:29 +0000 (UTC) Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 3C3DEC4CED2 for ; Fri, 8 Nov 2024 12:32:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 3C3DEC4CED2 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-7b15d7b7a32so144867485a.1 for ; Fri, 08 Nov 2024 04:32:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731069146; x=1731673946; darn=kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=B4umdQaNw/jPh7Bv7a/9BIO1YLuzyeQcqvgA2Fg0Q7A=; b=EwahPP6Xq5glHp1qOnmyYOhouj7RwxYeSdQ1oog9gqRkzIzFy0GDzpdiSBK4+X/Mt1 BO5enaRk/N0sGtib21cCOEH+7ZIPin0ICsRBLUXE9pufdM3b3eXRbsLaGfgZOdDF05bJ 4iVlmzGuhk0VP+u5HWlJUDOcMKvNFEz6/vsSWp3ZLRMYQ9RpZKM1c74WNuoUahVFModD kXFFAlBacGcQiFgaNhR/La+VnFkSZQhlxWQx8dXvw8e8QToVhkuvRUympbxbpRHYj/XE TLLoDgzNzkNLHPCvF21zmHHWP8WGLSlMMIYSXFW5BfrPdzIIER25NXITKIN1ZAKEc1tp CC3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731069146; x=1731673946; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B4umdQaNw/jPh7Bv7a/9BIO1YLuzyeQcqvgA2Fg0Q7A=; b=oHkVl9ThyP0zRsoB+CcrS69pwdj/8FTwOzlTB06MBcZJuNZuj/SUhEt/D4yIT8c70Q R6CeUooFs4drHsj05WIIsCeKtdyBtyJx7GWuuo9YowAsXJ+PCqgwezzcD461fsvtrpSn 3D65IrGc7Hhc3GEwmKg47pW3Bxe2N8SBbZyVVBEKNYmBW2Y4JklNCU7Gdo8TmgsTp4Pz VpB7ZV/RX1bC5VTiHIUAufqPgYmLP00AJ6EhDXGgclzBIxpmVNylULHaHD32wfBBSWCB Hyj6WXPksgH4ROHvSjCSwJNOE0hQYL01nN+DqtdRopiqfxDgTfD1SjMRe2wKbbqvi7hw A5FQ== X-Gm-Message-State: AOJu0YyI0E5vPTlrj+foP9Q+ZCRvzwMNbms1hU7PL15/q6weuVyNJiRu MEao6BIDE0uOVH7py3CBuxJpxxvBimlkp9OeAcPEMP0V2gZHHJto X-Google-Smtp-Source: AGHT+IFvyqRjmRvvoC+zcZXGOuh9xs+7/vSs5HBru1VbyPu5rWy/J9QkHg+rc+rqIo9cCPlg8Df7NQ== X-Received: by 2002:a05:6214:54c4:b0:6d3:5265:608c with SMTP id 6a1803df08f44-6d39e1077e3mr26328736d6.3.1731069144747; Fri, 08 Nov 2024 04:32:24 -0800 (PST) Received: from 159.1.168.192.in-addr.arpa ([2600:4041:5be7:7c00:348d:4cbf:ba75:f557]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6d3961ef48csm18633436d6.35.2024.11.08.04.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 04:32:24 -0800 (PST) From: Tamir Duberstein Date: Fri, 08 Nov 2024 07:31:29 -0500 Subject: [PATCH RESEND b4 2/5] Avoid file descriptor leak Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241108-better-type-annotations-v1-2-ebaf0129d9e1@gmail.com> References: <20241108-better-type-annotations-v1-0-ebaf0129d9e1@gmail.com> In-Reply-To: <20241108-better-type-annotations-v1-0-ebaf0129d9e1@gmail.com> To: "Kernel.org Tools" Cc: Konstantin Ryabitsev , Tamir Duberstein X-Mailer: b4 0.15-dev Signed-off-by: Tamir Duberstein --- src/b4/diff.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/b4/diff.py b/src/b4/diff.py index 63e60f2fc82c95145a897c2dd319283996ed5a8a..743127ef0a1922eace81686e27cd0366f8e42f9c 100644 --- a/src/b4/diff.py +++ b/src/b4/diff.py @@ -174,8 +174,8 @@ def main(cmdargs: argparse.Namespace) -> None: sys.exit(1) if cmdargs.outdiff is not None: logger.info('Writing %s', cmdargs.outdiff) - fh = open(cmdargs.outdiff, 'w') + with open(cmdargs.outdiff, 'w') as fh: + fh.write(rdiff) else: logger.info('---') - fh = sys.stdout - fh.write(rdiff) + sys.stdout.write(rdiff) From patchwork Fri Nov 8 12:31:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamir Duberstein X-Patchwork-Id: 13868114 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D37B71E0DD4 for ; Fri, 8 Nov 2024 12:32:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731069148; cv=none; b=sjd+ud7jtfbGVXJ3mGq2OUHXFwM7I2/ZoiU/0ywm0f4MIOrFWtQU/lbNcoIXAmS0+L8tlHewW/xEi20atD5xqd3dk72lknObj+KdOh3pRJkyo4pIVDcAC1pU+1xKVSGmrHt4LqlSs/2vcUVIeYfCHiDVT0OkxNabL+cIk/tMyV8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731069148; c=relaxed/simple; bh=UB6+NU0zjWNy22qO17xSh0+R5N6XJGd0dqy7BjoW/jo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hDPER2fJkWpGCdUiFgoSIpLcHQ99U59aMNplXZS5NMukoFAdIEPHfY7aoeNuJsK6zASu6jepuweYnInyi+YOLdjnKlgbl4Xzc85+05TlyAYryoTT2Zof8cVXdv0giFftBzqn2YumVC4tkUkV+hpyT5KCzz2Sh8PxBWHzSw+wC0s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EJ/M0Sfn; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EJ/M0Sfn" Received: by smtp.kernel.org (Postfix) id 7DD6CC4CECD; Fri, 8 Nov 2024 12:32:28 +0000 (UTC) Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id A35C9C4CECE for ; Fri, 8 Nov 2024 12:32:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org A35C9C4CECE Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qt1-f171.google.com with SMTP id d75a77b69052e-460c316fc37so12756311cf.0 for ; Fri, 08 Nov 2024 04:32:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731069145; x=1731673945; darn=kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=/xIC8jetZuQkib4/cH2P0adTxMOjpEaikUwAnzYKLPA=; b=EJ/M0SfnxIOeDZtCH8JhUre4sbSGAZmDkteu4nsGfoH69atFATap4cjfQdXyB2lZDF vk2PE9Q5Fhturho6fFHKMlTsqn7V7HUdhGhC0llBjG9ngnmH6p01F0p4XoIgJ5z51Xl9 uQ4YkVIxwvmK8uXsYHmLQJjV0mNKlw8TzchoPqSx7h5S1tdIJWiXROI1Rd9gLKKrayDS 0PJUafoF1TlDDcyKQ6Jgk+q621XNTrLz2fvXJy4WFg8RutDUQDrG2SMyUTNvJPePmFTq zxD2R8B/XErh/GnyO66QyBOMTy48qCoywuAZdMUoeifY4ndRoy6eGdWNMd+wIywISFis s37A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731069145; x=1731673945; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/xIC8jetZuQkib4/cH2P0adTxMOjpEaikUwAnzYKLPA=; b=SJQ0vE/73CyEYG+Kw0OkQiVSwGJ4DTKVbt2c22AAdrW1UQZ6rXOLuffvZz3dYck9L9 zkL5Z79o0COKaxMkMpXcrQ7keL0ZvQwguVuBKdu9NDEBnCK7AIld5bJUq5VBUMg6qfp7 dvE4Hv9muOoBZIBDioXANt3w+3JPk/z2F06fLG+1N/HUhWLSW7X0tbsj50zQysi8ZVkY 2JHYENfSi7w8FQtUwa6sVOuGX0xChZ9guJU8PX37oCkMU458QIfku3/S/lN6KycCJVCn 7LN7YwvtpFboKBo50+S6+lB36nip8L9ndCNzuYJ935CfWxhXiq8h0tJ4meHBn70JvUWe TTBw== X-Gm-Message-State: AOJu0YwdFX7OG980thmhyaSL4MHRetqkextbZqQTjug3U0z5Doc3LVEC Tbn7wexli8IJYbU99h+7dQWw111SCEwAP5fLz3LL/zdvyNt7Bk6T8R3/KT7r X-Google-Smtp-Source: AGHT+IHSF9bOrQAPRMth1GZ/4N9+S9yp8w7Kyjxt0b8i3qOt8HnQ3Adp/k9nBgyd1nmrTnhniIEEOQ== X-Received: by 2002:a0c:f207:0:b0:6cc:b4:5dcb with SMTP id 6a1803df08f44-6d39e1f49e6mr29509196d6.47.1731069145521; Fri, 08 Nov 2024 04:32:25 -0800 (PST) Received: from 159.1.168.192.in-addr.arpa ([2600:4041:5be7:7c00:348d:4cbf:ba75:f557]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6d3961ef48csm18633436d6.35.2024.11.08.04.32.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 04:32:25 -0800 (PST) From: Tamir Duberstein Date: Fri, 08 Nov 2024 07:31:30 -0500 Subject: [PATCH RESEND b4 3/5] Correctly type annotate generators Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241108-better-type-annotations-v1-3-ebaf0129d9e1@gmail.com> References: <20241108-better-type-annotations-v1-0-ebaf0129d9e1@gmail.com> In-Reply-To: <20241108-better-type-annotations-v1-0-ebaf0129d9e1@gmail.com> To: "Kernel.org Tools" Cc: Konstantin Ryabitsev , Tamir Duberstein X-Mailer: b4 0.15-dev Signed-off-by: Tamir Duberstein --- src/b4/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/b4/__init__.py b/src/b4/__init__.py index 5115a9cd9b8746f84eb104a2be69fe121724167e..d1f0fc5b56693d7d234bc4aced65166244928728 100644 --- a/src/b4/__init__.py +++ b/src/b4/__init__.py @@ -36,7 +36,7 @@ import requests from pathlib import Path from contextlib import contextmanager -from typing import Optional, Tuple, Set, List, BinaryIO, Union, Sequence, Literal, Iterator, Dict +from typing import Optional, Tuple, Set, List, BinaryIO, Union, Sequence, Literal, Iterator, Dict, overload from email import charset @@ -2758,7 +2758,7 @@ def git_get_repo_status(gitdir: Optional[str] = None, untracked: bool = False) - @contextmanager -def git_temp_worktree(gitdir: Optional[str] = None, commitish: Optional[str] = None) -> Optional[Iterator[Path]]: +def git_temp_worktree(gitdir: Optional[str] = None, commitish: Optional[str] = None) -> Generator[str]: """Context manager that creates a temporary work tree and chdirs into it. The worktree is deleted when the contex manager is closed. Taken from gj_tools.""" dfn = None @@ -2776,7 +2776,7 @@ def git_temp_worktree(gitdir: Optional[str] = None, commitish: Optional[str] = N @contextmanager -def git_temp_clone(gitdir: Optional[str] = None) -> Optional[Iterator[Path]]: +def git_temp_clone(gitdir: Optional[str] = None) -> Generator[str]: """Context manager that creates a temporary shared clone.""" if gitdir is None: topdir = git_get_toplevel() @@ -2794,7 +2794,7 @@ def git_temp_clone(gitdir: Optional[str] = None) -> Optional[Iterator[Path]]: @contextmanager -def in_directory(dirname: str) -> Iterator[bool]: +def in_directory(dirname: str) -> Generator[bool]: """Context manager that chdirs into a directory and restores the original directory when closed. Taken from gj_tools.""" cdir = os.getcwd() From patchwork Fri Nov 8 12:31:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamir Duberstein X-Patchwork-Id: 13868116 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D922F1E511 for ; Fri, 8 Nov 2024 12:32:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731069149; cv=none; b=WV7kNLy2GJBESkeSo9HdSGEatL18Kn1i9aeY6AIVWB8OvlA85779dNXDTS244Ou7IpRelBr2UGChnCkx+xrUVT+I5CkAqbLu3WIjhjAzLY++BjisFD9w4cKS1NJwWqnyyBibuCmzKXvuxfAYrqxdRRJFHbEs9/U3jbKBli4gKBQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731069149; c=relaxed/simple; bh=kJvsm9GhomDMOHJhodWW1GdnmVBa5bLPi5a48iHuxOA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=m6TiFqgOsa9ErRIx3zYRcwcykqJ7LCSGhdG8xEztYCj2wQrvolpOrX/nAKRjOzzbKCIkR49MAH+eVpWwr75U2dT6yZ1ZpIT9asl51Y4SUyNmtLWZbNoJx5Wa3QT/5Kd+wyjtbbu7vnQthHq2bWeVE/ruSgCKHaJGDztci4tbVnc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=f+3Y7aRv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="f+3Y7aRv" Received: by smtp.kernel.org (Postfix) id CBB1CC4CECD; Fri, 8 Nov 2024 12:32:29 +0000 (UTC) Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 9D297C4CED4 for ; Fri, 8 Nov 2024 12:32:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 9D297C4CED4 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qt1-f174.google.com with SMTP id d75a77b69052e-46096aadaf0so11964351cf.2 for ; Fri, 08 Nov 2024 04:32:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731069146; x=1731673946; darn=kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=wa6y9lNuzG8GTdrhCtWflcNFL1t1dxkimURS0BadncY=; b=f+3Y7aRv/5voLdXKpzkTXNxBB/6w5qbFCYVE66cA5kxtqsYN6HtTxTfg+mdsTJW675 mqwzH8O9EOMKSEatgpQSCo3wb9E1sqStvJHKL08chiarlPeXO+IMOolAtSMTIoA1A5+s EJb1tyOsGsXEX0elnKl+5ussJh+0cAvVbC1WCPApuR4iyeBbFJxh0ZyluCfHd2EAbvoV AQdZXCwJ68C8An4lFbU/2QxxbKZJlsYbfu7AgL7HgMabDS+PWtqB5lTeIJAu1AhtMxuo YcRwlMsjUGCNIjl23ACzr1yaGqOqGpFoyNY0B9rSKnQJHtMTH5sbbWYwVk/yckDbGh2o dkHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731069146; x=1731673946; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wa6y9lNuzG8GTdrhCtWflcNFL1t1dxkimURS0BadncY=; b=Sj0RMSkIr7QoRsAE7soO1tA+QGhQjVdxmVDLMgaxFqZh77oOTqIlKK3egR+JhxcLLP e1WtIKBH8fgLclOgJ+KLkLRB+P3imNMg2vVKkw33pUcpdj3CXJyHlaPTUxhmNNd/mcV4 BbjNy/grQlUKjEWTXuJuP82UAkbXV1B4KVJeYWCwrj4VWqvMxTyVl3PNnqAPVs1XcRjo NiUl/0NlWCqCcP40DK7Utc30Tem/wBnoSqXra5/9n5qLzpxjrYES1m6Sc3YmhC7Zpiiq aXNKFQ2Po4zHXq20MOvNvN0sh+oFkeUv3XAb/WPasqW+mkJVPeFt9/WrCP6KQA6C1mk8 vTZQ== X-Gm-Message-State: AOJu0Yzz95DHIiO04C0a7rt8r33r+dYQcP0V5gXtrnLbNFKadwK4pwUC AAOk9D+Woc/AiXp3wfkAP1cd+kEzp6XiMxIPCH9qZqezHn8iNbdgCjOklc9h X-Google-Smtp-Source: AGHT+IEklbiMXQw8NL/BvUDq+Pi79wI1Anz365bsL2skjorOPRbMc75gIHqBR8ThH9+Y7AqbkIewsA== X-Received: by 2002:a05:6214:3a84:b0:6cb:f195:22c7 with SMTP id 6a1803df08f44-6d39e19ff5dmr31204966d6.38.1731069146551; Fri, 08 Nov 2024 04:32:26 -0800 (PST) Received: from 159.1.168.192.in-addr.arpa ([2600:4041:5be7:7c00:348d:4cbf:ba75:f557]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6d3961ef48csm18633436d6.35.2024.11.08.04.32.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 04:32:25 -0800 (PST) From: Tamir Duberstein Date: Fri, 08 Nov 2024 07:31:31 -0500 Subject: [PATCH RESEND b4 4/5] Provide overloads for git_run_command Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241108-better-type-annotations-v1-4-ebaf0129d9e1@gmail.com> References: <20241108-better-type-annotations-v1-0-ebaf0129d9e1@gmail.com> In-Reply-To: <20241108-better-type-annotations-v1-0-ebaf0129d9e1@gmail.com> To: "Kernel.org Tools" Cc: Konstantin Ryabitsev , Tamir Duberstein X-Mailer: b4 0.15-dev This requires explicit use of kwargs to allow decode to be a required parameter in the negative case (which is necessary to disambiguate the overloads). Callers now know for certain whether they get str or bytes. Signed-off-by: Tamir Duberstein --- src/b4/__init__.py | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/b4/__init__.py b/src/b4/__init__.py index d1f0fc5b56693d7d234bc4aced65166244928728..e71fbe7d8ea8d4ca19228690ce7c186cc91b81ad 100644 --- a/src/b4/__init__.py +++ b/src/b4/__init__.py @@ -36,7 +36,7 @@ import requests from pathlib import Path from contextlib import contextmanager -from typing import Optional, Tuple, Set, List, BinaryIO, Union, Sequence, Literal, Iterator, Dict, overload +from typing import Optional, Tuple, Set, List, BinaryIO, Union, Sequence, Literal, Iterator, Dict, TypeVar, overload from email import charset @@ -2697,14 +2697,27 @@ def gpg_run_command(args: List[str], stdin: Optional[bytes] = None) -> Tuple[int return _run_command(cmdargs, stdin=stdin) +@overload +def git_run_command(gitdir: Optional[Union[str, Path]], args: List[str], stdin: Optional[bytes] = ..., + *, logstderr: bool = ..., decode: Literal[False], + rundir: Optional[str] = ...) -> Tuple[int, bytes]: + ... + + +@overload +def git_run_command(gitdir: Optional[Union[str, Path]], args: List[str], stdin: Optional[bytes] = ..., + *, logstderr: bool = ..., decode: Literal[True] = ..., + rundir: Optional[str] = ...) -> Tuple[int, str]: + ... + def git_run_command(gitdir: Optional[Union[str, Path]], args: List[str], stdin: Optional[bytes] = None, - logstderr: bool = False, decode: bool = True, + *, logstderr: bool = False, decode: bool = True, rundir: Optional[str] = None) -> Tuple[int, Union[str, bytes]]: cmdargs = ['git', '--no-pager'] if gitdir: if os.path.exists(os.path.join(gitdir, '.git')): gitdir = os.path.join(gitdir, '.git') - cmdargs += ['--git-dir', gitdir] + cmdargs += ['--git-dir', str(gitdir)] # counteract some potential local settings if args[0] == 'log': @@ -2714,16 +2727,18 @@ def git_run_command(gitdir: Optional[Union[str, Path]], args: List[str], stdin: ecode, out, err = _run_command(cmdargs, stdin=stdin, rundir=rundir) - if decode: - out = out.decode(errors='replace') + U = TypeVar('U', str, bytes) + + def _handle(out: U, err: U) -> Tuple[int, Union[str, bytes]]: + if logstderr and len(err.strip()): + logger.debug('Stderr: %s', err) + out += err - if logstderr and len(err.strip()): - if decode: - err = err.decode(errors='replace') - logger.debug('Stderr: %s', err) - out += err + return ecode, out - return ecode, out + if decode: + return _handle(out.decode(errors='replace'), err.decode(errors='replace')) + return _handle(out, err) def git_credential_fill(gitdir: Optional[str], protocol: str, host: str, username: str) -> Optional[str]: From patchwork Fri Nov 8 12:31:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamir Duberstein X-Patchwork-Id: 13868117 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C0CA1E47DD for ; Fri, 8 Nov 2024 12:32:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731069150; cv=none; b=Y7Fb4aa5t9XmD/5Lz3fWFUY/xXRixMbPpgYYNTBSy2p4ei/dMOavc4Cmh5d6xxzNdBrf5AXqzIDcFRTQgJ7HFIKGhO4GmXHDYuizqvpibwK9aPOAN2+x0eToMMnvrV44OmpyUTDrM74X08GWreIv9Af7Vc6N9Hv5Sb14Le6fNfU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731069150; c=relaxed/simple; bh=ecBBbS2r8kD9WOsPe4beqtgZGSk6w/nGpThSSF4MMpc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SztZFklwyMJRWqJCtTdNg0asq4E19UlVAFq78XmfzSrFx3vgyc+GcZchmg740ClTrBhFlrRuirrdXXc1Hgn2lgnUlGCL0blRa8B7xG3FdRtzrWntRRyuJK05rqU/tF1OuFpJ5TRo9960HyLb113Jnof8BlE7BOMkCMoWG8D6z68= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OdS1pQgc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OdS1pQgc" Received: by smtp.kernel.org (Postfix) id 4FFB6C4CEDB; Fri, 8 Nov 2024 12:32:30 +0000 (UTC) Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 31CB4C4CED5 for ; Fri, 8 Nov 2024 12:32:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 31CB4C4CED5 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-7b14f3927ddso128117685a.3 for ; Fri, 08 Nov 2024 04:32:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731069148; x=1731673948; darn=kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0L9oFF0+WXBfuPTzvFfgUZLcEhkaBrfpsLlCG+qdW94=; b=OdS1pQgcnUpRrumB6gV0WpD/z2ZboJiEuGI6KZip6SI6Xc8idpzvMNPwxSuhTI/eBe 8/RNAD51ZsnadtS66dloJham24Cc5DoeU34Vv+AsLmDfyzoS1tVqMM/jOaDBelFRCImU 77bAbgTRkzt24dy5hnv1NyQ83ZDBZCzbb0m/RiorCiHq8cRszLoLg99BS8w2+p6hl8RF auOp4vCHbrVS++6svfqe2LZYeW4/qaXuHKJ2c7nGhikVhBcWdC/5gCIB6kHrnBikN3Ci Uz6QW5hALpWaKWC5IqmG6Bax+Swj3IFCkmJm5F5WEzfnkEu8HkFldVSb/3RtV5A26r4i Y//A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731069148; x=1731673948; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0L9oFF0+WXBfuPTzvFfgUZLcEhkaBrfpsLlCG+qdW94=; b=egtrbsBD7glo/vDi5JGDPc5L9m+p+iFljw9rJo7Qf2c3a4yWl3RqXtXETE5uycctDX /JmsrhvXI5SRpWmNEsTDYH6rPjTVvTCgtJFHUG72TvcRoVxTuuYP7rn6UTagT5sQTDXc qW6tvH0LWeAn/4zFizMPJ3NlJFwpNSBvnxSHJ5RxpFrv3v4dvt4ZTlDiIGmgtui1V5wR IC60suN116zNkLBq/BQQggG1Oyy/Tw+dtw4HG9zZU1IcGQPMYlzabcNPGL6wnIq5B+U2 WW2Mug6PbNa3hgs4ofOeOEfWEMofzV6dT/PBFSAB+YDynMilAAL/HBb+4OPKlQ0BiJ9b 1UdQ== X-Gm-Message-State: AOJu0YyO2ztG9XeBaXHy+YBZ0AdqqRb1nVB4GyBb+ijpHcXf4exuCjCe 0E14yrOYappimyTTAqTo/vbIWniF+pB+c5rhF3X/aomoYe8szfqyL8LLXrUr X-Google-Smtp-Source: AGHT+IHP2xsY1i6W/+lU5tYoSHZT471zIffznOoyf2VI+9gdwHfOV9KA7aPxmaB1VcpsLEkTaTy+cA== X-Received: by 2002:a05:6214:3bc7:b0:6bf:6ef6:22d5 with SMTP id 6a1803df08f44-6d39e16b233mr38832156d6.17.1731069148015; Fri, 08 Nov 2024 04:32:28 -0800 (PST) Received: from 159.1.168.192.in-addr.arpa ([2600:4041:5be7:7c00:348d:4cbf:ba75:f557]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6d3961ef48csm18633436d6.35.2024.11.08.04.32.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 04:32:26 -0800 (PST) From: Tamir Duberstein Date: Fri, 08 Nov 2024 07:31:32 -0500 Subject: [PATCH RESEND b4 5/5] Add missing imports Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241108-better-type-annotations-v1-5-ebaf0129d9e1@gmail.com> References: <20241108-better-type-annotations-v1-0-ebaf0129d9e1@gmail.com> In-Reply-To: <20241108-better-type-annotations-v1-0-ebaf0129d9e1@gmail.com> To: "Kernel.org Tools" Cc: Konstantin Ryabitsev , Tamir Duberstein X-Mailer: b4 0.15-dev Signed-off-by: Tamir Duberstein --- src/b4/__init__.py | 9 +++++---- src/b4/diff.py | 1 + src/b4/ez.py | 2 ++ src/b4/pr.py | 2 ++ src/b4/ty.py | 1 + src/tests/test___init__.py | 1 + 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/b4/__init__.py b/src/b4/__init__.py index e71fbe7d8ea8d4ca19228690ce7c186cc91b81ad..7b1925da93e1b3feadf669cc188ab6fb030f67f4 100644 --- a/src/b4/__init__.py +++ b/src/b4/__init__.py @@ -8,12 +8,13 @@ import sys import gzip import os import fnmatch -import email.utils -import email.policy -import email.parser -import email.header import email.generator +import email.header +import email.message +import email.parser +import email.policy import email.quoprimime +import email.utils import tempfile import pathlib import argparse diff --git a/src/b4/diff.py b/src/b4/diff.py index 743127ef0a1922eace81686e27cd0366f8e42f9c..1de3063ea0b3c73e4e3d8bfd4ec91b4c6f90cce6 100644 --- a/src/b4/diff.py +++ b/src/b4/diff.py @@ -11,6 +11,7 @@ import b4 import b4.mbox import mailbox import email +import email.message import email.parser import shutil import pathlib diff --git a/src/b4/ez.py b/src/b4/ez.py index 970631592d2139b12ee4a6a9a112081eee1de721..9494b005a4f47a7be9cb053cc6075dede29d4cb0 100644 --- a/src/b4/ez.py +++ b/src/b4/ez.py @@ -17,6 +17,8 @@ import datetime import json import shlex import email +import email.policy +import email.utils import pathlib import base64 import textwrap diff --git a/src/b4/pr.py b/src/b4/pr.py index b6eb5d3933d7e0bb1224877f071bb19facd8dbd8..60f46f1e3fa96a52a9d667bffb43c2a75b89cc4e 100644 --- a/src/b4/pr.py +++ b/src/b4/pr.py @@ -13,7 +13,9 @@ import b4 import re import json import email +import email.message import email.parser +import email.utils import argparse import urllib.parse diff --git a/src/b4/ty.py b/src/b4/ty.py index e1afb61280d2161a054d40ae78df0d4b33dbb41d..021588ff9e559cfd8aa7c6818cdeba750931e8f6 100644 --- a/src/b4/ty.py +++ b/src/b4/ty.py @@ -13,6 +13,7 @@ import re import email import email.message import email.policy +import email.utils import json import argparse diff --git a/src/tests/test___init__.py b/src/tests/test___init__.py index 297e5120a8c8adf241660f06e9a83c1ff4a0fd3a..3e01c2f5e127cd1123d0fb8503493e396148ee73 100644 --- a/src/tests/test___init__.py +++ b/src/tests/test___init__.py @@ -35,6 +35,7 @@ def test_save_git_am_mbox(sampledir, tmp_path, source, regex, flags, ismbox): msgs = list(mbx) else: import email + import email.parser with open(f'{sampledir}/{source}.txt', 'rb') as fh: msg = email.parser.BytesParser(policy=b4.emlpolicy, _class=email.message.EmailMessage).parse(fh) msgs = [msg]