Skip to content

Commit 15da4e1

Browse files
authored
fix optional wrapping of static call methods in pyi (#4727)
1 parent 68547dc commit 15da4e1

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

reflex/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def default_backend_exception_handler(exception: Exception) -> EventSpec:
151151
position="top-center",
152152
id="backend_error",
153153
style={"width": "500px"},
154-
) # pyright: ignore [reportReturnType]
154+
)
155155
else:
156156
error_message.insert(0, "An error occurred.")
157157
return window_alert("\n".join(error_message))

reflex/components/sonner/toast.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class ToastNamespace(ComponentNamespace):
177177
@staticmethod
178178
def __call__(
179179
message: Union[str, Var] = "", level: Optional[str] = None, **props
180-
) -> "Optional[EventSpec]":
180+
) -> "EventSpec":
181181
"""Send a toast message.
182182
183183
Args:

reflex/utils/pyi_generator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@ def _generate_staticmethod_call_functiondef(
699699
value=_get_type_hint(
700700
typing.get_type_hints(clz.__call__).get("return", None),
701701
type_hint_globals,
702+
is_optional=False,
702703
)
703704
),
704705
)

tests/units/test_state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1623,7 +1623,7 @@ def invalid_handler(self):
16231623
id="backend_error",
16241624
position="top-center",
16251625
style={"width": "500px"},
1626-
) # pyright: ignore [reportCallIssue, reportArgumentType]
1626+
)
16271627
],
16281628
token="",
16291629
)

0 commit comments

Comments
 (0)