fix optional wrapping of static call methods in pyi (#4727)

This commit is contained in:
Khaleel Al-Adhami 2025-02-03 09:31:32 -08:00 committed by GitHub
parent 68547dce4c
commit 15da4e17bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 3 deletions

View File

@ -151,7 +151,7 @@ def default_backend_exception_handler(exception: Exception) -> EventSpec:
position="top-center",
id="backend_error",
style={"width": "500px"},
) # pyright: ignore [reportReturnType]
)
else:
error_message.insert(0, "An error occurred.")
return window_alert("\n".join(error_message))

View File

@ -177,7 +177,7 @@ class ToastNamespace(ComponentNamespace):
@staticmethod
def __call__(
message: Union[str, Var] = "", level: Optional[str] = None, **props
) -> "Optional[EventSpec]":
) -> "EventSpec":
"""Send a toast message.
Args:

View File

@ -699,6 +699,7 @@ def _generate_staticmethod_call_functiondef(
value=_get_type_hint(
typing.get_type_hints(clz.__call__).get("return", None),
type_hint_globals,
is_optional=False,
)
),
)

View File

@ -1623,7 +1623,7 @@ async def test_state_with_invalid_yield(capsys, mock_app):
id="backend_error",
position="top-center",
style={"width": "500px"},
) # pyright: ignore [reportCallIssue, reportArgumentType]
)
],
token="",
)