public inbox for tools@linux.kernel.org
 help / color / mirror / Atom feed
From: Tamir Duberstein <tamird@gmail.com>
To: "Kernel.org Tools" <tools@kernel.org>
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	 Tamir Duberstein <tamird@gmail.com>
Subject: [PATCH 09/14] Type from_git_config keyword arguments
Date: Fri, 10 Apr 2026 18:38:00 -0400	[thread overview]
Message-ID: <20260410-harden-type-checking-v1-9-fcf314d9d748@gmail.com> (raw)
In-Reply-To: <20260410-harden-type-checking-v1-0-fcf314d9d748@gmail.com>

Define a TypedDict for LoreNode constructor keyword arguments and
annotate from_git_config with an unpacked kwargs signature.

This removes the constructor-call type suppressions while keeping
git-config defaults and caller overrides unchanged.

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
 pyproject.toml      |  1 +
 src/liblore/node.py | 18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 37c85a7..387757c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -46,6 +46,7 @@ dev = [
     "ruff",
     "ty",
     "types-requests",
+    "typing-extensions",
 ]
 
 [tool.pytest.ini_options]
diff --git a/src/liblore/node.py b/src/liblore/node.py
index 1b0463e..4835169 100644
--- a/src/liblore/node.py
+++ b/src/liblore/node.py
@@ -17,6 +17,7 @@ import types
 import urllib.parse
 from datetime import datetime, timezone
 from email.message import EmailMessage
+from typing import TYPE_CHECKING, TypedDict
 
 import requests
 
@@ -29,6 +30,19 @@ from liblore.utils import (
 
 logger = logging.getLogger(__name__)
 
+if TYPE_CHECKING:
+    from typing_extensions import Unpack
+
+
+class _LoreNodeInitKwargs(TypedDict, total=False):
+    fallback_urls: list[str] | None
+    auto_probe: bool
+    probe_timeout: float
+    probe_ttl: int
+    add_auth_headers: bool
+    cache_dir: str
+    cache_ttl: int
+
 
 def _get_config_from_git(
     regexp: str,
@@ -212,7 +226,7 @@ class LoreNode:
     def from_git_config(
         cls,
         url: str = 'https://lore.kernel.org/all',
-        **kwargs: object,
+        **kwargs: Unpack[_LoreNodeInitKwargs],
     ) -> LoreNode:
         """Create a :class:`LoreNode` using settings from git config.
 
@@ -319,7 +333,7 @@ class LoreNode:
                 except ValueError:
                     pass
 
-        node = cls(url, **kwargs)  # type: ignore[arg-type]  # ty:ignore[invalid-argument-type]
+        node = cls(url, **kwargs)
 
         val = gitcfg.get('useragentplus')
         if isinstance(val, str) and val:

-- 
2.53.0


  parent reply	other threads:[~2026-04-10 22:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 22:37 [PATCH 00/14] Harden local type checking and test mocking Tamir Duberstein
2026-04-10 22:37 ` [PATCH 01/14] Add b4 CI checks and mypy suppressions Tamir Duberstein
2026-04-10 22:37 ` [PATCH 02/14] Type make_msg and drop test suppressions Tamir Duberstein
2026-04-10 22:37 ` [PATCH 03/14] Add ruff import checks to b4 CI Tamir Duberstein
2026-04-10 22:37 ` [PATCH 04/14] Add ruff format check to CI Tamir Duberstein
2026-04-10 22:37 ` [PATCH 05/14] Add pyright strict checks " Tamir Duberstein
2026-04-10 22:37 ` [PATCH 06/14] Replace HTTP session mocks with responses Tamir Duberstein
2026-04-10 22:37 ` [PATCH 07/14] Add ty checks to CI Tamir Duberstein
2026-04-10 22:37 ` [PATCH 08/14] Drop redundant read-only property test Tamir Duberstein
2026-04-10 22:38 ` Tamir Duberstein [this message]
2026-04-10 22:38 ` [PATCH 10/14] Add authheaders stub and typed callable Tamir Duberstein
2026-04-10 22:38 ` [PATCH 11/14] Replace batch mocks with subclasses Tamir Duberstein
2026-04-10 22:38 ` [PATCH 12/14] Use CompletedProcess in git config tests Tamir Duberstein
2026-04-10 22:38 ` [PATCH 13/14] Update README for uv-based dev checks Tamir Duberstein
2026-04-10 22:38 ` [PATCH 14/14] Add b4 send configuration Tamir Duberstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260410-harden-type-checking-v1-9-fcf314d9d748@gmail.com \
    --to=tamird@gmail.com \
    --cc=konstantin@linuxfoundation.org \
    --cc=tools@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox