Skip to content

Commit

Permalink
fix optional wrapping of static call methods in pyi (#4727)
Browse files Browse the repository at this point in the history
  • Loading branch information
adhami3310 authored Feb 3, 2025
1 parent 68547dc commit 15da4e1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion reflex/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion reflex/components/sonner/toast.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions reflex/utils/pyi_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
),
)
Expand Down
2 changes: 1 addition & 1 deletion tests/units/test_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ def invalid_handler(self):
id="backend_error",
position="top-center",
style={"width": "500px"},
) # pyright: ignore [reportCallIssue, reportArgumentType]
)
],
token="",
)
Expand Down

0 comments on commit 15da4e1

Please sign in to comment.