From a0d37378e3812f9d5dbfc79d50dcc43010c6ddbe Mon Sep 17 00:00:00 2001 From: apple1417 Date: Sat, 12 Jul 2025 12:22:13 +1200 Subject: [PATCH 1/2] add extra overloads for keybinds this means `keybind("name", callback=func)` works --- keybinds.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/keybinds.py b/keybinds.py index 2a861ad..0611ab4 100644 --- a/keybinds.py +++ b/keybinds.py @@ -143,6 +143,21 @@ def keybind( ) -> KeybindType: ... +@overload +def keybind( + identifier: str, + key: str | None = None, + *, + callback: KeybindCallback_NoArgs, + display_name: str | None = None, + description: str = "", + description_title: str | None = None, + is_hidden: bool = False, + is_rebindable: bool = True, + event_filter: EInputEvent = EInputEvent.IE_Pressed, +) -> KeybindType: ... + + @overload def keybind( identifier: str, @@ -173,6 +188,21 @@ def keybind( ) -> KeybindType: ... +@overload +def keybind( + identifier: str, + key: str | None = None, + *, + callback: KeybindCallback_Event, + display_name: str | None = None, + description: str = "", + description_title: str | None = None, + is_hidden: bool = False, + is_rebindable: bool = True, + event_filter: None, +) -> KeybindType: ... + + @overload def keybind( identifier: str, From 34206d6eb2da810b4bcb9bb7bc60514353757629 Mon Sep 17 00:00:00 2001 From: apple1417 Date: Sat, 12 Jul 2025 18:35:01 +1200 Subject: [PATCH 2/2] update changelog --- Readme.md | 4 ++++ __init__.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 7362603..59766a7 100644 --- a/Readme.md +++ b/Readme.md @@ -19,6 +19,10 @@ game specific things: # Changelog +### v1.11 (Upcoming) +- Added extra typing overloads to the `keybind` factory, to allow cases such as + `keybind("name", callback=func)` + ### v1.10 - Added the `ObjectFlags` enum, holding a few known useful flags. diff --git a/__init__.py b/__init__.py index fc26630..8146f9c 100644 --- a/__init__.py +++ b/__init__.py @@ -9,7 +9,7 @@ from .dot_sdkmod import open_in_mod_dir # Need to define a few things first to avoid circular imports -__version_info__: tuple[int, int] = (1, 10) +__version_info__: tuple[int, int] = (1, 11) __version__: str = f"{__version_info__[0]}.{__version_info__[1]}" __author__: str = "bl-sdk"