remove a bit more unions

This commit is contained in:
Khaleel Al-Adhami 2025-02-18 16:09:22 -08:00
parent 6df5cfe43b
commit 411f46c73e
31 changed files with 116 additions and 164 deletions

View File

@ -27,7 +27,6 @@ from typing import (
Dict,
MutableMapping,
Type,
Union,
get_args,
get_type_hints,
)
@ -289,7 +288,7 @@ class UnevaluatedPage:
title: Var | str | None
description: Var | str | None
image: str
on_load: Union[EventType[()], None]
on_load: EventType[()] | None
meta: list[dict[str, str]]
@ -399,7 +398,7 @@ class App(MiddlewareMixin, LifespanMixin):
# Backend Error Handler Function
backend_exception_handler: Callable[
[Exception], Union[EventSpec, list[EventSpec], None]
[Exception], EventSpec | list[EventSpec] | None
] = default_backend_exception_handler
# Put the toast provider in the app wrap.
@ -1491,7 +1490,7 @@ class App(MiddlewareMixin, LifespanMixin):
if not valid:
raise ValueError(
f"Provided custom {handler_domain} exception handler `{_fn_name}` has the wrong return type."
f"Expected `Union[EventSpec, list[EventSpec], None]` but got `{return_type}`"
f"Expected `EventSpec | list[EventSpec] | None` but got `{return_type}`"
)

View File

@ -9,7 +9,7 @@ from abc import ABC, abstractmethod
from functools import lru_cache, wraps
from hashlib import md5
from types import SimpleNamespace
from typing import Any, Callable, ClassVar, Iterator, List, Sequence, Type, Union
from typing import Any, Callable, ClassVar, Iterator, List, Sequence, Type
from typing_extensions import Self
@ -159,9 +159,7 @@ def evaluate_style_namespaces(style: ComponentStyle) -> dict:
# Map from component to styling.
ComponentStyle = dict[
Union[str, Type[BaseComponent], Callable, ComponentNamespace], Any
]
ComponentStyle = dict[str | Type[BaseComponent] | Callable | ComponentNamespace, Any]
ComponentChild = types.PrimitiveType | Var | BaseComponent
ComponentChildTypes = (*types.PrimitiveTypes, Var, BaseComponent)

View File

@ -2,7 +2,7 @@
from __future__ import annotations
from typing import TypeVar, Union
from typing import TypeVar
breakpoints_values = ["30em", "48em", "62em", "80em", "96em"]
breakpoint_names = ["xs", "sm", "md", "lg", "xl"]
@ -94,4 +94,4 @@ breakpoints = Breakpoints.create
T = TypeVar("T")
Responsive = Union[T, Breakpoints[str, T]]
Responsive = T | Breakpoints[str, T]

View File

@ -1,12 +1,10 @@
"""A Reflex logo component."""
from typing import Union
import reflex as rx
def svg_logo(
color: Union[str, rx.Var[str]] = rx.color_mode_cond("#110F1F", "white"),
color: str | rx.Var[str] = rx.color_mode_cond("#110F1F", "white"),
**props,
):
"""A Reflex logo SVG.

View File

@ -4,7 +4,7 @@ from __future__ import annotations
import re
from collections import defaultdict
from typing import Any, Literal, Union
from typing import Any, Literal
from reflex.base import Base
from reflex.components.component import Component, ComponentNamespace
@ -547,15 +547,13 @@ class ShikiCodeBlock(Component, MarkdownComponentMap):
theme: Var[LiteralCodeTheme] = Var.create("one-light")
# The set of themes to use for different modes.
themes: Var[Union[list[dict[str, Any]], dict[str, str]]]
themes: Var[list[dict[str, Any]] | dict[str, str]]
# The code to display.
code: Var[str]
# The transformers to use for the syntax highlighter.
transformers: Var[list[Union[ShikiBaseTransformers, dict[str, Any]]]] = Var.create(
[]
)
transformers: Var[list[ShikiBaseTransformers | dict[str, Any]]] = Var.create([])
# The decorations to use for the syntax highlighter.
decorations: Var[list[ShikiDecorations]] = Var.create([])

View File

@ -1,6 +1,6 @@
"""Inline classes."""
from typing import Literal, Union
from typing import Literal
from reflex.vars.base import Var
@ -46,7 +46,7 @@ class A(BaseHTML): # Inherits common attributes from BaseMeta
rel: Var[str]
# Specifies where to open the linked document
target: Var[Union[str, Literal["_self", "_blank", "_parent", "_top"]]]
target: Var[str | Literal["_self", "_blank", "_parent", "_top"]]
class Abbr(BaseHTML):

View File

@ -1,6 +1,6 @@
"""Media classes."""
from typing import Any, Literal, Union
from typing import Any, Literal
from reflex import Component, ComponentNamespace
from reflex.components.el.elements.inline import ReferrerPolicy
@ -472,7 +472,7 @@ class Stop(BaseHTML):
stop_color: Var[str | Color | bool]
# Opacity of the gradient stop.
stop_opacity: Var[Union[str, float, int, bool]]
stop_opacity: Var[str | float | int | bool]
class Path(BaseHTML):

View File

@ -2,7 +2,6 @@
import dataclasses
from datetime import date, datetime, time, timedelta
from typing import Union
from reflex.components.component import NoSSRComponent
from reflex.event import EventHandler, passthrough_event_spec
@ -79,7 +78,7 @@ class Moment(NoSSRComponent):
duration: Var[str]
# The date to display (also work if passed as children).
date: Var[Union[str, datetime, date, time, timedelta]]
date: Var[str | datetime | date | time | timedelta]
# Shows the duration (elapsed time) between now and the provided datetime.
duration_from_now: Var[bool]

View File

@ -2,7 +2,7 @@
from __future__ import annotations
from typing import Any, Dict, TypedDict, TypeVar, Union
from typing import Any, Dict, TypedDict, TypeVar
from reflex.components.component import Component, NoSSRComponent
from reflex.components.core.cond import color_mode_cond
@ -35,7 +35,7 @@ def _event_points_data_signature(e0: Var) -> tuple[Var[list[Point]]]:
T = TypeVar("T")
ItemOrList = Union[T, list[T]]
ItemOrList = T | list[T]
class BBox(TypedDict):
@ -59,33 +59,10 @@ class Point(TypedDict):
lon: float | int | None
curveNumber: int | None
pointNumber: int | None
pointNumbers: Union[list[int], None]
pointNumbers: list[int] | None
pointIndex: int | None
markerColor: Union[
ItemOrList[
ItemOrList[
Union[
float,
int,
str,
None,
]
]
],
None,
]
markerSize: Union[
ItemOrList[
ItemOrList[
Union[
float,
int,
None,
]
]
],
None,
]
markerColor: ItemOrList[ItemOrList[float | int | str | None]] | None
markerSize: ItemOrList[ItemOrList[float | int | None,]] | None
bbox: BBox | None

View File

@ -3,7 +3,7 @@
# ------------------- DO NOT EDIT ----------------------
# This file was generated by `reflex/utils/pyi_generator.py`!
# ------------------------------------------------------
from typing import Any, Dict, Optional, TypedDict, TypeVar, Union, overload
from typing import Any, Dict, Optional, TypedDict, TypeVar, overload
from reflex.components.component import NoSSRComponent
from reflex.event import EventType
@ -21,7 +21,7 @@ except ImportError:
Figure = Any
Template = Any
T = TypeVar("T")
ItemOrList = Union[T, list[T]]
ItemOrList = T | list[T]
class BBox(TypedDict):
x0: float | int | None
@ -39,10 +39,10 @@ class Point(TypedDict):
lon: float | int | None
curveNumber: int | None
pointNumber: int | None
pointNumbers: Union[list[int], None]
pointNumbers: list[int] | None
pointIndex: int | None
markerColor: Union[ItemOrList[ItemOrList[Union[float, int, str, None]]], None]
markerSize: Union[ItemOrList[ItemOrList[Union[float, int, None]]], None]
markerColor: ItemOrList[ItemOrList[float | int | str | None]] | None
markerSize: ItemOrList[ItemOrList[float | int | None,]] | None
bbox: BBox | None
class Plotly(NoSSRComponent):

View File

@ -2,7 +2,7 @@
from __future__ import annotations
from typing import Any, Literal, Union
from typing import Any, Literal
from reflex.components.component import Component, ComponentNamespace
from reflex.components.core.colors import color
@ -95,10 +95,10 @@ class AccordionRoot(AccordionComponent):
type: Var[LiteralAccordionType]
# The value of the item to expand.
value: Var[Union[str, list[str]]]
value: Var[str | list[str]]
# The default value of the item to expand.
default_value: Var[Union[str, list[str]]]
default_value: Var[str | list[str]]
# Whether or not the accordion is collapsible.
collapsible: Var[bool]

View File

@ -17,7 +17,7 @@ rx.text(
from __future__ import annotations
from typing import Any, Literal, Union, get_args
from typing import Any, Literal, get_args
from reflex.components.component import BaseComponent
from reflex.components.core.cond import Cond, color_mode_cond, cond
@ -99,7 +99,7 @@ class ColorModeIconButton(IconButton):
"""Icon Button for toggling light / dark mode via toggle_color_mode."""
# The position of the icon button. Follow document flow if None.
position: Union[LiteralPosition, Var[LiteralPosition]] | None = None
position: LiteralPosition | Var[LiteralPosition] | None = None
# Allow picking the "system" value for the color mode.
allow_system: bool = False

View File

@ -1,6 +1,6 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Literal, Union
from typing import Literal
import reflex as rx
from reflex.components.component import Component, ComponentNamespace
@ -57,7 +57,7 @@ class Callout(CalloutRoot):
icon: Var[str]
@classmethod
def create(cls, text: Union[str, Var[str]], **props) -> Component:
def create(cls, text: str | Var[str], **props) -> Component:
"""Create a callout component.
Args:

View File

@ -1,7 +1,7 @@
"""Components for the Radix CheckboxCards component."""
from types import SimpleNamespace
from typing import Literal, Union
from typing import Literal
from reflex.components.core.breakpoints import Responsive
from reflex.vars.base import Var
@ -27,14 +27,10 @@ class CheckboxCardsRoot(RadixThemesComponent):
high_contrast: Var[bool]
# The number of columns:
columns: Var[
Responsive[Union[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]]]
]
columns: Var[Responsive[str | Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]]]
# The gap between the checkbox cards:
gap: Var[
Responsive[Union[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]]]
]
gap: Var[Responsive[str | Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]]]
class CheckboxCardsItem(RadixThemesComponent):

View File

@ -1,6 +1,6 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Literal, Union
from typing import Literal
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Responsive
@ -101,7 +101,7 @@ class ContextMenuContent(RadixThemesComponent):
avoid_collisions: Var[bool]
# The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0.
collision_padding: Var[Union[float, int, dict[str, float | int]]]
collision_padding: Var[float | int | dict[str, float | int]]
# The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial".
sticky: Var[LiteralStickyType]
@ -183,7 +183,7 @@ class ContextMenuSubContent(RadixThemesComponent):
avoid_collisions: Var[bool]
# The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0.
collision_padding: Var[Union[float, int, dict[str, float | int]]]
collision_padding: Var[float | int | dict[str, float | int]]
# The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial".
sticky: Var[LiteralStickyType]

View File

@ -1,6 +1,6 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Literal, Union
from typing import Literal
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Responsive
@ -106,7 +106,7 @@ class DropdownMenuContent(RadixThemesComponent):
avoid_collisions: Var[bool]
# The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0.
collision_padding: Var[Union[float, int, dict[str, float | int]]]
collision_padding: Var[float | int | dict[str, float | int]]
# The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial".
sticky: Var[LiteralStickyType]
@ -188,7 +188,7 @@ class DropdownMenuSubContent(RadixThemesComponent):
avoid_collisions: Var[bool]
# The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0.
collision_padding: Var[Union[float, int, dict[str, float | int]]]
collision_padding: Var[float | int | dict[str, float | int]]
# The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial".
sticky: Var[LiteralStickyType]

View File

@ -1,6 +1,6 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Literal, Union
from typing import Literal
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Responsive
@ -62,7 +62,7 @@ class HoverCardContent(elements.Div, RadixThemesComponent):
avoid_collisions: Var[bool]
# The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { top: 20, left: 20 }.
collision_padding: Var[Union[float, int, dict[str, float | int]]]
collision_padding: Var[float | int | dict[str, float | int]]
# The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless
sticky: Var[Literal["partial", "always"]]

View File

@ -1,6 +1,6 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Literal, Union
from typing import Literal
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Responsive
@ -62,7 +62,7 @@ class PopoverContent(elements.Div, RadixThemesComponent):
avoid_collisions: Var[bool]
# The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0.
collision_padding: Var[Union[float, int, dict[str, float | int]]]
collision_padding: Var[float | int | dict[str, float | int]]
# The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial".
sticky: Var[Literal["partial", "always"]]

View File

@ -1,7 +1,7 @@
"""Radio component from Radix Themes."""
from types import SimpleNamespace
from typing import Literal, Union
from typing import Literal
from reflex.components.core.breakpoints import Responsive
from reflex.event import EventHandler, passthrough_event_spec
@ -31,14 +31,10 @@ class RadioCardsRoot(RadixThemesComponent):
high_contrast: Var[bool]
# The number of columns:
columns: Var[
Responsive[Union[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]]]
]
columns: Var[Responsive[str | Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]]]
# The gap between the checkbox cards:
gap: Var[
Responsive[Union[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]]]
]
gap: Var[Responsive[str | Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]]]
default_value: Var[str]

View File

@ -3,7 +3,7 @@
from __future__ import annotations
from types import SimpleNamespace
from typing import Literal, Union
from typing import Literal
from reflex.components.core.breakpoints import Responsive
from reflex.event import EventHandler
@ -13,8 +13,8 @@ from ..base import LiteralAccentColor, RadixThemesComponent
def on_value_change(
value: Var[Union[str, list[str]]],
) -> tuple[Var[Union[str, list[str]]]]:
value: Var[str | list[str]],
) -> tuple[Var[str | list[str]]]:
"""Handle the on_value_change event.
Args:
@ -47,10 +47,10 @@ class SegmentedControlRoot(RadixThemesComponent):
radius: Var[Literal["none", "small", "medium", "large", "full"]]
# The default value of the segmented control.
default_value: Var[Union[str, list[str]]]
default_value: Var[str | list[str]]
# The current value of the segmented control.
value: Var[Union[str, list[str]]]
value: Var[str | list[str]]
# Handles the `onChange` event for the SegmentedControl component.
on_change: EventHandler[on_value_change]

View File

@ -4,7 +4,7 @@
# This file was generated by `reflex/utils/pyi_generator.py`!
# ------------------------------------------------------
from types import SimpleNamespace
from typing import Any, Literal, Optional, Union, overload
from typing import Any, Literal, Optional, overload
from reflex.components.core.breakpoints import Breakpoints
from reflex.event import EventType
@ -13,9 +13,7 @@ from reflex.vars.base import Var
from ..base import RadixThemesComponent
def on_value_change(
value: Var[Union[str, list[str]]],
) -> tuple[Var[Union[str, list[str]]]]: ...
def on_value_change(value: Var[str | list[str]]) -> tuple[Var[str | list[str]]]: ...
class SegmentedControlRoot(RadixThemesComponent):
@overload
@ -104,7 +102,7 @@ class SegmentedControlRoot(RadixThemesComponent):
autofocus: bool | None = None,
custom_attrs: dict[str, Var | Any] | None = None,
on_blur: Optional[EventType[()]] = None,
on_change: Optional[EventType[()] | EventType[Union[str, list[str]]]] = None,
on_change: Optional[EventType[()] | EventType[str | list[str]]] = None,
on_click: Optional[EventType[()]] = None,
on_context_menu: Optional[EventType[()]] = None,
on_double_click: Optional[EventType[()]] = None,

View File

@ -1,6 +1,6 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Literal, Union
from typing import Literal
import reflex as rx
from reflex.components.component import Component, ComponentNamespace
@ -179,7 +179,7 @@ class HighLevelSelect(SelectRoot):
position: Var[Literal["item-aligned", "popper"]]
@classmethod
def create(cls, items: Union[list[str], Var[list[str]]], **props) -> Component:
def create(cls, items: list[str] | Var[list[str]], **props) -> Component:
"""Create a select component.
Args:

View File

@ -413,7 +413,7 @@ class Bar(Cartesian):
max_bar_size: Var[int]
# If set a value, the option is the radius of all the rounded corners. If set a array, the option are in turn the radiuses of top-left corner, top-right corner, bottom-right corner, bottom-left corner. Default: 0
radius: Var[Union[int, list[int]]]
radius: Var[int | list[int]]
# The active bar is shown when a user enters a bar chart and this chart has tooltip. If set to false, no active bar will be drawn. If set to true, active bar will be drawn with the props calculated internally. If passed an object, active bar will be drawn, and the internally calculated props will be merged with the key value pairs of the passed object.
# active_bar: Var[Union[bool, dict[str, Any]]] #noqa: ERA001

View File

@ -65,7 +65,7 @@ class EditorOptions(Base):
rtl: bool | None = None
# List of buttons to use in the toolbar.
button_list: list[Union[list[str], str]] | None
button_list: list[list[str] | str] | None
def on_blur_spec(e: Var, content: Var[str]) -> tuple[Var[str]]:

View File

@ -4,7 +4,7 @@
# This file was generated by `reflex/utils/pyi_generator.py`!
# ------------------------------------------------------
import enum
from typing import Any, Dict, Literal, Optional, Union, overload
from typing import Any, Dict, Literal, Optional, overload
from reflex.base import Base
from reflex.components.component import NoSSRComponent
@ -42,7 +42,7 @@ class EditorOptions(Base):
default_tag: str | None
mode: str | None
rtl: bool | None
button_list: list[Union[list[str], str]] | None
button_list: list[list[str] | str] | None
def on_blur_spec(e: Var, content: Var[str]) -> tuple[Var[str]]: ...
def on_paste_spec(

View File

@ -20,7 +20,6 @@ from typing import (
Type,
TypedDict,
TypeVar,
Union,
get_args,
get_origin,
get_type_hints,
@ -393,9 +392,7 @@ class EventChain(EventActionsMixin):
default_factory=list
)
args_spec: Union[Callable, Sequence[Callable]] | None = dataclasses.field(
default=None
)
args_spec: Callable | Sequence[Callable] | None = dataclasses.field(default=None)
invocation: Var | None = dataclasses.field(default=None)
@ -979,7 +976,7 @@ def remove_session_storage(key: str) -> EventSpec:
)
def set_clipboard(content: Union[str, Var[str]]) -> EventSpec:
def set_clipboard(content: str | Var[str]) -> EventSpec:
"""Set the text in content in the clipboard.
Args:
@ -1943,10 +1940,10 @@ class EventNamespace(types.SimpleNamespace):
func: Callable[[BASE_STATE, Unpack[P]], Any] | None = None,
*,
background: bool | None = None,
) -> Union[
EventCallback[Unpack[P]],
Callable[[Callable[[BASE_STATE, Unpack[P]], Any]], EventCallback[Unpack[P]]],
]:
) -> (
EventCallback[Unpack[P]]
| Callable[[Callable[[BASE_STATE, Unpack[P]], Any]], EventCallback[Unpack[P]]]
):
"""Wrap a function to be used as an event.
Args:

View File

@ -5,7 +5,7 @@ from __future__ import annotations
import re
from collections import defaultdict
from contextlib import suppress
from typing import Any, ClassVar, Type, Union
from typing import Any, ClassVar, Type
import alembic.autogenerate
import alembic.command
@ -161,9 +161,7 @@ async def get_db_status() -> dict[str, bool]:
return {"db": status}
SQLModelOrSqlAlchemy = Union[
Type[sqlmodel.SQLModel], Type[sqlalchemy.orm.DeclarativeBase]
]
SQLModelOrSqlAlchemy = Type[sqlmodel.SQLModel] | Type[sqlalchemy.orm.DeclarativeBase]
class ModelRegistry:

View File

@ -33,7 +33,6 @@ from typing import (
Tuple,
Type,
TypeVar,
Union,
cast,
get_args,
get_type_hints,
@ -1694,7 +1693,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
return StateUpdate()
event_specs_correct_type = cast(
Union[list[EventSpec | EventHandler], None],
list[EventSpec | EventHandler] | None,
[event_specs] if isinstance(event_specs, EventSpec) else event_specs,
)
fixed_events = fix_events(

View File

@ -2405,7 +2405,7 @@ class ComputedVar(Var[RETURN_TYPE]):
return self._fget
class DynamicRouteVar(ComputedVar[Union[str, list[str]]]):
class DynamicRouteVar(ComputedVar[str | list[str]]):
"""A ComputedVar that represents a dynamic route."""
pass

View File

@ -14,7 +14,6 @@ from typing import (
Sequence,
Type,
TypeVar,
Union,
overload,
)
@ -54,52 +53,52 @@ class FunctionVar(Var[CALLABLE_TYPE], default_type=ReflexCallable[Any, Any]):
@overload
def partial(
self: FunctionVar[ReflexCallable[Concatenate[V1, P], R]],
arg1: Union[V1, Var[V1]],
arg1: V1 | Var[V1],
) -> FunctionVar[ReflexCallable[P, R]]: ...
@overload
def partial(
self: FunctionVar[ReflexCallable[Concatenate[V1, V2, P], R]],
arg1: Union[V1, Var[V1]],
arg2: Union[V2, Var[V2]],
arg1: V1 | Var[V1],
arg2: V2 | Var[V2],
) -> FunctionVar[ReflexCallable[P, R]]: ...
@overload
def partial(
self: FunctionVar[ReflexCallable[Concatenate[V1, V2, V3, P], R]],
arg1: Union[V1, Var[V1]],
arg2: Union[V2, Var[V2]],
arg3: Union[V3, Var[V3]],
arg1: V1 | Var[V1],
arg2: V2 | Var[V2],
arg3: V3 | Var[V3],
) -> FunctionVar[ReflexCallable[P, R]]: ...
@overload
def partial(
self: FunctionVar[ReflexCallable[Concatenate[V1, V2, V3, V4, P], R]],
arg1: Union[V1, Var[V1]],
arg2: Union[V2, Var[V2]],
arg3: Union[V3, Var[V3]],
arg4: Union[V4, Var[V4]],
arg1: V1 | Var[V1],
arg2: V2 | Var[V2],
arg3: V3 | Var[V3],
arg4: V4 | Var[V4],
) -> FunctionVar[ReflexCallable[P, R]]: ...
@overload
def partial(
self: FunctionVar[ReflexCallable[Concatenate[V1, V2, V3, V4, V5, P], R]],
arg1: Union[V1, Var[V1]],
arg2: Union[V2, Var[V2]],
arg3: Union[V3, Var[V3]],
arg4: Union[V4, Var[V4]],
arg5: Union[V5, Var[V5]],
arg1: V1 | Var[V1],
arg2: V2 | Var[V2],
arg3: V3 | Var[V3],
arg4: V4 | Var[V4],
arg5: V5 | Var[V5],
) -> FunctionVar[ReflexCallable[P, R]]: ...
@overload
def partial(
self: FunctionVar[ReflexCallable[Concatenate[V1, V2, V3, V4, V5, V6, P], R]],
arg1: Union[V1, Var[V1]],
arg2: Union[V2, Var[V2]],
arg3: Union[V3, Var[V3]],
arg4: Union[V4, Var[V4]],
arg5: Union[V5, Var[V5]],
arg6: Union[V6, Var[V6]],
arg1: V1 | Var[V1],
arg2: V2 | Var[V2],
arg3: V3 | Var[V3],
arg4: V4 | Var[V4],
arg5: V5 | Var[V5],
arg6: V6 | Var[V6],
) -> FunctionVar[ReflexCallable[P, R]]: ...
@overload
@ -128,52 +127,52 @@ class FunctionVar(Var[CALLABLE_TYPE], default_type=ReflexCallable[Any, Any]):
@overload
def call(
self: FunctionVar[ReflexCallable[[V1], R]], arg1: Union[V1, Var[V1]]
self: FunctionVar[ReflexCallable[[V1], R]], arg1: V1 | Var[V1]
) -> VarOperationCall[[V1], R]: ...
@overload
def call(
self: FunctionVar[ReflexCallable[[V1, V2], R]],
arg1: Union[V1, Var[V1]],
arg2: Union[V2, Var[V2]],
arg1: V1 | Var[V1],
arg2: V2 | Var[V2],
) -> VarOperationCall[[V1, V2], R]: ...
@overload
def call(
self: FunctionVar[ReflexCallable[[V1, V2, V3], R]],
arg1: Union[V1, Var[V1]],
arg2: Union[V2, Var[V2]],
arg3: Union[V3, Var[V3]],
arg1: V1 | Var[V1],
arg2: V2 | Var[V2],
arg3: V3 | Var[V3],
) -> VarOperationCall[[V1, V2, V3], R]: ...
@overload
def call(
self: FunctionVar[ReflexCallable[[V1, V2, V3, V4], R]],
arg1: Union[V1, Var[V1]],
arg2: Union[V2, Var[V2]],
arg3: Union[V3, Var[V3]],
arg4: Union[V4, Var[V4]],
arg1: V1 | Var[V1],
arg2: V2 | Var[V2],
arg3: V3 | Var[V3],
arg4: V4 | Var[V4],
) -> VarOperationCall[[V1, V2, V3, V4], R]: ...
@overload
def call(
self: FunctionVar[ReflexCallable[[V1, V2, V3, V4, V5], R]],
arg1: Union[V1, Var[V1]],
arg2: Union[V2, Var[V2]],
arg3: Union[V3, Var[V3]],
arg4: Union[V4, Var[V4]],
arg5: Union[V5, Var[V5]],
arg1: V1 | Var[V1],
arg2: V2 | Var[V2],
arg3: V3 | Var[V3],
arg4: V4 | Var[V4],
arg5: V5 | Var[V5],
) -> VarOperationCall[[V1, V2, V3, V4, V5], R]: ...
@overload
def call(
self: FunctionVar[ReflexCallable[[V1, V2, V3, V4, V5, V6], R]],
arg1: Union[V1, Var[V1]],
arg2: Union[V2, Var[V2]],
arg3: Union[V3, Var[V3]],
arg4: Union[V4, Var[V4]],
arg5: Union[V5, Var[V5]],
arg6: Union[V6, Var[V6]],
arg1: V1 | Var[V1],
arg2: V2 | Var[V2],
arg3: V3 | Var[V3],
arg4: V4 | Var[V4],
arg5: V5 | Var[V5],
arg6: V6 | Var[V6],
) -> VarOperationCall[[V1, V2, V3, V4, V5, V6], R]: ...
@overload

View File

@ -255,7 +255,7 @@ def test_is_backend_base_variable(
(list[int], list[int], True),
(list[int], list[float], True),
(int | float, int | float, False),
(Union[int, Var[int]], Var[int], False),
(int | Var[int], Var[int], False),
(int, Any, True),
(Any, Any, True),
(int | float, Any, True),