use lowercase datatypes typing
This commit is contained in:
parent
946b7bc25a
commit
35a88466ef
@ -25,7 +25,6 @@ from typing import (
|
|||||||
Callable,
|
Callable,
|
||||||
Coroutine,
|
Coroutine,
|
||||||
Dict,
|
Dict,
|
||||||
List,
|
|
||||||
MutableMapping,
|
MutableMapping,
|
||||||
Optional,
|
Optional,
|
||||||
Set,
|
Set,
|
||||||
@ -293,7 +292,7 @@ class UnevaluatedPage:
|
|||||||
description: Union[Var, str, None]
|
description: Union[Var, str, None]
|
||||||
image: str
|
image: str
|
||||||
on_load: Union[EventType[()], None]
|
on_load: Union[EventType[()], None]
|
||||||
meta: List[Dict[str, str]]
|
meta: list[Dict[str, str]]
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass()
|
@dataclasses.dataclass()
|
||||||
@ -327,7 +326,7 @@ class App(MiddlewareMixin, LifespanMixin):
|
|||||||
style: ComponentStyle = dataclasses.field(default_factory=dict)
|
style: ComponentStyle = dataclasses.field(default_factory=dict)
|
||||||
|
|
||||||
# A list of URLs to [stylesheets](https://reflex.dev/docs/styling/custom-stylesheets/) to include in the app.
|
# A list of URLs to [stylesheets](https://reflex.dev/docs/styling/custom-stylesheets/) to include in the app.
|
||||||
stylesheets: List[str] = dataclasses.field(default_factory=list)
|
stylesheets: list[str] = dataclasses.field(default_factory=list)
|
||||||
|
|
||||||
# A component that is present on every page (defaults to the Connection Error banner).
|
# A component that is present on every page (defaults to the Connection Error banner).
|
||||||
overlay_component: Optional[Union[Component, ComponentCallable]] = (
|
overlay_component: Optional[Union[Component, ComponentCallable]] = (
|
||||||
@ -353,7 +352,7 @@ class App(MiddlewareMixin, LifespanMixin):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Components to add to the head of every page.
|
# Components to add to the head of every page.
|
||||||
head_components: List[Component] = dataclasses.field(default_factory=list)
|
head_components: list[Component] = dataclasses.field(default_factory=list)
|
||||||
|
|
||||||
# The Socket.IO AsyncServer instance.
|
# The Socket.IO AsyncServer instance.
|
||||||
sio: Optional[AsyncServer] = None
|
sio: Optional[AsyncServer] = None
|
||||||
@ -382,7 +381,7 @@ class App(MiddlewareMixin, LifespanMixin):
|
|||||||
_state_manager: Optional[StateManager] = None
|
_state_manager: Optional[StateManager] = None
|
||||||
|
|
||||||
# Mapping from a route to event handlers to trigger when the page loads.
|
# Mapping from a route to event handlers to trigger when the page loads.
|
||||||
_load_events: Dict[str, List[IndividualEventType[()]]] = dataclasses.field(
|
_load_events: Dict[str, list[IndividualEventType[()]]] = dataclasses.field(
|
||||||
default_factory=dict
|
default_factory=dict
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -402,7 +401,7 @@ class App(MiddlewareMixin, LifespanMixin):
|
|||||||
|
|
||||||
# Backend Error Handler Function
|
# Backend Error Handler Function
|
||||||
backend_exception_handler: Callable[
|
backend_exception_handler: Callable[
|
||||||
[Exception], Union[EventSpec, List[EventSpec], None]
|
[Exception], Union[EventSpec, list[EventSpec], None]
|
||||||
] = default_backend_exception_handler
|
] = default_backend_exception_handler
|
||||||
|
|
||||||
# Put the toast provider in the app wrap.
|
# Put the toast provider in the app wrap.
|
||||||
@ -1488,7 +1487,7 @@ class App(MiddlewareMixin, LifespanMixin):
|
|||||||
valid = bool(
|
valid = bool(
|
||||||
return_type == EventSpec
|
return_type == EventSpec
|
||||||
or return_type == Optional[EventSpec]
|
or return_type == Optional[EventSpec]
|
||||||
or return_type == List[EventSpec]
|
or return_type == list[EventSpec]
|
||||||
or return_type == inspect.Signature.empty
|
or return_type == inspect.Signature.empty
|
||||||
or return_type is None
|
or return_type is None
|
||||||
)
|
)
|
||||||
@ -1496,7 +1495,7 @@ class App(MiddlewareMixin, LifespanMixin):
|
|||||||
if not valid:
|
if not valid:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Provided custom {handler_domain} exception handler `{_fn_name}` has the wrong return type."
|
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 `Union[EventSpec, list[EventSpec], None]` but got `{return_type}`"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -1636,7 +1635,7 @@ def upload(app: App):
|
|||||||
The upload function.
|
The upload function.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
async def upload_file(request: Request, files: List[FastAPIUploadFile]):
|
async def upload_file(request: Request, files: list[FastAPIUploadFile]):
|
||||||
"""Upload a file.
|
"""Upload a file.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -1676,7 +1675,7 @@ def upload(app: App):
|
|||||||
# get handler function
|
# get handler function
|
||||||
func = getattr(type(current_state), handler.split(".")[-1])
|
func = getattr(type(current_state), handler.split(".")[-1])
|
||||||
|
|
||||||
# check if there exists any handler args with annotation, List[UploadFile]
|
# check if there exists any handler args with annotation, list[UploadFile]
|
||||||
if isinstance(func, EventHandler):
|
if isinstance(func, EventHandler):
|
||||||
if func.is_background:
|
if func.is_background:
|
||||||
raise UploadTypeError(
|
raise UploadTypeError(
|
||||||
@ -1696,7 +1695,7 @@ def upload(app: App):
|
|||||||
if not handler_upload_param:
|
if not handler_upload_param:
|
||||||
raise UploadValueError(
|
raise UploadValueError(
|
||||||
f"`{handler}` handler should have a parameter annotated as "
|
f"`{handler}` handler should have a parameter annotated as "
|
||||||
"List[rx.UploadFile]"
|
"list[rx.UploadFile]"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Make a copy of the files as they are closed after the request.
|
# Make a copy of the files as they are closed after the request.
|
||||||
|
@ -4,7 +4,6 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import dataclasses
|
import dataclasses
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from reflex.event import Event
|
from reflex.event import Event
|
||||||
from reflex.middleware import HydrateMiddleware, Middleware
|
from reflex.middleware import HydrateMiddleware, Middleware
|
||||||
@ -18,7 +17,7 @@ class MiddlewareMixin(AppMixin):
|
|||||||
"""Middleware Mixin that allow to add middleware to the app."""
|
"""Middleware Mixin that allow to add middleware to the app."""
|
||||||
|
|
||||||
# Middleware to add to the app. Users should use `add_middleware`. PRIVATE.
|
# Middleware to add to the app. Users should use `add_middleware`. PRIVATE.
|
||||||
middleware: List[Middleware] = dataclasses.field(default_factory=list)
|
middleware: list[Middleware] = dataclasses.field(default_factory=list)
|
||||||
|
|
||||||
def _init_mixin(self):
|
def _init_mixin(self):
|
||||||
self.middleware.append(HydrateMiddleware())
|
self.middleware.append(HydrateMiddleware())
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from typing import TYPE_CHECKING, Any, List, Type
|
from typing import TYPE_CHECKING, Any, Type
|
||||||
|
|
||||||
import pydantic.v1.main as pydantic_main
|
import pydantic.v1.main as pydantic_main
|
||||||
from pydantic.v1 import BaseModel
|
from pydantic.v1 import BaseModel
|
||||||
from pydantic.v1.fields import ModelField
|
from pydantic.v1.fields import ModelField
|
||||||
|
|
||||||
|
|
||||||
def validate_field_name(bases: List[Type["BaseModel"]], field_name: str) -> None:
|
def validate_field_name(bases: list[Type["BaseModel"]], field_name: str) -> None:
|
||||||
"""Ensure that the field's name does not shadow an existing attribute of the model.
|
"""Ensure that the field's name does not shadow an existing attribute of the model.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -72,16 +72,16 @@ class BaseComponent(Base, ABC):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# The children nested within the component.
|
# The children nested within the component.
|
||||||
children: List[BaseComponent] = []
|
children: list[BaseComponent] = []
|
||||||
|
|
||||||
# The library that the component is based on.
|
# The library that the component is based on.
|
||||||
library: Optional[str] = None
|
library: Optional[str] = None
|
||||||
|
|
||||||
# List here the non-react dependency needed by `library`
|
# List here the non-react dependency needed by `library`
|
||||||
lib_dependencies: List[str] = []
|
lib_dependencies: list[str] = []
|
||||||
|
|
||||||
# List here the dependencies that need to be transpiled by Next.js
|
# List here the dependencies that need to be transpiled by Next.js
|
||||||
transpile_packages: List[str] = []
|
transpile_packages: list[str] = []
|
||||||
|
|
||||||
# The tag to use when rendering the component.
|
# The tag to use when rendering the component.
|
||||||
tag: Optional[str] = None
|
tag: Optional[str] = None
|
||||||
@ -216,19 +216,19 @@ class Component(BaseComponent, ABC):
|
|||||||
class_name: Any = None
|
class_name: Any = None
|
||||||
|
|
||||||
# Special component props.
|
# Special component props.
|
||||||
special_props: List[Var] = []
|
special_props: list[Var] = []
|
||||||
|
|
||||||
# Whether the component should take the focus once the page is loaded
|
# Whether the component should take the focus once the page is loaded
|
||||||
autofocus: bool = False
|
autofocus: bool = False
|
||||||
|
|
||||||
# components that cannot be children
|
# components that cannot be children
|
||||||
_invalid_children: List[str] = []
|
_invalid_children: list[str] = []
|
||||||
|
|
||||||
# only components that are allowed as children
|
# only components that are allowed as children
|
||||||
_valid_children: List[str] = []
|
_valid_children: list[str] = []
|
||||||
|
|
||||||
# only components that are allowed as parent
|
# only components that are allowed as parent
|
||||||
_valid_parents: List[str] = []
|
_valid_parents: list[str] = []
|
||||||
|
|
||||||
# props to change the name of
|
# props to change the name of
|
||||||
_rename_props: Dict[str, str] = {}
|
_rename_props: Dict[str, str] = {}
|
||||||
@ -527,7 +527,7 @@ class Component(BaseComponent, ABC):
|
|||||||
if isinstance(class_name, (List, tuple)):
|
if isinstance(class_name, (List, tuple)):
|
||||||
if any(isinstance(c, Var) for c in class_name):
|
if any(isinstance(c, Var) for c in class_name):
|
||||||
kwargs["class_name"] = LiteralArrayVar.create(
|
kwargs["class_name"] = LiteralArrayVar.create(
|
||||||
class_name, _var_type=List[str]
|
class_name, _var_type=list[str]
|
||||||
).join(" ")
|
).join(" ")
|
||||||
else:
|
else:
|
||||||
kwargs["class_name"] = " ".join(class_name)
|
kwargs["class_name"] = " ".join(class_name)
|
||||||
@ -876,7 +876,7 @@ class Component(BaseComponent, ABC):
|
|||||||
if prop.startswith(old_prop):
|
if prop.startswith(old_prop):
|
||||||
rendered_dict["props"][ix] = prop.replace(old_prop, new_prop, 1)
|
rendered_dict["props"][ix] = prop.replace(old_prop, new_prop, 1)
|
||||||
|
|
||||||
def _validate_component_children(self, children: List[Component]):
|
def _validate_component_children(self, children: list[Component]):
|
||||||
"""Validate the children components.
|
"""Validate the children components.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -986,7 +986,7 @@ class Component(BaseComponent, ABC):
|
|||||||
Each var referenced by the component (props, styles, event handlers).
|
Each var referenced by the component (props, styles, event handlers).
|
||||||
"""
|
"""
|
||||||
ignore_ids = ignore_ids or set()
|
ignore_ids = ignore_ids or set()
|
||||||
vars: List[Var] | None = getattr(self, "__vars", None)
|
vars: list[Var] | None = getattr(self, "__vars", None)
|
||||||
if vars is not None:
|
if vars is not None:
|
||||||
yield from vars
|
yield from vars
|
||||||
vars = self.__vars = []
|
vars = self.__vars = []
|
||||||
@ -1181,7 +1181,7 @@ class Component(BaseComponent, ABC):
|
|||||||
# Return the dynamic imports
|
# Return the dynamic imports
|
||||||
return dynamic_imports
|
return dynamic_imports
|
||||||
|
|
||||||
def _get_props_imports(self) -> List[ParsedImportDict]:
|
def _get_props_imports(self) -> list[ParsedImportDict]:
|
||||||
"""Get the imports needed for components props.
|
"""Get the imports needed for components props.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -1756,7 +1756,7 @@ class CustomComponent(Component):
|
|||||||
"""
|
"""
|
||||||
return super()._render(props=self.props)
|
return super()._render(props=self.props)
|
||||||
|
|
||||||
def get_prop_vars(self) -> List[Var]:
|
def get_prop_vars(self) -> list[Var]:
|
||||||
"""Get the prop vars.
|
"""Get the prop vars.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Dict, List, Tuple, Union
|
from typing import Dict, Tuple, Union
|
||||||
|
|
||||||
from reflex.components.base.fragment import Fragment
|
from reflex.components.base.fragment import Fragment
|
||||||
from reflex.components.tags.tag import Tag
|
from reflex.components.tags.tag import Tag
|
||||||
@ -18,10 +18,10 @@ class Clipboard(Fragment):
|
|||||||
"""Clipboard component."""
|
"""Clipboard component."""
|
||||||
|
|
||||||
# The element ids to attach the event listener to. Defaults to all child components or the document.
|
# The element ids to attach the event listener to. Defaults to all child components or the document.
|
||||||
targets: Var[List[str]]
|
targets: Var[list[str]]
|
||||||
|
|
||||||
# Called when the user pastes data into the document. Data is a list of tuples of (mime_type, data). Binary types will be base64 encoded as a data uri.
|
# Called when the user pastes data into the document. Data is a list of tuples of (mime_type, data). Binary types will be base64 encoded as a data uri.
|
||||||
on_paste: EventHandler[passthrough_event_spec(List[Tuple[str, str]])]
|
on_paste: EventHandler[passthrough_event_spec(list[Tuple[str, str]])]
|
||||||
|
|
||||||
# Save the original event actions for the on_paste event.
|
# Save the original event actions for the on_paste event.
|
||||||
on_paste_event_actions: Var[Dict[str, Union[bool, int]]]
|
on_paste_event_actions: Var[Dict[str, Union[bool, int]]]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# ------------------- DO NOT EDIT ----------------------
|
# ------------------- DO NOT EDIT ----------------------
|
||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from typing import Any, Dict, List, Optional, Union, overload
|
from typing import Any, Dict, Optional, Union, overload
|
||||||
|
|
||||||
from reflex.components.base.fragment import Fragment
|
from reflex.components.base.fragment import Fragment
|
||||||
from reflex.event import EventType
|
from reflex.event import EventType
|
||||||
@ -17,7 +17,7 @@ class Clipboard(Fragment):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
targets: Optional[Union[List[str], Var[List[str]]]] = None,
|
targets: Optional[Union[Var[list[str]], list[str]]] = None,
|
||||||
on_paste_event_actions: Optional[
|
on_paste_event_actions: Optional[
|
||||||
Union[Dict[str, Union[bool, int]], Var[Dict[str, Union[bool, int]]]]
|
Union[Dict[str, Union[bool, int]], Var[Dict[str, Union[bool, int]]]]
|
||||||
] = None,
|
] = None,
|
||||||
|
@ -21,7 +21,7 @@ class Match(MemoizationLeaf):
|
|||||||
cond: Var[Any]
|
cond: Var[Any]
|
||||||
|
|
||||||
# The list of match cases to be matched.
|
# The list of match cases to be matched.
|
||||||
match_cases: List[Any] = []
|
match_cases: list[Any] = []
|
||||||
|
|
||||||
# The catchall case to match.
|
# The catchall case to match.
|
||||||
default: Any
|
default: Any
|
||||||
@ -125,7 +125,7 @@ class Match(MemoizationLeaf):
|
|||||||
return case_element
|
return case_element
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _process_match_cases(cls, cases: List) -> List[List[Var]]:
|
def _process_match_cases(cls, cases: List) -> list[list[Var]]:
|
||||||
"""Process the individual match cases.
|
"""Process the individual match cases.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -166,7 +166,7 @@ class Match(MemoizationLeaf):
|
|||||||
return match_cases
|
return match_cases
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _validate_return_types(cls, match_cases: List[List[Var]]) -> None:
|
def _validate_return_types(cls, match_cases: list[list[Var]]) -> None:
|
||||||
"""Validate that match cases have the same return types.
|
"""Validate that match cases have the same return types.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -195,7 +195,7 @@ class Match(MemoizationLeaf):
|
|||||||
def _create_match_cond_var_or_component(
|
def _create_match_cond_var_or_component(
|
||||||
cls,
|
cls,
|
||||||
match_cond_var: Var,
|
match_cond_var: Var,
|
||||||
match_cases: List[List[Var]],
|
match_cases: list[list[Var]],
|
||||||
default: Optional[Union[Var, BaseComponent]],
|
default: Optional[Union[Var, BaseComponent]],
|
||||||
) -> Union[Component, Var]:
|
) -> Union[Component, Var]:
|
||||||
"""Create and return the match condition var or component.
|
"""Create and return the match condition var or component.
|
||||||
|
@ -86,7 +86,7 @@ def selected_files(id_: str = DEFAULT_UPLOAD_ID) -> Var:
|
|||||||
id_var = LiteralStringVar.create(id_)
|
id_var = LiteralStringVar.create(id_)
|
||||||
return Var(
|
return Var(
|
||||||
_js_expr=f"(filesById[{id_var!s}] ? filesById[{id_var!s}].map((f) => (f.path || f.name)) : [])",
|
_js_expr=f"(filesById[{id_var!s}] ? filesById[{id_var!s}].map((f) => (f.path || f.name)) : [])",
|
||||||
_var_type=List[str],
|
_var_type=list[str],
|
||||||
_var_data=VarData.merge(
|
_var_data=VarData.merge(
|
||||||
upload_files_context_var_data, id_var._get_all_var_data()
|
upload_files_context_var_data, id_var._get_all_var_data()
|
||||||
),
|
),
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any, Dict, List, Literal, Optional, Tuple, TypedDict, Union
|
from typing import Any, Dict, Literal, Optional, Tuple, TypedDict, Union
|
||||||
|
|
||||||
from reflex.base import Base
|
from reflex.base import Base
|
||||||
from reflex.components.component import Component, NoSSRComponent
|
from reflex.components.component import Component, NoSSRComponent
|
||||||
@ -148,7 +148,7 @@ class GroupHeaderClickedEventArgs(TypedDict):
|
|||||||
class GridCell(TypedDict):
|
class GridCell(TypedDict):
|
||||||
"""The grid cell."""
|
"""The grid cell."""
|
||||||
|
|
||||||
span: Optional[List[int]]
|
span: Optional[list[int]]
|
||||||
|
|
||||||
|
|
||||||
class GridColumn(TypedDict):
|
class GridColumn(TypedDict):
|
||||||
@ -164,7 +164,7 @@ class DataEditor(NoSSRComponent):
|
|||||||
tag = "DataEditor"
|
tag = "DataEditor"
|
||||||
is_default = True
|
is_default = True
|
||||||
library: str | None = "@glideapps/glide-data-grid@^6.0.3"
|
library: str | None = "@glideapps/glide-data-grid@^6.0.3"
|
||||||
lib_dependencies: List[str] = [
|
lib_dependencies: list[str] = [
|
||||||
"lodash@^4.17.21",
|
"lodash@^4.17.21",
|
||||||
"react-responsive-carousel@^3.2.7",
|
"react-responsive-carousel@^3.2.7",
|
||||||
]
|
]
|
||||||
@ -173,10 +173,10 @@ class DataEditor(NoSSRComponent):
|
|||||||
rows: Var[int]
|
rows: Var[int]
|
||||||
|
|
||||||
# Headers of the columns for the data grid.
|
# Headers of the columns for the data grid.
|
||||||
columns: Var[List[Dict[str, Any]]]
|
columns: Var[list[Dict[str, Any]]]
|
||||||
|
|
||||||
# The data.
|
# The data.
|
||||||
data: Var[List[List[Any]]]
|
data: Var[list[list[Any]]]
|
||||||
|
|
||||||
# The name of the callback used to find the data to display.
|
# The name of the callback used to find the data to display.
|
||||||
get_cell_content: Var[str]
|
get_cell_content: Var[str]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any, Dict, List, Literal, Optional, TypedDict, Union, overload
|
from typing import Any, Dict, Literal, Optional, TypedDict, Union, overload
|
||||||
|
|
||||||
from reflex.base import Base
|
from reflex.base import Base
|
||||||
from reflex.components.component import NoSSRComponent
|
from reflex.components.component import NoSSRComponent
|
||||||
@ -118,7 +118,7 @@ class GroupHeaderClickedEventArgs(TypedDict):
|
|||||||
scrollEdge: tuple[int, int]
|
scrollEdge: tuple[int, int]
|
||||||
|
|
||||||
class GridCell(TypedDict):
|
class GridCell(TypedDict):
|
||||||
span: Optional[List[int]]
|
span: Optional[list[int]]
|
||||||
|
|
||||||
class GridColumn(TypedDict):
|
class GridColumn(TypedDict):
|
||||||
title: str
|
title: str
|
||||||
@ -134,9 +134,9 @@ class DataEditor(NoSSRComponent):
|
|||||||
*children,
|
*children,
|
||||||
rows: Optional[Union[Var[int], int]] = None,
|
rows: Optional[Union[Var[int], int]] = None,
|
||||||
columns: Optional[
|
columns: Optional[
|
||||||
Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]
|
Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]
|
||||||
] = None,
|
] = None,
|
||||||
data: Optional[Union[List[List[Any]], Var[List[List[Any]]]]] = None,
|
data: Optional[Union[Var[list[list[Any]]], list[list[Any]]]] = None,
|
||||||
get_cell_content: Optional[Union[Var[str], str]] = None,
|
get_cell_content: Optional[Union[Var[str], str]] = None,
|
||||||
get_cells_for_selection: Optional[Union[Var[bool], bool]] = None,
|
get_cells_for_selection: Optional[Union[Var[bool], bool]] = None,
|
||||||
on_paste: Optional[Union[Var[bool], bool]] = None,
|
on_paste: Optional[Union[Var[bool], bool]] = None,
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
"""Metadata classes."""
|
"""Metadata classes."""
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from reflex.components.el.element import Element
|
from reflex.components.el.element import Element
|
||||||
from reflex.components.el.elements.inline import ReferrerPolicy
|
from reflex.components.el.elements.inline import ReferrerPolicy
|
||||||
from reflex.components.el.elements.media import CrossOrigin
|
from reflex.components.el.elements.media import CrossOrigin
|
||||||
@ -91,7 +89,7 @@ class StyleEl(Element):
|
|||||||
|
|
||||||
media: Var[str]
|
media: Var[str]
|
||||||
|
|
||||||
special_props: List[Var] = [Var(_js_expr="suppressHydrationWarning")]
|
special_props: list[Var] = [Var(_js_expr="suppressHydrationWarning")]
|
||||||
|
|
||||||
|
|
||||||
base = Base.create
|
base = Base.create
|
||||||
|
@ -17,7 +17,7 @@ class Gridjs(Component):
|
|||||||
|
|
||||||
library = "gridjs-react@6.1.1"
|
library = "gridjs-react@6.1.1"
|
||||||
|
|
||||||
lib_dependencies: List[str] = ["gridjs@6.2.0"]
|
lib_dependencies: list[str] = ["gridjs@6.2.0"]
|
||||||
|
|
||||||
|
|
||||||
class DataTable(Gridjs):
|
class DataTable(Gridjs):
|
||||||
@ -115,11 +115,11 @@ class DataTable(Gridjs):
|
|||||||
if isinstance(self.data, Var) and types.is_dataframe(self.data._var_type):
|
if isinstance(self.data, Var) and types.is_dataframe(self.data._var_type):
|
||||||
self.columns = self.data._replace(
|
self.columns = self.data._replace(
|
||||||
_js_expr=f"{self.data._js_expr}.columns",
|
_js_expr=f"{self.data._js_expr}.columns",
|
||||||
_var_type=List[Any],
|
_var_type=list[Any],
|
||||||
)
|
)
|
||||||
self.data = self.data._replace(
|
self.data = self.data._replace(
|
||||||
_js_expr=f"{self.data._js_expr}.data",
|
_js_expr=f"{self.data._js_expr}.data",
|
||||||
_var_type=List[List[Any]],
|
_var_type=list[list[Any]],
|
||||||
)
|
)
|
||||||
if types.is_dataframe(type(self.data)):
|
if types.is_dataframe(type(self.data)):
|
||||||
# If given a pandas df break up the data and columns
|
# If given a pandas df break up the data and columns
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
from datetime import date, datetime, time, timedelta
|
from datetime import date, datetime, time, timedelta
|
||||||
from typing import List, Optional, Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
from reflex.components.component import NoSSRComponent
|
from reflex.components.component import NoSSRComponent
|
||||||
from reflex.event import EventHandler, passthrough_event_spec
|
from reflex.event import EventHandler, passthrough_event_spec
|
||||||
@ -31,7 +31,7 @@ class Moment(NoSSRComponent):
|
|||||||
tag: str | None = "Moment"
|
tag: str | None = "Moment"
|
||||||
is_default = True
|
is_default = True
|
||||||
library: str | None = "react-moment"
|
library: str | None = "react-moment"
|
||||||
lib_dependencies: List[str] = ["moment"]
|
lib_dependencies: list[str] = ["moment"]
|
||||||
|
|
||||||
# How often the date update (how often time update / 0 to disable).
|
# How often the date update (how often time update / 0 to disable).
|
||||||
interval: Var[int]
|
interval: Var[int]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Dict, List, Tuple, TypedDict, TypeVar, Union
|
from typing import Any, Dict, Tuple, TypedDict, TypeVar, Union
|
||||||
|
|
||||||
from reflex.components.component import Component, NoSSRComponent
|
from reflex.components.component import Component, NoSSRComponent
|
||||||
from reflex.components.core.cond import color_mode_cond
|
from reflex.components.core.cond import color_mode_cond
|
||||||
@ -21,7 +21,7 @@ except ImportError:
|
|||||||
Template = Any
|
Template = Any
|
||||||
|
|
||||||
|
|
||||||
def _event_points_data_signature(e0: Var) -> Tuple[Var[List[Point]]]:
|
def _event_points_data_signature(e0: Var) -> Tuple[Var[list[Point]]]:
|
||||||
"""For plotly events with event data containing a point array.
|
"""For plotly events with event data containing a point array.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -35,7 +35,7 @@ def _event_points_data_signature(e0: Var) -> Tuple[Var[List[Point]]]:
|
|||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|
||||||
ItemOrList = Union[T, List[T]]
|
ItemOrList = Union[T, list[T]]
|
||||||
|
|
||||||
|
|
||||||
class BBox(TypedDict):
|
class BBox(TypedDict):
|
||||||
@ -59,7 +59,7 @@ class Point(TypedDict):
|
|||||||
lon: Union[float, int, None]
|
lon: Union[float, int, None]
|
||||||
curveNumber: Union[int, None]
|
curveNumber: Union[int, None]
|
||||||
pointNumber: Union[int, None]
|
pointNumber: Union[int, None]
|
||||||
pointNumbers: Union[List[int], None]
|
pointNumbers: Union[list[int], None]
|
||||||
pointIndex: Union[int, None]
|
pointIndex: Union[int, None]
|
||||||
markerColor: Union[
|
markerColor: Union[
|
||||||
ItemOrList[
|
ItemOrList[
|
||||||
@ -94,7 +94,7 @@ class Plotly(NoSSRComponent):
|
|||||||
|
|
||||||
library = "react-plotly.js@2.6.0"
|
library = "react-plotly.js@2.6.0"
|
||||||
|
|
||||||
lib_dependencies: List[str] = ["plotly.js@2.35.3"]
|
lib_dependencies: list[str] = ["plotly.js@2.35.3"]
|
||||||
|
|
||||||
tag = "Plot"
|
tag = "Plot"
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# ------------------- DO NOT EDIT ----------------------
|
# ------------------- DO NOT EDIT ----------------------
|
||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from typing import Any, Dict, List, Optional, TypedDict, TypeVar, Union, overload
|
from typing import Any, Dict, Optional, TypedDict, TypeVar, Union, overload
|
||||||
|
|
||||||
from reflex.components.component import NoSSRComponent
|
from reflex.components.component import NoSSRComponent
|
||||||
from reflex.event import EventType
|
from reflex.event import EventType
|
||||||
@ -21,7 +21,7 @@ except ImportError:
|
|||||||
Figure = Any
|
Figure = Any
|
||||||
Template = Any
|
Template = Any
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
ItemOrList = Union[T, List[T]]
|
ItemOrList = Union[T, list[T]]
|
||||||
|
|
||||||
class BBox(TypedDict):
|
class BBox(TypedDict):
|
||||||
x0: Union[float, int, None]
|
x0: Union[float, int, None]
|
||||||
@ -39,7 +39,7 @@ class Point(TypedDict):
|
|||||||
lon: Union[float, int, None]
|
lon: Union[float, int, None]
|
||||||
curveNumber: Union[int, None]
|
curveNumber: Union[int, None]
|
||||||
pointNumber: Union[int, None]
|
pointNumber: Union[int, None]
|
||||||
pointNumbers: Union[List[int], None]
|
pointNumbers: Union[list[int], None]
|
||||||
pointIndex: Union[int, None]
|
pointIndex: Union[int, None]
|
||||||
markerColor: Union[ItemOrList[ItemOrList[Union[float, int, str, None]]], None]
|
markerColor: Union[ItemOrList[ItemOrList[Union[float, int, str, None]]], None]
|
||||||
markerSize: Union[ItemOrList[ItemOrList[Union[float, int, None]]], None]
|
markerSize: Union[ItemOrList[ItemOrList[Union[float, int, None]]], None]
|
||||||
@ -72,12 +72,12 @@ class Plotly(NoSSRComponent):
|
|||||||
on_before_hover: Optional[EventType[()]] = None,
|
on_before_hover: Optional[EventType[()]] = None,
|
||||||
on_blur: Optional[EventType[()]] = None,
|
on_blur: Optional[EventType[()]] = None,
|
||||||
on_button_clicked: Optional[EventType[()]] = None,
|
on_button_clicked: Optional[EventType[()]] = None,
|
||||||
on_click: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_click: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_context_menu: Optional[EventType[()]] = None,
|
on_context_menu: Optional[EventType[()]] = None,
|
||||||
on_deselect: Optional[EventType[()]] = None,
|
on_deselect: Optional[EventType[()]] = None,
|
||||||
on_double_click: Optional[EventType[()]] = None,
|
on_double_click: Optional[EventType[()]] = None,
|
||||||
on_focus: Optional[EventType[()]] = None,
|
on_focus: Optional[EventType[()]] = None,
|
||||||
on_hover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_hover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_mount: Optional[EventType[()]] = None,
|
on_mount: Optional[EventType[()]] = None,
|
||||||
on_mouse_down: Optional[EventType[()]] = None,
|
on_mouse_down: Optional[EventType[()]] = None,
|
||||||
on_mouse_enter: Optional[EventType[()]] = None,
|
on_mouse_enter: Optional[EventType[()]] = None,
|
||||||
@ -91,11 +91,11 @@ class Plotly(NoSSRComponent):
|
|||||||
on_relayouting: Optional[EventType[()]] = None,
|
on_relayouting: Optional[EventType[()]] = None,
|
||||||
on_restyle: Optional[EventType[()]] = None,
|
on_restyle: Optional[EventType[()]] = None,
|
||||||
on_scroll: Optional[EventType[()]] = None,
|
on_scroll: Optional[EventType[()]] = None,
|
||||||
on_selected: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selected: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_selecting: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selecting: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_transition_interrupted: Optional[EventType[()]] = None,
|
on_transition_interrupted: Optional[EventType[()]] = None,
|
||||||
on_transitioning: Optional[EventType[()]] = None,
|
on_transitioning: Optional[EventType[()]] = None,
|
||||||
on_unhover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_unhover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_unmount: Optional[EventType[()]] = None,
|
on_unmount: Optional[EventType[()]] = None,
|
||||||
**props,
|
**props,
|
||||||
) -> "Plotly":
|
) -> "Plotly":
|
||||||
@ -171,12 +171,12 @@ class PlotlyBasic(Plotly):
|
|||||||
on_before_hover: Optional[EventType[()]] = None,
|
on_before_hover: Optional[EventType[()]] = None,
|
||||||
on_blur: Optional[EventType[()]] = None,
|
on_blur: Optional[EventType[()]] = None,
|
||||||
on_button_clicked: Optional[EventType[()]] = None,
|
on_button_clicked: Optional[EventType[()]] = None,
|
||||||
on_click: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_click: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_context_menu: Optional[EventType[()]] = None,
|
on_context_menu: Optional[EventType[()]] = None,
|
||||||
on_deselect: Optional[EventType[()]] = None,
|
on_deselect: Optional[EventType[()]] = None,
|
||||||
on_double_click: Optional[EventType[()]] = None,
|
on_double_click: Optional[EventType[()]] = None,
|
||||||
on_focus: Optional[EventType[()]] = None,
|
on_focus: Optional[EventType[()]] = None,
|
||||||
on_hover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_hover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_mount: Optional[EventType[()]] = None,
|
on_mount: Optional[EventType[()]] = None,
|
||||||
on_mouse_down: Optional[EventType[()]] = None,
|
on_mouse_down: Optional[EventType[()]] = None,
|
||||||
on_mouse_enter: Optional[EventType[()]] = None,
|
on_mouse_enter: Optional[EventType[()]] = None,
|
||||||
@ -190,11 +190,11 @@ class PlotlyBasic(Plotly):
|
|||||||
on_relayouting: Optional[EventType[()]] = None,
|
on_relayouting: Optional[EventType[()]] = None,
|
||||||
on_restyle: Optional[EventType[()]] = None,
|
on_restyle: Optional[EventType[()]] = None,
|
||||||
on_scroll: Optional[EventType[()]] = None,
|
on_scroll: Optional[EventType[()]] = None,
|
||||||
on_selected: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selected: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_selecting: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selecting: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_transition_interrupted: Optional[EventType[()]] = None,
|
on_transition_interrupted: Optional[EventType[()]] = None,
|
||||||
on_transitioning: Optional[EventType[()]] = None,
|
on_transitioning: Optional[EventType[()]] = None,
|
||||||
on_unhover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_unhover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_unmount: Optional[EventType[()]] = None,
|
on_unmount: Optional[EventType[()]] = None,
|
||||||
**props,
|
**props,
|
||||||
) -> "PlotlyBasic":
|
) -> "PlotlyBasic":
|
||||||
@ -266,12 +266,12 @@ class PlotlyCartesian(Plotly):
|
|||||||
on_before_hover: Optional[EventType[()]] = None,
|
on_before_hover: Optional[EventType[()]] = None,
|
||||||
on_blur: Optional[EventType[()]] = None,
|
on_blur: Optional[EventType[()]] = None,
|
||||||
on_button_clicked: Optional[EventType[()]] = None,
|
on_button_clicked: Optional[EventType[()]] = None,
|
||||||
on_click: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_click: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_context_menu: Optional[EventType[()]] = None,
|
on_context_menu: Optional[EventType[()]] = None,
|
||||||
on_deselect: Optional[EventType[()]] = None,
|
on_deselect: Optional[EventType[()]] = None,
|
||||||
on_double_click: Optional[EventType[()]] = None,
|
on_double_click: Optional[EventType[()]] = None,
|
||||||
on_focus: Optional[EventType[()]] = None,
|
on_focus: Optional[EventType[()]] = None,
|
||||||
on_hover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_hover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_mount: Optional[EventType[()]] = None,
|
on_mount: Optional[EventType[()]] = None,
|
||||||
on_mouse_down: Optional[EventType[()]] = None,
|
on_mouse_down: Optional[EventType[()]] = None,
|
||||||
on_mouse_enter: Optional[EventType[()]] = None,
|
on_mouse_enter: Optional[EventType[()]] = None,
|
||||||
@ -285,11 +285,11 @@ class PlotlyCartesian(Plotly):
|
|||||||
on_relayouting: Optional[EventType[()]] = None,
|
on_relayouting: Optional[EventType[()]] = None,
|
||||||
on_restyle: Optional[EventType[()]] = None,
|
on_restyle: Optional[EventType[()]] = None,
|
||||||
on_scroll: Optional[EventType[()]] = None,
|
on_scroll: Optional[EventType[()]] = None,
|
||||||
on_selected: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selected: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_selecting: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selecting: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_transition_interrupted: Optional[EventType[()]] = None,
|
on_transition_interrupted: Optional[EventType[()]] = None,
|
||||||
on_transitioning: Optional[EventType[()]] = None,
|
on_transitioning: Optional[EventType[()]] = None,
|
||||||
on_unhover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_unhover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_unmount: Optional[EventType[()]] = None,
|
on_unmount: Optional[EventType[()]] = None,
|
||||||
**props,
|
**props,
|
||||||
) -> "PlotlyCartesian":
|
) -> "PlotlyCartesian":
|
||||||
@ -361,12 +361,12 @@ class PlotlyGeo(Plotly):
|
|||||||
on_before_hover: Optional[EventType[()]] = None,
|
on_before_hover: Optional[EventType[()]] = None,
|
||||||
on_blur: Optional[EventType[()]] = None,
|
on_blur: Optional[EventType[()]] = None,
|
||||||
on_button_clicked: Optional[EventType[()]] = None,
|
on_button_clicked: Optional[EventType[()]] = None,
|
||||||
on_click: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_click: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_context_menu: Optional[EventType[()]] = None,
|
on_context_menu: Optional[EventType[()]] = None,
|
||||||
on_deselect: Optional[EventType[()]] = None,
|
on_deselect: Optional[EventType[()]] = None,
|
||||||
on_double_click: Optional[EventType[()]] = None,
|
on_double_click: Optional[EventType[()]] = None,
|
||||||
on_focus: Optional[EventType[()]] = None,
|
on_focus: Optional[EventType[()]] = None,
|
||||||
on_hover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_hover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_mount: Optional[EventType[()]] = None,
|
on_mount: Optional[EventType[()]] = None,
|
||||||
on_mouse_down: Optional[EventType[()]] = None,
|
on_mouse_down: Optional[EventType[()]] = None,
|
||||||
on_mouse_enter: Optional[EventType[()]] = None,
|
on_mouse_enter: Optional[EventType[()]] = None,
|
||||||
@ -380,11 +380,11 @@ class PlotlyGeo(Plotly):
|
|||||||
on_relayouting: Optional[EventType[()]] = None,
|
on_relayouting: Optional[EventType[()]] = None,
|
||||||
on_restyle: Optional[EventType[()]] = None,
|
on_restyle: Optional[EventType[()]] = None,
|
||||||
on_scroll: Optional[EventType[()]] = None,
|
on_scroll: Optional[EventType[()]] = None,
|
||||||
on_selected: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selected: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_selecting: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selecting: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_transition_interrupted: Optional[EventType[()]] = None,
|
on_transition_interrupted: Optional[EventType[()]] = None,
|
||||||
on_transitioning: Optional[EventType[()]] = None,
|
on_transitioning: Optional[EventType[()]] = None,
|
||||||
on_unhover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_unhover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_unmount: Optional[EventType[()]] = None,
|
on_unmount: Optional[EventType[()]] = None,
|
||||||
**props,
|
**props,
|
||||||
) -> "PlotlyGeo":
|
) -> "PlotlyGeo":
|
||||||
@ -456,12 +456,12 @@ class PlotlyGl3d(Plotly):
|
|||||||
on_before_hover: Optional[EventType[()]] = None,
|
on_before_hover: Optional[EventType[()]] = None,
|
||||||
on_blur: Optional[EventType[()]] = None,
|
on_blur: Optional[EventType[()]] = None,
|
||||||
on_button_clicked: Optional[EventType[()]] = None,
|
on_button_clicked: Optional[EventType[()]] = None,
|
||||||
on_click: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_click: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_context_menu: Optional[EventType[()]] = None,
|
on_context_menu: Optional[EventType[()]] = None,
|
||||||
on_deselect: Optional[EventType[()]] = None,
|
on_deselect: Optional[EventType[()]] = None,
|
||||||
on_double_click: Optional[EventType[()]] = None,
|
on_double_click: Optional[EventType[()]] = None,
|
||||||
on_focus: Optional[EventType[()]] = None,
|
on_focus: Optional[EventType[()]] = None,
|
||||||
on_hover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_hover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_mount: Optional[EventType[()]] = None,
|
on_mount: Optional[EventType[()]] = None,
|
||||||
on_mouse_down: Optional[EventType[()]] = None,
|
on_mouse_down: Optional[EventType[()]] = None,
|
||||||
on_mouse_enter: Optional[EventType[()]] = None,
|
on_mouse_enter: Optional[EventType[()]] = None,
|
||||||
@ -475,11 +475,11 @@ class PlotlyGl3d(Plotly):
|
|||||||
on_relayouting: Optional[EventType[()]] = None,
|
on_relayouting: Optional[EventType[()]] = None,
|
||||||
on_restyle: Optional[EventType[()]] = None,
|
on_restyle: Optional[EventType[()]] = None,
|
||||||
on_scroll: Optional[EventType[()]] = None,
|
on_scroll: Optional[EventType[()]] = None,
|
||||||
on_selected: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selected: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_selecting: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selecting: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_transition_interrupted: Optional[EventType[()]] = None,
|
on_transition_interrupted: Optional[EventType[()]] = None,
|
||||||
on_transitioning: Optional[EventType[()]] = None,
|
on_transitioning: Optional[EventType[()]] = None,
|
||||||
on_unhover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_unhover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_unmount: Optional[EventType[()]] = None,
|
on_unmount: Optional[EventType[()]] = None,
|
||||||
**props,
|
**props,
|
||||||
) -> "PlotlyGl3d":
|
) -> "PlotlyGl3d":
|
||||||
@ -551,12 +551,12 @@ class PlotlyGl2d(Plotly):
|
|||||||
on_before_hover: Optional[EventType[()]] = None,
|
on_before_hover: Optional[EventType[()]] = None,
|
||||||
on_blur: Optional[EventType[()]] = None,
|
on_blur: Optional[EventType[()]] = None,
|
||||||
on_button_clicked: Optional[EventType[()]] = None,
|
on_button_clicked: Optional[EventType[()]] = None,
|
||||||
on_click: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_click: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_context_menu: Optional[EventType[()]] = None,
|
on_context_menu: Optional[EventType[()]] = None,
|
||||||
on_deselect: Optional[EventType[()]] = None,
|
on_deselect: Optional[EventType[()]] = None,
|
||||||
on_double_click: Optional[EventType[()]] = None,
|
on_double_click: Optional[EventType[()]] = None,
|
||||||
on_focus: Optional[EventType[()]] = None,
|
on_focus: Optional[EventType[()]] = None,
|
||||||
on_hover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_hover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_mount: Optional[EventType[()]] = None,
|
on_mount: Optional[EventType[()]] = None,
|
||||||
on_mouse_down: Optional[EventType[()]] = None,
|
on_mouse_down: Optional[EventType[()]] = None,
|
||||||
on_mouse_enter: Optional[EventType[()]] = None,
|
on_mouse_enter: Optional[EventType[()]] = None,
|
||||||
@ -570,11 +570,11 @@ class PlotlyGl2d(Plotly):
|
|||||||
on_relayouting: Optional[EventType[()]] = None,
|
on_relayouting: Optional[EventType[()]] = None,
|
||||||
on_restyle: Optional[EventType[()]] = None,
|
on_restyle: Optional[EventType[()]] = None,
|
||||||
on_scroll: Optional[EventType[()]] = None,
|
on_scroll: Optional[EventType[()]] = None,
|
||||||
on_selected: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selected: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_selecting: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selecting: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_transition_interrupted: Optional[EventType[()]] = None,
|
on_transition_interrupted: Optional[EventType[()]] = None,
|
||||||
on_transitioning: Optional[EventType[()]] = None,
|
on_transitioning: Optional[EventType[()]] = None,
|
||||||
on_unhover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_unhover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_unmount: Optional[EventType[()]] = None,
|
on_unmount: Optional[EventType[()]] = None,
|
||||||
**props,
|
**props,
|
||||||
) -> "PlotlyGl2d":
|
) -> "PlotlyGl2d":
|
||||||
@ -646,12 +646,12 @@ class PlotlyMapbox(Plotly):
|
|||||||
on_before_hover: Optional[EventType[()]] = None,
|
on_before_hover: Optional[EventType[()]] = None,
|
||||||
on_blur: Optional[EventType[()]] = None,
|
on_blur: Optional[EventType[()]] = None,
|
||||||
on_button_clicked: Optional[EventType[()]] = None,
|
on_button_clicked: Optional[EventType[()]] = None,
|
||||||
on_click: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_click: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_context_menu: Optional[EventType[()]] = None,
|
on_context_menu: Optional[EventType[()]] = None,
|
||||||
on_deselect: Optional[EventType[()]] = None,
|
on_deselect: Optional[EventType[()]] = None,
|
||||||
on_double_click: Optional[EventType[()]] = None,
|
on_double_click: Optional[EventType[()]] = None,
|
||||||
on_focus: Optional[EventType[()]] = None,
|
on_focus: Optional[EventType[()]] = None,
|
||||||
on_hover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_hover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_mount: Optional[EventType[()]] = None,
|
on_mount: Optional[EventType[()]] = None,
|
||||||
on_mouse_down: Optional[EventType[()]] = None,
|
on_mouse_down: Optional[EventType[()]] = None,
|
||||||
on_mouse_enter: Optional[EventType[()]] = None,
|
on_mouse_enter: Optional[EventType[()]] = None,
|
||||||
@ -665,11 +665,11 @@ class PlotlyMapbox(Plotly):
|
|||||||
on_relayouting: Optional[EventType[()]] = None,
|
on_relayouting: Optional[EventType[()]] = None,
|
||||||
on_restyle: Optional[EventType[()]] = None,
|
on_restyle: Optional[EventType[()]] = None,
|
||||||
on_scroll: Optional[EventType[()]] = None,
|
on_scroll: Optional[EventType[()]] = None,
|
||||||
on_selected: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selected: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_selecting: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selecting: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_transition_interrupted: Optional[EventType[()]] = None,
|
on_transition_interrupted: Optional[EventType[()]] = None,
|
||||||
on_transitioning: Optional[EventType[()]] = None,
|
on_transitioning: Optional[EventType[()]] = None,
|
||||||
on_unhover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_unhover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_unmount: Optional[EventType[()]] = None,
|
on_unmount: Optional[EventType[()]] = None,
|
||||||
**props,
|
**props,
|
||||||
) -> "PlotlyMapbox":
|
) -> "PlotlyMapbox":
|
||||||
@ -741,12 +741,12 @@ class PlotlyFinance(Plotly):
|
|||||||
on_before_hover: Optional[EventType[()]] = None,
|
on_before_hover: Optional[EventType[()]] = None,
|
||||||
on_blur: Optional[EventType[()]] = None,
|
on_blur: Optional[EventType[()]] = None,
|
||||||
on_button_clicked: Optional[EventType[()]] = None,
|
on_button_clicked: Optional[EventType[()]] = None,
|
||||||
on_click: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_click: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_context_menu: Optional[EventType[()]] = None,
|
on_context_menu: Optional[EventType[()]] = None,
|
||||||
on_deselect: Optional[EventType[()]] = None,
|
on_deselect: Optional[EventType[()]] = None,
|
||||||
on_double_click: Optional[EventType[()]] = None,
|
on_double_click: Optional[EventType[()]] = None,
|
||||||
on_focus: Optional[EventType[()]] = None,
|
on_focus: Optional[EventType[()]] = None,
|
||||||
on_hover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_hover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_mount: Optional[EventType[()]] = None,
|
on_mount: Optional[EventType[()]] = None,
|
||||||
on_mouse_down: Optional[EventType[()]] = None,
|
on_mouse_down: Optional[EventType[()]] = None,
|
||||||
on_mouse_enter: Optional[EventType[()]] = None,
|
on_mouse_enter: Optional[EventType[()]] = None,
|
||||||
@ -760,11 +760,11 @@ class PlotlyFinance(Plotly):
|
|||||||
on_relayouting: Optional[EventType[()]] = None,
|
on_relayouting: Optional[EventType[()]] = None,
|
||||||
on_restyle: Optional[EventType[()]] = None,
|
on_restyle: Optional[EventType[()]] = None,
|
||||||
on_scroll: Optional[EventType[()]] = None,
|
on_scroll: Optional[EventType[()]] = None,
|
||||||
on_selected: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selected: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_selecting: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selecting: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_transition_interrupted: Optional[EventType[()]] = None,
|
on_transition_interrupted: Optional[EventType[()]] = None,
|
||||||
on_transitioning: Optional[EventType[()]] = None,
|
on_transitioning: Optional[EventType[()]] = None,
|
||||||
on_unhover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_unhover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_unmount: Optional[EventType[()]] = None,
|
on_unmount: Optional[EventType[()]] = None,
|
||||||
**props,
|
**props,
|
||||||
) -> "PlotlyFinance":
|
) -> "PlotlyFinance":
|
||||||
@ -836,12 +836,12 @@ class PlotlyStrict(Plotly):
|
|||||||
on_before_hover: Optional[EventType[()]] = None,
|
on_before_hover: Optional[EventType[()]] = None,
|
||||||
on_blur: Optional[EventType[()]] = None,
|
on_blur: Optional[EventType[()]] = None,
|
||||||
on_button_clicked: Optional[EventType[()]] = None,
|
on_button_clicked: Optional[EventType[()]] = None,
|
||||||
on_click: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_click: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_context_menu: Optional[EventType[()]] = None,
|
on_context_menu: Optional[EventType[()]] = None,
|
||||||
on_deselect: Optional[EventType[()]] = None,
|
on_deselect: Optional[EventType[()]] = None,
|
||||||
on_double_click: Optional[EventType[()]] = None,
|
on_double_click: Optional[EventType[()]] = None,
|
||||||
on_focus: Optional[EventType[()]] = None,
|
on_focus: Optional[EventType[()]] = None,
|
||||||
on_hover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_hover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_mount: Optional[EventType[()]] = None,
|
on_mount: Optional[EventType[()]] = None,
|
||||||
on_mouse_down: Optional[EventType[()]] = None,
|
on_mouse_down: Optional[EventType[()]] = None,
|
||||||
on_mouse_enter: Optional[EventType[()]] = None,
|
on_mouse_enter: Optional[EventType[()]] = None,
|
||||||
@ -855,11 +855,11 @@ class PlotlyStrict(Plotly):
|
|||||||
on_relayouting: Optional[EventType[()]] = None,
|
on_relayouting: Optional[EventType[()]] = None,
|
||||||
on_restyle: Optional[EventType[()]] = None,
|
on_restyle: Optional[EventType[()]] = None,
|
||||||
on_scroll: Optional[EventType[()]] = None,
|
on_scroll: Optional[EventType[()]] = None,
|
||||||
on_selected: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selected: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_selecting: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_selecting: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_transition_interrupted: Optional[EventType[()]] = None,
|
on_transition_interrupted: Optional[EventType[()]] = None,
|
||||||
on_transitioning: Optional[EventType[()]] = None,
|
on_transitioning: Optional[EventType[()]] = None,
|
||||||
on_unhover: Optional[Union[EventType[()], EventType[List[Point]]]] = None,
|
on_unhover: Optional[Union[EventType[()], EventType[list[Point]]]] = None,
|
||||||
on_unmount: Optional[EventType[()]] = None,
|
on_unmount: Optional[EventType[()]] = None,
|
||||||
**props,
|
**props,
|
||||||
) -> "PlotlyStrict":
|
) -> "PlotlyStrict":
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, List, Literal, Tuple, Union
|
from typing import Any, Literal, Tuple, Union
|
||||||
|
|
||||||
from reflex.components.component import Component, ComponentNamespace
|
from reflex.components.component import Component, ComponentNamespace
|
||||||
from reflex.components.core.colors import color
|
from reflex.components.core.colors import color
|
||||||
@ -72,7 +72,7 @@ class AccordionComponent(RadixPrimitiveComponent):
|
|||||||
return ["color_scheme", "variant"]
|
return ["color_scheme", "variant"]
|
||||||
|
|
||||||
|
|
||||||
def on_value_change(value: Var[str | List[str]]) -> Tuple[Var[str | List[str]]]:
|
def on_value_change(value: Var[str | list[str]]) -> Tuple[Var[str | list[str]]]:
|
||||||
"""Handle the on_value_change event.
|
"""Handle the on_value_change event.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -95,10 +95,10 @@ class AccordionRoot(AccordionComponent):
|
|||||||
type: Var[LiteralAccordionType]
|
type: Var[LiteralAccordionType]
|
||||||
|
|
||||||
# The value of the item to expand.
|
# The value of the item to expand.
|
||||||
value: Var[Union[str, List[str]]]
|
value: Var[Union[str, list[str]]]
|
||||||
|
|
||||||
# The default value of the item to expand.
|
# The default value of the item to expand.
|
||||||
default_value: Var[Union[str, List[str]]]
|
default_value: Var[Union[str, list[str]]]
|
||||||
|
|
||||||
# Whether or not the accordion is collapsible.
|
# Whether or not the accordion is collapsible.
|
||||||
collapsible: Var[bool]
|
collapsible: Var[bool]
|
||||||
@ -124,7 +124,7 @@ class AccordionRoot(AccordionComponent):
|
|||||||
# Whether to show divider lines between items.
|
# Whether to show divider lines between items.
|
||||||
show_dividers: Var[bool]
|
show_dividers: Var[bool]
|
||||||
|
|
||||||
_valid_children: List[str] = ["AccordionItem"]
|
_valid_children: list[str] = ["AccordionItem"]
|
||||||
|
|
||||||
# Fired when the opened the accordions changes.
|
# Fired when the opened the accordions changes.
|
||||||
on_value_change: EventHandler[on_value_change]
|
on_value_change: EventHandler[on_value_change]
|
||||||
@ -201,13 +201,13 @@ class AccordionItem(AccordionComponent):
|
|||||||
# The content of the accordion item.
|
# The content of the accordion item.
|
||||||
content: Var[Union[Component, str, None]] = Var.create(None)
|
content: Var[Union[Component, str, None]] = Var.create(None)
|
||||||
|
|
||||||
_valid_children: List[str] = [
|
_valid_children: list[str] = [
|
||||||
"AccordionHeader",
|
"AccordionHeader",
|
||||||
"AccordionTrigger",
|
"AccordionTrigger",
|
||||||
"AccordionContent",
|
"AccordionContent",
|
||||||
]
|
]
|
||||||
|
|
||||||
_valid_parents: List[str] = ["AccordionRoot"]
|
_valid_parents: list[str] = ["AccordionRoot"]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(
|
def create(
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# ------------------- DO NOT EDIT ----------------------
|
# ------------------- DO NOT EDIT ----------------------
|
||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from typing import Any, Dict, List, Literal, Optional, Tuple, Union, overload
|
from typing import Any, Dict, Literal, Optional, Tuple, Union, overload
|
||||||
|
|
||||||
from reflex.components.component import Component, ComponentNamespace
|
from reflex.components.component import Component, ComponentNamespace
|
||||||
from reflex.components.lucide.icon import Icon
|
from reflex.components.lucide.icon import Icon
|
||||||
@ -138,7 +138,7 @@ class AccordionComponent(RadixPrimitiveComponent):
|
|||||||
"""
|
"""
|
||||||
...
|
...
|
||||||
|
|
||||||
def on_value_change(value: Var[str | List[str]]) -> Tuple[Var[str | List[str]]]: ...
|
def on_value_change(value: Var[str | list[str]]) -> Tuple[Var[str | list[str]]]: ...
|
||||||
|
|
||||||
class AccordionRoot(AccordionComponent):
|
class AccordionRoot(AccordionComponent):
|
||||||
def add_style(self): ...
|
def add_style(self): ...
|
||||||
@ -150,9 +150,9 @@ class AccordionRoot(AccordionComponent):
|
|||||||
type: Optional[
|
type: Optional[
|
||||||
Union[Literal["multiple", "single"], Var[Literal["multiple", "single"]]]
|
Union[Literal["multiple", "single"], Var[Literal["multiple", "single"]]]
|
||||||
] = None,
|
] = None,
|
||||||
value: Optional[Union[List[str], Var[Union[List[str], str]], str]] = None,
|
value: Optional[Union[Var[Union[list[str], str]], list[str], str]] = None,
|
||||||
default_value: Optional[
|
default_value: Optional[
|
||||||
Union[List[str], Var[Union[List[str], str]], str]
|
Union[Var[Union[list[str], str]], list[str], str]
|
||||||
] = None,
|
] = None,
|
||||||
collapsible: Optional[Union[Var[bool], bool]] = None,
|
collapsible: Optional[Union[Var[bool], bool]] = None,
|
||||||
disabled: Optional[Union[Var[bool], bool]] = None,
|
disabled: Optional[Union[Var[bool], bool]] = None,
|
||||||
@ -263,7 +263,7 @@ class AccordionRoot(AccordionComponent):
|
|||||||
on_scroll: Optional[EventType[()]] = None,
|
on_scroll: Optional[EventType[()]] = None,
|
||||||
on_unmount: Optional[EventType[()]] = None,
|
on_unmount: Optional[EventType[()]] = None,
|
||||||
on_value_change: Optional[
|
on_value_change: Optional[
|
||||||
Union[EventType[()], EventType[str | List[str]]]
|
Union[EventType[()], EventType[str | list[str]]]
|
||||||
] = None,
|
] = None,
|
||||||
**props,
|
**props,
|
||||||
) -> "AccordionRoot":
|
) -> "AccordionRoot":
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
"""The base component for Radix primitives."""
|
"""The base component for Radix primitives."""
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from reflex.components.component import Component
|
from reflex.components.component import Component
|
||||||
from reflex.components.tags.tag import Tag
|
from reflex.components.tags.tag import Tag
|
||||||
from reflex.utils import format
|
from reflex.utils import format
|
||||||
@ -14,7 +12,7 @@ class RadixPrimitiveComponent(Component):
|
|||||||
# Change the default rendered element for the one passed as a child.
|
# Change the default rendered element for the one passed as a child.
|
||||||
as_child: Var[bool]
|
as_child: Var[bool]
|
||||||
|
|
||||||
lib_dependencies: List[str] = ["@emotion/react@^11.11.1"]
|
lib_dependencies: list[str] = ["@emotion/react@^11.11.1"]
|
||||||
|
|
||||||
|
|
||||||
class RadixPrimitiveComponentWithClassName(RadixPrimitiveComponent):
|
class RadixPrimitiveComponentWithClassName(RadixPrimitiveComponent):
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# Style based on https://ui.shadcn.com/docs/components/drawer
|
# Style based on https://ui.shadcn.com/docs/components/drawer
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, List, Literal, Optional, Union
|
from typing import Any, Literal, Optional, Union
|
||||||
|
|
||||||
from reflex.components.component import Component, ComponentNamespace
|
from reflex.components.component import Component, ComponentNamespace
|
||||||
from reflex.components.radix.primitives.base import RadixPrimitiveComponent
|
from reflex.components.radix.primitives.base import RadixPrimitiveComponent
|
||||||
@ -20,7 +20,7 @@ class DrawerComponent(RadixPrimitiveComponent):
|
|||||||
|
|
||||||
library = "vaul"
|
library = "vaul"
|
||||||
|
|
||||||
lib_dependencies: List[str] = ["@radix-ui/react-dialog@^1.0.5"]
|
lib_dependencies: list[str] = ["@radix-ui/react-dialog@^1.0.5"]
|
||||||
|
|
||||||
|
|
||||||
LiteralDirectionType = Literal["top", "bottom", "left", "right"]
|
LiteralDirectionType = Literal["top", "bottom", "left", "right"]
|
||||||
@ -58,7 +58,7 @@ class DrawerRoot(DrawerComponent):
|
|||||||
handle_only: Var[bool]
|
handle_only: Var[bool]
|
||||||
|
|
||||||
# Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up. Should go from least visible. Also Accept px values, which doesn't take screen height into account.
|
# Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up. Should go from least visible. Also Accept px values, which doesn't take screen height into account.
|
||||||
snap_points: Optional[List[Union[str, float]]]
|
snap_points: Optional[list[Union[str, float]]]
|
||||||
|
|
||||||
# Index of a snapPoint from which the overlay fade should be applied. Defaults to the last snap point.
|
# Index of a snapPoint from which the overlay fade should be applied. Defaults to the last snap point.
|
||||||
fade_from_index: Var[int]
|
fade_from_index: Var[int]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# ------------------- DO NOT EDIT ----------------------
|
# ------------------- DO NOT EDIT ----------------------
|
||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from typing import Any, Dict, List, Literal, Optional, Union, overload
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
||||||
|
|
||||||
from reflex.components.component import ComponentNamespace
|
from reflex.components.component import ComponentNamespace
|
||||||
from reflex.components.radix.primitives.base import RadixPrimitiveComponent
|
from reflex.components.radix.primitives.base import RadixPrimitiveComponent
|
||||||
@ -78,7 +78,7 @@ class DrawerRoot(DrawerComponent):
|
|||||||
] = None,
|
] = None,
|
||||||
dismissible: Optional[Union[Var[bool], bool]] = None,
|
dismissible: Optional[Union[Var[bool], bool]] = None,
|
||||||
handle_only: Optional[Union[Var[bool], bool]] = None,
|
handle_only: Optional[Union[Var[bool], bool]] = None,
|
||||||
snap_points: Optional[List[Union[float, str]]] = None,
|
snap_points: Optional[list[Union[float, str]]] = None,
|
||||||
fade_from_index: Optional[Union[Var[int], int]] = None,
|
fade_from_index: Optional[Union[Var[int], int]] = None,
|
||||||
scroll_lock_timeout: Optional[Union[Var[int], int]] = None,
|
scroll_lock_timeout: Optional[Union[Var[int], int]] = None,
|
||||||
prevent_scroll_restoration: Optional[Union[Var[bool], bool]] = None,
|
prevent_scroll_restoration: Optional[Union[Var[bool], bool]] = None,
|
||||||
@ -560,7 +560,7 @@ class Drawer(ComponentNamespace):
|
|||||||
] = None,
|
] = None,
|
||||||
dismissible: Optional[Union[Var[bool], bool]] = None,
|
dismissible: Optional[Union[Var[bool], bool]] = None,
|
||||||
handle_only: Optional[Union[Var[bool], bool]] = None,
|
handle_only: Optional[Union[Var[bool], bool]] = None,
|
||||||
snap_points: Optional[List[Union[float, str]]] = None,
|
snap_points: Optional[list[Union[float, str]]] = None,
|
||||||
fade_from_index: Optional[Union[Var[int], int]] = None,
|
fade_from_index: Optional[Union[Var[int], int]] = None,
|
||||||
scroll_lock_timeout: Optional[Union[Var[int], int]] = None,
|
scroll_lock_timeout: Optional[Union[Var[int], int]] = None,
|
||||||
prevent_scroll_restoration: Optional[Union[Var[bool], bool]] = None,
|
prevent_scroll_restoration: Optional[Union[Var[bool], bool]] = None,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, List, Literal, Tuple
|
from typing import Any, Literal, Tuple
|
||||||
|
|
||||||
from reflex.components.component import Component, ComponentNamespace
|
from reflex.components.component import Component, ComponentNamespace
|
||||||
from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
|
from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
|
||||||
@ -20,8 +20,8 @@ class SliderComponent(RadixPrimitiveComponentWithClassName):
|
|||||||
|
|
||||||
|
|
||||||
def on_value_event_spec(
|
def on_value_event_spec(
|
||||||
value: Var[List[int]],
|
value: Var[list[int]],
|
||||||
) -> Tuple[Var[List[int]]]:
|
) -> Tuple[Var[list[int]]]:
|
||||||
"""Event handler spec for the value event.
|
"""Event handler spec for the value event.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -39,9 +39,9 @@ class SliderRoot(SliderComponent):
|
|||||||
tag = "Root"
|
tag = "Root"
|
||||||
alias = "RadixSliderRoot"
|
alias = "RadixSliderRoot"
|
||||||
|
|
||||||
default_value: Var[List[int]]
|
default_value: Var[list[int]]
|
||||||
|
|
||||||
value: Var[List[int]]
|
value: Var[list[int]]
|
||||||
|
|
||||||
name: Var[str]
|
name: Var[str]
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# ------------------- DO NOT EDIT ----------------------
|
# ------------------- DO NOT EDIT ----------------------
|
||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from typing import Any, Dict, List, Literal, Optional, Tuple, Union, overload
|
from typing import Any, Dict, Literal, Optional, Tuple, Union, overload
|
||||||
|
|
||||||
from reflex.components.component import Component, ComponentNamespace
|
from reflex.components.component import Component, ComponentNamespace
|
||||||
from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
|
from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
|
||||||
@ -62,7 +62,7 @@ class SliderComponent(RadixPrimitiveComponentWithClassName):
|
|||||||
"""
|
"""
|
||||||
...
|
...
|
||||||
|
|
||||||
def on_value_event_spec(value: Var[List[int]]) -> Tuple[Var[List[int]]]: ...
|
def on_value_event_spec(value: Var[list[int]]) -> Tuple[Var[list[int]]]: ...
|
||||||
|
|
||||||
class SliderRoot(SliderComponent):
|
class SliderRoot(SliderComponent):
|
||||||
def add_style(self) -> dict[str, Any] | None: ...
|
def add_style(self) -> dict[str, Any] | None: ...
|
||||||
@ -71,8 +71,8 @@ class SliderRoot(SliderComponent):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
default_value: Optional[Union[List[int], Var[List[int]]]] = None,
|
default_value: Optional[Union[Var[list[int]], list[int]]] = None,
|
||||||
value: Optional[Union[List[int], Var[List[int]]]] = None,
|
value: Optional[Union[Var[list[int]], list[int]]] = None,
|
||||||
name: Optional[Union[Var[str], str]] = None,
|
name: Optional[Union[Var[str], str]] = None,
|
||||||
disabled: Optional[Union[Var[bool], bool]] = None,
|
disabled: Optional[Union[Var[bool], bool]] = None,
|
||||||
orientation: Optional[
|
orientation: Optional[
|
||||||
@ -109,8 +109,8 @@ class SliderRoot(SliderComponent):
|
|||||||
on_mouse_up: Optional[EventType[()]] = None,
|
on_mouse_up: Optional[EventType[()]] = None,
|
||||||
on_scroll: Optional[EventType[()]] = None,
|
on_scroll: Optional[EventType[()]] = None,
|
||||||
on_unmount: Optional[EventType[()]] = None,
|
on_unmount: Optional[EventType[()]] = None,
|
||||||
on_value_change: Optional[Union[EventType[()], EventType[List[int]]]] = None,
|
on_value_change: Optional[Union[EventType[()], EventType[list[int]]]] = None,
|
||||||
on_value_commit: Optional[Union[EventType[()], EventType[List[int]]]] = None,
|
on_value_commit: Optional[Union[EventType[()], EventType[list[int]]]] = None,
|
||||||
**props,
|
**props,
|
||||||
) -> "SliderRoot":
|
) -> "SliderRoot":
|
||||||
"""Create the component.
|
"""Create the component.
|
||||||
|
@ -17,7 +17,7 @@ rx.text(
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Dict, List, Literal, Optional, Union, get_args
|
from typing import Any, Dict, Literal, Optional, Union, get_args
|
||||||
|
|
||||||
from reflex.components.component import BaseComponent
|
from reflex.components.component import BaseComponent
|
||||||
from reflex.components.core.cond import Cond, color_mode_cond, cond
|
from reflex.components.core.cond import Cond, color_mode_cond, cond
|
||||||
@ -66,9 +66,9 @@ class ColorModeIcon(Cond):
|
|||||||
|
|
||||||
LiteralPosition = Literal["top-left", "top-right", "bottom-left", "bottom-right"]
|
LiteralPosition = Literal["top-left", "top-right", "bottom-left", "bottom-right"]
|
||||||
|
|
||||||
position_values: List[str] = list(get_args(LiteralPosition))
|
position_values: list[str] = list(get_args(LiteralPosition))
|
||||||
|
|
||||||
position_map: Dict[str, List[str]] = {
|
position_map: Dict[str, list[str]] = {
|
||||||
"position": position_values,
|
"position": position_values,
|
||||||
"left": ["top-left", "bottom-left"],
|
"left": ["top-left", "bottom-left"],
|
||||||
"right": ["top-right", "bottom-right"],
|
"right": ["top-right", "bottom-right"],
|
||||||
@ -78,7 +78,7 @@ position_map: Dict[str, List[str]] = {
|
|||||||
|
|
||||||
|
|
||||||
# needed to inverse contains for find
|
# needed to inverse contains for find
|
||||||
def _find(const: List[str], var: Any):
|
def _find(const: list[str], var: Any):
|
||||||
return LiteralArrayVar.create(const).contains(var)
|
return LiteralArrayVar.create(const).contains(var)
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# ------------------- DO NOT EDIT ----------------------
|
# ------------------- DO NOT EDIT ----------------------
|
||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from typing import Any, Dict, List, Literal, Optional, Union, overload
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
||||||
|
|
||||||
from reflex.components.component import BaseComponent
|
from reflex.components.component import BaseComponent
|
||||||
from reflex.components.core.breakpoints import Breakpoints
|
from reflex.components.core.breakpoints import Breakpoints
|
||||||
@ -63,8 +63,8 @@ class ColorModeIcon(Cond):
|
|||||||
...
|
...
|
||||||
|
|
||||||
LiteralPosition = Literal["top-left", "top-right", "bottom-left", "bottom-right"]
|
LiteralPosition = Literal["top-left", "top-right", "bottom-left", "bottom-right"]
|
||||||
position_values: List[str]
|
position_values: list[str]
|
||||||
position_map: Dict[str, List[str]]
|
position_map: Dict[str, list[str]]
|
||||||
|
|
||||||
class ColorModeIconButton(IconButton):
|
class ColorModeIconButton(IconButton):
|
||||||
@overload
|
@overload
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Components for the CheckboxGroup component of Radix Themes."""
|
"""Components for the CheckboxGroup component of Radix Themes."""
|
||||||
|
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
from typing import List, Literal
|
from typing import Literal
|
||||||
|
|
||||||
from reflex.components.core.breakpoints import Responsive
|
from reflex.components.core.breakpoints import Responsive
|
||||||
from reflex.vars.base import Var
|
from reflex.vars.base import Var
|
||||||
@ -27,7 +27,7 @@ class CheckboxGroupRoot(RadixThemesComponent):
|
|||||||
high_contrast: Var[bool]
|
high_contrast: Var[bool]
|
||||||
|
|
||||||
# determines which checkboxes, if any, are checked by default.
|
# determines which checkboxes, if any, are checked by default.
|
||||||
default_value: Var[List[str]]
|
default_value: Var[list[str]]
|
||||||
|
|
||||||
# used to assign a name to the entire group of checkboxes
|
# used to assign a name to the entire group of checkboxes
|
||||||
name: Var[str]
|
name: Var[str]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
from typing import Any, Dict, List, Literal, Optional, Union, overload
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
||||||
|
|
||||||
from reflex.components.core.breakpoints import Breakpoints
|
from reflex.components.core.breakpoints import Breakpoints
|
||||||
from reflex.event import EventType
|
from reflex.event import EventType
|
||||||
@ -99,7 +99,7 @@ class CheckboxGroupRoot(RadixThemesComponent):
|
|||||||
]
|
]
|
||||||
] = None,
|
] = None,
|
||||||
high_contrast: Optional[Union[Var[bool], bool]] = None,
|
high_contrast: Optional[Union[Var[bool], bool]] = None,
|
||||||
default_value: Optional[Union[List[str], Var[List[str]]]] = None,
|
default_value: Optional[Union[Var[list[str]], list[str]]] = None,
|
||||||
name: Optional[Union[Var[str], str]] = None,
|
name: Optional[Union[Var[str], str]] = None,
|
||||||
style: Optional[Style] = None,
|
style: Optional[Style] = None,
|
||||||
key: Optional[Any] = None,
|
key: Optional[Any] = None,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Interactive components provided by @radix-ui/themes."""
|
"""Interactive components provided by @radix-ui/themes."""
|
||||||
|
|
||||||
from typing import Dict, List, Literal, Union
|
from typing import Dict, Literal, Union
|
||||||
|
|
||||||
from reflex.components.component import ComponentNamespace
|
from reflex.components.component import ComponentNamespace
|
||||||
from reflex.components.core.breakpoints import Responsive
|
from reflex.components.core.breakpoints import Responsive
|
||||||
@ -35,7 +35,7 @@ class ContextMenuRoot(RadixThemesComponent):
|
|||||||
# The modality of the context menu. When set to true, interaction with outside elements will be disabled and only menu content will be visible to screen readers.
|
# The modality of the context menu. When set to true, interaction with outside elements will be disabled and only menu content will be visible to screen readers.
|
||||||
modal: Var[bool]
|
modal: Var[bool]
|
||||||
|
|
||||||
_invalid_children: List[str] = ["ContextMenuItem"]
|
_invalid_children: list[str] = ["ContextMenuItem"]
|
||||||
|
|
||||||
# Fired when the open state changes.
|
# Fired when the open state changes.
|
||||||
on_open_change: EventHandler[passthrough_event_spec(bool)]
|
on_open_change: EventHandler[passthrough_event_spec(bool)]
|
||||||
@ -52,9 +52,9 @@ class ContextMenuTrigger(RadixThemesComponent):
|
|||||||
# Whether the trigger is disabled
|
# Whether the trigger is disabled
|
||||||
disabled: Var[bool]
|
disabled: Var[bool]
|
||||||
|
|
||||||
_valid_parents: List[str] = ["ContextMenuRoot"]
|
_valid_parents: list[str] = ["ContextMenuRoot"]
|
||||||
|
|
||||||
_invalid_children: List[str] = ["ContextMenuContent"]
|
_invalid_children: list[str] = ["ContextMenuContent"]
|
||||||
|
|
||||||
_memoization_mode = MemoizationMode(recursive=False)
|
_memoization_mode = MemoizationMode(recursive=False)
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ class ContextMenuSubTrigger(RadixThemesComponent):
|
|||||||
# Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside.
|
# Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside.
|
||||||
text_value: Var[str]
|
text_value: Var[str]
|
||||||
|
|
||||||
_valid_parents: List[str] = ["ContextMenuContent", "ContextMenuSub"]
|
_valid_parents: list[str] = ["ContextMenuContent", "ContextMenuSub"]
|
||||||
|
|
||||||
_memoization_mode = MemoizationMode(recursive=False)
|
_memoization_mode = MemoizationMode(recursive=False)
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ class ContextMenuSubContent(RadixThemesComponent):
|
|||||||
# Whether to hide the content when the trigger becomes fully occluded. Defaults to False.
|
# Whether to hide the content when the trigger becomes fully occluded. Defaults to False.
|
||||||
hide_when_detached: Var[bool]
|
hide_when_detached: Var[bool]
|
||||||
|
|
||||||
_valid_parents: List[str] = ["ContextMenuSub"]
|
_valid_parents: list[str] = ["ContextMenuSub"]
|
||||||
|
|
||||||
# Fired when the escape key is pressed.
|
# Fired when the escape key is pressed.
|
||||||
on_escape_key_down: EventHandler[no_args_event_spec]
|
on_escape_key_down: EventHandler[no_args_event_spec]
|
||||||
@ -226,7 +226,7 @@ class ContextMenuItem(RadixThemesComponent):
|
|||||||
# Optional text used for typeahead purposes. By default the typeahead behavior will use the content of the item. Use this when the content is complex, or you have non-textual content inside.
|
# Optional text used for typeahead purposes. By default the typeahead behavior will use the content of the item. Use this when the content is complex, or you have non-textual content inside.
|
||||||
text_value: Var[str]
|
text_value: Var[str]
|
||||||
|
|
||||||
_valid_parents: List[str] = ["ContextMenuContent", "ContextMenuSubContent"]
|
_valid_parents: list[str] = ["ContextMenuContent", "ContextMenuSubContent"]
|
||||||
|
|
||||||
# Fired when the item is selected.
|
# Fired when the item is selected.
|
||||||
on_select: EventHandler[no_args_event_spec]
|
on_select: EventHandler[no_args_event_spec]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Interactive components provided by @radix-ui/themes."""
|
"""Interactive components provided by @radix-ui/themes."""
|
||||||
|
|
||||||
from typing import Dict, List, Literal, Union
|
from typing import Dict, Literal, Union
|
||||||
|
|
||||||
from reflex.components.component import ComponentNamespace
|
from reflex.components.component import ComponentNamespace
|
||||||
from reflex.components.core.breakpoints import Responsive
|
from reflex.components.core.breakpoints import Responsive
|
||||||
@ -43,7 +43,7 @@ class DropdownMenuRoot(RadixThemesComponent):
|
|||||||
# The reading direction of submenus when applicable. If omitted, inherits globally from DirectionProvider or assumes LTR (left-to-right) reading mode.
|
# The reading direction of submenus when applicable. If omitted, inherits globally from DirectionProvider or assumes LTR (left-to-right) reading mode.
|
||||||
dir: Var[LiteralDirType]
|
dir: Var[LiteralDirType]
|
||||||
|
|
||||||
_invalid_children: List[str] = ["DropdownMenuItem"]
|
_invalid_children: list[str] = ["DropdownMenuItem"]
|
||||||
|
|
||||||
# Fired when the open state changes.
|
# Fired when the open state changes.
|
||||||
on_open_change: EventHandler[passthrough_event_spec(bool)]
|
on_open_change: EventHandler[passthrough_event_spec(bool)]
|
||||||
@ -57,9 +57,9 @@ class DropdownMenuTrigger(RadixThemesTriggerComponent):
|
|||||||
# Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
|
# Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
|
||||||
as_child: Var[bool]
|
as_child: Var[bool]
|
||||||
|
|
||||||
_valid_parents: List[str] = ["DropdownMenuRoot"]
|
_valid_parents: list[str] = ["DropdownMenuRoot"]
|
||||||
|
|
||||||
_invalid_children: List[str] = ["DropdownMenuContent"]
|
_invalid_children: list[str] = ["DropdownMenuContent"]
|
||||||
|
|
||||||
_memoization_mode = MemoizationMode(recursive=False)
|
_memoization_mode = MemoizationMode(recursive=False)
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ class DropdownMenuSubTrigger(RadixThemesTriggerComponent):
|
|||||||
# Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside.
|
# Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside.
|
||||||
text_value: Var[str]
|
text_value: Var[str]
|
||||||
|
|
||||||
_valid_parents: List[str] = ["DropdownMenuContent", "DropdownMenuSub"]
|
_valid_parents: list[str] = ["DropdownMenuContent", "DropdownMenuSub"]
|
||||||
|
|
||||||
_memoization_mode = MemoizationMode(recursive=False)
|
_memoization_mode = MemoizationMode(recursive=False)
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ class DropdownMenuSubContent(RadixThemesComponent):
|
|||||||
# Whether to hide the content when the trigger becomes fully occluded. Defaults to False.
|
# Whether to hide the content when the trigger becomes fully occluded. Defaults to False.
|
||||||
hide_when_detached: Var[bool]
|
hide_when_detached: Var[bool]
|
||||||
|
|
||||||
_valid_parents: List[str] = ["DropdownMenuSub"]
|
_valid_parents: list[str] = ["DropdownMenuSub"]
|
||||||
|
|
||||||
# Fired when the escape key is pressed.
|
# Fired when the escape key is pressed.
|
||||||
on_escape_key_down: EventHandler[no_args_event_spec]
|
on_escape_key_down: EventHandler[no_args_event_spec]
|
||||||
@ -231,7 +231,7 @@ class DropdownMenuItem(RadixThemesComponent):
|
|||||||
# Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside.
|
# Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside.
|
||||||
text_value: Var[str]
|
text_value: Var[str]
|
||||||
|
|
||||||
_valid_parents: List[str] = ["DropdownMenuContent", "DropdownMenuSubContent"]
|
_valid_parents: list[str] = ["DropdownMenuContent", "DropdownMenuSubContent"]
|
||||||
|
|
||||||
# Fired when the item is selected.
|
# Fired when the item is selected.
|
||||||
on_select: EventHandler[no_args_event_spec]
|
on_select: EventHandler[no_args_event_spec]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import List, Literal, Optional, Union
|
from typing import Literal, Optional, Union
|
||||||
|
|
||||||
import reflex as rx
|
import reflex as rx
|
||||||
from reflex.components.component import Component, ComponentNamespace
|
from reflex.components.component import Component, ComponentNamespace
|
||||||
@ -77,7 +77,7 @@ class HighLevelRadioGroup(RadixThemesComponent):
|
|||||||
"""High level wrapper for the RadioGroup component."""
|
"""High level wrapper for the RadioGroup component."""
|
||||||
|
|
||||||
# The items of the radio group.
|
# The items of the radio group.
|
||||||
items: Var[List[str]]
|
items: Var[list[str]]
|
||||||
|
|
||||||
# The direction of the radio group.
|
# The direction of the radio group.
|
||||||
direction: Var[LiteralFlexDirection] = LiteralVar.create("row")
|
direction: Var[LiteralFlexDirection] = LiteralVar.create("row")
|
||||||
@ -118,7 +118,7 @@ class HighLevelRadioGroup(RadixThemesComponent):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def create(
|
def create(
|
||||||
cls,
|
cls,
|
||||||
items: Var[List[Optional[Union[str, int, float, list, dict, bool]]]],
|
items: Var[list[Optional[Union[str, int, float, list, dict, bool]]]],
|
||||||
**props,
|
**props,
|
||||||
) -> Component:
|
) -> Component:
|
||||||
"""Create a radio group component.
|
"""Create a radio group component.
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# ------------------- DO NOT EDIT ----------------------
|
# ------------------- DO NOT EDIT ----------------------
|
||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from typing import Any, Dict, List, Literal, Optional, Union, overload
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
||||||
|
|
||||||
from reflex.components.component import ComponentNamespace
|
from reflex.components.component import ComponentNamespace
|
||||||
from reflex.components.core.breakpoints import Breakpoints
|
from reflex.components.core.breakpoints import Breakpoints
|
||||||
@ -221,7 +221,7 @@ class HighLevelRadioGroup(RadixThemesComponent):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
items: Optional[Union[List[str], Var[List[str]]]] = None,
|
items: Optional[Union[Var[list[str]], list[str]]] = None,
|
||||||
direction: Optional[
|
direction: Optional[
|
||||||
Union[
|
Union[
|
||||||
Literal["column", "column-reverse", "row", "row-reverse"],
|
Literal["column", "column-reverse", "row", "row-reverse"],
|
||||||
@ -373,7 +373,7 @@ class RadioGroup(ComponentNamespace):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def __call__(
|
def __call__(
|
||||||
*children,
|
*children,
|
||||||
items: Optional[Union[List[str], Var[List[str]]]] = None,
|
items: Optional[Union[Var[list[str]], list[str]]] = None,
|
||||||
direction: Optional[
|
direction: Optional[
|
||||||
Union[
|
Union[
|
||||||
Literal["column", "column-reverse", "row", "row-reverse"],
|
Literal["column", "column-reverse", "row", "row-reverse"],
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
from typing import List, Literal, Tuple, Union
|
from typing import Literal, Tuple, Union
|
||||||
|
|
||||||
from reflex.components.core.breakpoints import Responsive
|
from reflex.components.core.breakpoints import Responsive
|
||||||
from reflex.event import EventHandler
|
from reflex.event import EventHandler
|
||||||
@ -13,8 +13,8 @@ from ..base import LiteralAccentColor, RadixThemesComponent
|
|||||||
|
|
||||||
|
|
||||||
def on_value_change(
|
def on_value_change(
|
||||||
value: Var[Union[str, List[str]]],
|
value: Var[Union[str, list[str]]],
|
||||||
) -> Tuple[Var[Union[str, List[str]]]]:
|
) -> Tuple[Var[Union[str, list[str]]]]:
|
||||||
"""Handle the on_value_change event.
|
"""Handle the on_value_change event.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -47,10 +47,10 @@ class SegmentedControlRoot(RadixThemesComponent):
|
|||||||
radius: Var[Literal["none", "small", "medium", "large", "full"]]
|
radius: Var[Literal["none", "small", "medium", "large", "full"]]
|
||||||
|
|
||||||
# The default value of the segmented control.
|
# The default value of the segmented control.
|
||||||
default_value: Var[Union[str, List[str]]]
|
default_value: Var[Union[str, list[str]]]
|
||||||
|
|
||||||
# The current value of the segmented control.
|
# The current value of the segmented control.
|
||||||
value: Var[Union[str, List[str]]]
|
value: Var[Union[str, list[str]]]
|
||||||
|
|
||||||
# Handles the `onChange` event for the SegmentedControl component.
|
# Handles the `onChange` event for the SegmentedControl component.
|
||||||
on_change: EventHandler[on_value_change]
|
on_change: EventHandler[on_value_change]
|
||||||
@ -66,7 +66,7 @@ class SegmentedControlItem(RadixThemesComponent):
|
|||||||
# The value of the item.
|
# The value of the item.
|
||||||
value: Var[str]
|
value: Var[str]
|
||||||
|
|
||||||
_valid_parents: List[str] = ["SegmentedControlRoot"]
|
_valid_parents: list[str] = ["SegmentedControlRoot"]
|
||||||
|
|
||||||
|
|
||||||
class SegmentedControl(SimpleNamespace):
|
class SegmentedControl(SimpleNamespace):
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
from typing import Any, Dict, List, Literal, Optional, Tuple, Union, overload
|
from typing import Any, Dict, Literal, Optional, Tuple, Union, overload
|
||||||
|
|
||||||
from reflex.components.core.breakpoints import Breakpoints
|
from reflex.components.core.breakpoints import Breakpoints
|
||||||
from reflex.event import EventType
|
from reflex.event import EventType
|
||||||
@ -14,8 +14,8 @@ from reflex.vars.base import Var
|
|||||||
from ..base import RadixThemesComponent
|
from ..base import RadixThemesComponent
|
||||||
|
|
||||||
def on_value_change(
|
def on_value_change(
|
||||||
value: Var[Union[str, List[str]]],
|
value: Var[Union[str, list[str]]],
|
||||||
) -> Tuple[Var[Union[str, List[str]]]]: ...
|
) -> Tuple[Var[Union[str, list[str]]]]: ...
|
||||||
|
|
||||||
class SegmentedControlRoot(RadixThemesComponent):
|
class SegmentedControlRoot(RadixThemesComponent):
|
||||||
@overload
|
@overload
|
||||||
@ -109,9 +109,9 @@ class SegmentedControlRoot(RadixThemesComponent):
|
|||||||
]
|
]
|
||||||
] = None,
|
] = None,
|
||||||
default_value: Optional[
|
default_value: Optional[
|
||||||
Union[List[str], Var[Union[List[str], str]], str]
|
Union[Var[Union[list[str], str]], list[str], str]
|
||||||
] = None,
|
] = None,
|
||||||
value: Optional[Union[List[str], Var[Union[List[str], str]], str]] = None,
|
value: Optional[Union[Var[Union[list[str], str]], list[str], str]] = None,
|
||||||
style: Optional[Style] = None,
|
style: Optional[Style] = None,
|
||||||
key: Optional[Any] = None,
|
key: Optional[Any] = None,
|
||||||
id: Optional[Any] = None,
|
id: Optional[Any] = None,
|
||||||
@ -120,7 +120,7 @@ class SegmentedControlRoot(RadixThemesComponent):
|
|||||||
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
||||||
on_blur: Optional[EventType[()]] = None,
|
on_blur: Optional[EventType[()]] = None,
|
||||||
on_change: Optional[
|
on_change: Optional[
|
||||||
Union[EventType[()], EventType[Union[str, List[str]]]]
|
Union[EventType[()], EventType[Union[str, list[str]]]]
|
||||||
] = None,
|
] = None,
|
||||||
on_click: Optional[EventType[()]] = None,
|
on_click: Optional[EventType[()]] = None,
|
||||||
on_context_menu: Optional[EventType[()]] = None,
|
on_context_menu: Optional[EventType[()]] = None,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Interactive components provided by @radix-ui/themes."""
|
"""Interactive components provided by @radix-ui/themes."""
|
||||||
|
|
||||||
from typing import List, Literal, Union
|
from typing import Literal, Union
|
||||||
|
|
||||||
import reflex as rx
|
import reflex as rx
|
||||||
from reflex.components.component import Component, ComponentNamespace
|
from reflex.components.component import Component, ComponentNamespace
|
||||||
@ -68,7 +68,7 @@ class SelectTrigger(RadixThemesComponent):
|
|||||||
# The placeholder of the select trigger
|
# The placeholder of the select trigger
|
||||||
placeholder: Var[str]
|
placeholder: Var[str]
|
||||||
|
|
||||||
_valid_parents: List[str] = ["SelectRoot"]
|
_valid_parents: list[str] = ["SelectRoot"]
|
||||||
|
|
||||||
_memoization_mode = MemoizationMode(recursive=False)
|
_memoization_mode = MemoizationMode(recursive=False)
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ class SelectGroup(RadixThemesComponent):
|
|||||||
|
|
||||||
tag = "Select.Group"
|
tag = "Select.Group"
|
||||||
|
|
||||||
_valid_parents: List[str] = ["SelectContent"]
|
_valid_parents: list[str] = ["SelectContent"]
|
||||||
|
|
||||||
|
|
||||||
class SelectItem(RadixThemesComponent):
|
class SelectItem(RadixThemesComponent):
|
||||||
@ -131,7 +131,7 @@ class SelectItem(RadixThemesComponent):
|
|||||||
# Whether the select item is disabled
|
# Whether the select item is disabled
|
||||||
disabled: Var[bool]
|
disabled: Var[bool]
|
||||||
|
|
||||||
_valid_parents: List[str] = ["SelectGroup", "SelectContent"]
|
_valid_parents: list[str] = ["SelectGroup", "SelectContent"]
|
||||||
|
|
||||||
|
|
||||||
class SelectLabel(RadixThemesComponent):
|
class SelectLabel(RadixThemesComponent):
|
||||||
@ -139,7 +139,7 @@ class SelectLabel(RadixThemesComponent):
|
|||||||
|
|
||||||
tag = "Select.Label"
|
tag = "Select.Label"
|
||||||
|
|
||||||
_valid_parents: List[str] = ["SelectGroup"]
|
_valid_parents: list[str] = ["SelectGroup"]
|
||||||
|
|
||||||
|
|
||||||
class SelectSeparator(RadixThemesComponent):
|
class SelectSeparator(RadixThemesComponent):
|
||||||
@ -152,7 +152,7 @@ class HighLevelSelect(SelectRoot):
|
|||||||
"""High level wrapper for the Select component."""
|
"""High level wrapper for the Select component."""
|
||||||
|
|
||||||
# The items of the select.
|
# The items of the select.
|
||||||
items: Var[List[str]]
|
items: Var[list[str]]
|
||||||
|
|
||||||
# The placeholder of the select.
|
# The placeholder of the select.
|
||||||
placeholder: Var[str]
|
placeholder: Var[str]
|
||||||
@ -179,7 +179,7 @@ class HighLevelSelect(SelectRoot):
|
|||||||
position: Var[Literal["item-aligned", "popper"]]
|
position: Var[Literal["item-aligned", "popper"]]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, items: Union[List[str], Var[List[str]]], **props) -> Component:
|
def create(cls, items: Union[list[str], Var[list[str]]], **props) -> Component:
|
||||||
"""Create a select component.
|
"""Create a select component.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# ------------------- DO NOT EDIT ----------------------
|
# ------------------- DO NOT EDIT ----------------------
|
||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from typing import Any, Dict, List, Literal, Optional, Union, overload
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
||||||
|
|
||||||
from reflex.components.component import ComponentNamespace
|
from reflex.components.component import ComponentNamespace
|
||||||
from reflex.components.core.breakpoints import Breakpoints
|
from reflex.components.core.breakpoints import Breakpoints
|
||||||
@ -575,7 +575,7 @@ class HighLevelSelect(SelectRoot):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
items: Optional[Union[List[str], Var[List[str]]]] = None,
|
items: Optional[Union[Var[list[str]], list[str]]] = None,
|
||||||
placeholder: Optional[Union[Var[str], str]] = None,
|
placeholder: Optional[Union[Var[str], str]] = None,
|
||||||
label: Optional[Union[Var[str], str]] = None,
|
label: Optional[Union[Var[str], str]] = None,
|
||||||
color_scheme: Optional[
|
color_scheme: Optional[
|
||||||
@ -751,7 +751,7 @@ class Select(ComponentNamespace):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def __call__(
|
def __call__(
|
||||||
*children,
|
*children,
|
||||||
items: Optional[Union[List[str], Var[List[str]]]] = None,
|
items: Optional[Union[Var[list[str]], list[str]]] = None,
|
||||||
placeholder: Optional[Union[Var[str], str]] = None,
|
placeholder: Optional[Union[Var[str], str]] = None,
|
||||||
label: Optional[Union[Var[str], str]] = None,
|
label: Optional[Union[Var[str], str]] = None,
|
||||||
color_scheme: Optional[
|
color_scheme: Optional[
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import List, Literal, Optional, Union
|
from typing import Literal, Optional, Union
|
||||||
|
|
||||||
from reflex.components.component import Component
|
from reflex.components.component import Component
|
||||||
from reflex.components.core.breakpoints import Responsive
|
from reflex.components.core.breakpoints import Responsive
|
||||||
@ -42,10 +42,10 @@ class Slider(RadixThemesComponent):
|
|||||||
radius: Var[Literal["none", "small", "full"]]
|
radius: Var[Literal["none", "small", "full"]]
|
||||||
|
|
||||||
# The value of the slider when initially rendered. Use when you do not need to control the state of the slider.
|
# The value of the slider when initially rendered. Use when you do not need to control the state of the slider.
|
||||||
default_value: Var[Union[List[Union[float, int]], float, int]]
|
default_value: Var[Union[list[Union[float, int]], float, int]]
|
||||||
|
|
||||||
# The controlled value of the slider. Must be used in conjunction with onValueChange.
|
# The controlled value of the slider. Must be used in conjunction with onValueChange.
|
||||||
value: Var[List[Union[float, int]]]
|
value: Var[list[Union[float, int]]]
|
||||||
|
|
||||||
# The name of the slider. Submitted with its owning form as part of a name/value pair.
|
# The name of the slider. Submitted with its owning form as part of a name/value pair.
|
||||||
name: Var[str]
|
name: Var[str]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# ------------------- DO NOT EDIT ----------------------
|
# ------------------- DO NOT EDIT ----------------------
|
||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from typing import Any, Dict, List, Literal, Optional, Union, overload
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
||||||
|
|
||||||
from reflex.components.core.breakpoints import Breakpoints
|
from reflex.components.core.breakpoints import Breakpoints
|
||||||
from reflex.event import EventType, passthrough_event_spec
|
from reflex.event import EventType, passthrough_event_spec
|
||||||
@ -112,14 +112,14 @@ class Slider(RadixThemesComponent):
|
|||||||
] = None,
|
] = None,
|
||||||
default_value: Optional[
|
default_value: Optional[
|
||||||
Union[
|
Union[
|
||||||
List[Union[float, int]],
|
Var[Union[float, int, list[Union[float, int]]]],
|
||||||
Var[Union[List[Union[float, int]], float, int]],
|
|
||||||
float,
|
float,
|
||||||
int,
|
int,
|
||||||
|
list[Union[float, int]],
|
||||||
]
|
]
|
||||||
] = None,
|
] = None,
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[List[Union[float, int]], Var[List[Union[float, int]]]]
|
Union[Var[list[Union[float, int]]], list[Union[float, int]]]
|
||||||
] = None,
|
] = None,
|
||||||
name: Optional[Union[Var[str], str]] = None,
|
name: Optional[Union[Var[str], str]] = None,
|
||||||
width: Optional[Union[Var[Optional[str]], str]] = None,
|
width: Optional[Union[Var[Optional[str]], str]] = None,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Interactive components provided by @radix-ui/themes."""
|
"""Interactive components provided by @radix-ui/themes."""
|
||||||
|
|
||||||
from typing import List, Literal
|
from typing import Literal
|
||||||
|
|
||||||
from reflex.components.component import ComponentNamespace
|
from reflex.components.component import ComponentNamespace
|
||||||
from reflex.components.core.breakpoints import Responsive
|
from reflex.components.core.breakpoints import Responsive
|
||||||
@ -27,9 +27,9 @@ class TableHeader(elements.Thead, RadixThemesComponent):
|
|||||||
|
|
||||||
tag = "Table.Header"
|
tag = "Table.Header"
|
||||||
|
|
||||||
_invalid_children: List[str] = ["TableBody"]
|
_invalid_children: list[str] = ["TableBody"]
|
||||||
|
|
||||||
_valid_parents: List[str] = ["TableRoot"]
|
_valid_parents: list[str] = ["TableRoot"]
|
||||||
|
|
||||||
|
|
||||||
class TableRow(elements.Tr, RadixThemesComponent):
|
class TableRow(elements.Tr, RadixThemesComponent):
|
||||||
@ -40,7 +40,7 @@ class TableRow(elements.Tr, RadixThemesComponent):
|
|||||||
# The alignment of the row
|
# The alignment of the row
|
||||||
align: Var[Literal["start", "center", "end", "baseline"]]
|
align: Var[Literal["start", "center", "end", "baseline"]]
|
||||||
|
|
||||||
_invalid_children: List[str] = ["TableBody", "TableHeader", "TableRow"]
|
_invalid_children: list[str] = ["TableBody", "TableHeader", "TableRow"]
|
||||||
|
|
||||||
|
|
||||||
class TableColumnHeaderCell(elements.Th, RadixThemesComponent):
|
class TableColumnHeaderCell(elements.Th, RadixThemesComponent):
|
||||||
@ -57,7 +57,7 @@ class TableColumnHeaderCell(elements.Th, RadixThemesComponent):
|
|||||||
# The maximum width of the cell
|
# The maximum width of the cell
|
||||||
max_width: Var[Responsive[str]]
|
max_width: Var[Responsive[str]]
|
||||||
|
|
||||||
_invalid_children: List[str] = [
|
_invalid_children: list[str] = [
|
||||||
"TableBody",
|
"TableBody",
|
||||||
"TableHeader",
|
"TableHeader",
|
||||||
"TableRow",
|
"TableRow",
|
||||||
@ -72,14 +72,14 @@ class TableBody(elements.Tbody, RadixThemesComponent):
|
|||||||
|
|
||||||
tag = "Table.Body"
|
tag = "Table.Body"
|
||||||
|
|
||||||
_invalid_children: List[str] = [
|
_invalid_children: list[str] = [
|
||||||
"TableHeader",
|
"TableHeader",
|
||||||
"TableRowHeaderCell",
|
"TableRowHeaderCell",
|
||||||
"TableColumnHeaderCell",
|
"TableColumnHeaderCell",
|
||||||
"TableCell",
|
"TableCell",
|
||||||
]
|
]
|
||||||
|
|
||||||
_valid_parents: List[str] = ["TableRoot"]
|
_valid_parents: list[str] = ["TableRoot"]
|
||||||
|
|
||||||
|
|
||||||
class TableCell(elements.Td, CommonPaddingProps, RadixThemesComponent):
|
class TableCell(elements.Td, CommonPaddingProps, RadixThemesComponent):
|
||||||
@ -96,7 +96,7 @@ class TableCell(elements.Td, CommonPaddingProps, RadixThemesComponent):
|
|||||||
# The maximum width of the cell
|
# The maximum width of the cell
|
||||||
max_width: Var[Responsive[str]]
|
max_width: Var[Responsive[str]]
|
||||||
|
|
||||||
_invalid_children: List[str] = [
|
_invalid_children: list[str] = [
|
||||||
"TableBody",
|
"TableBody",
|
||||||
"TableHeader",
|
"TableHeader",
|
||||||
"TableRowHeaderCell",
|
"TableRowHeaderCell",
|
||||||
@ -119,7 +119,7 @@ class TableRowHeaderCell(elements.Th, CommonPaddingProps, RadixThemesComponent):
|
|||||||
# The maximum width of the cell
|
# The maximum width of the cell
|
||||||
max_width: Var[Responsive[str]]
|
max_width: Var[Responsive[str]]
|
||||||
|
|
||||||
_invalid_children: List[str] = [
|
_invalid_children: list[str] = [
|
||||||
"TableBody",
|
"TableBody",
|
||||||
"TableHeader",
|
"TableHeader",
|
||||||
"TableRow",
|
"TableRow",
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Dict, List, Literal
|
from typing import Any, Dict, Literal
|
||||||
|
|
||||||
from reflex.components.component import Component, ComponentNamespace
|
from reflex.components.component import Component, ComponentNamespace
|
||||||
from reflex.components.core.breakpoints import Responsive
|
from reflex.components.core.breakpoints import Responsive
|
||||||
@ -94,7 +94,7 @@ class TabsTrigger(RadixThemesComponent):
|
|||||||
# The color of the line under the tab when active.
|
# The color of the line under the tab when active.
|
||||||
color_scheme: Var[LiteralAccentColor]
|
color_scheme: Var[LiteralAccentColor]
|
||||||
|
|
||||||
_valid_parents: List[str] = ["TabsList"]
|
_valid_parents: list[str] = ["TabsList"]
|
||||||
|
|
||||||
_memoization_mode = MemoizationMode(recursive=False)
|
_memoization_mode = MemoizationMode(recursive=False)
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class Axis(Recharts):
|
|||||||
name: Var[Union[str, int]]
|
name: Var[Union[str, int]]
|
||||||
|
|
||||||
# Set the values of axis ticks manually.
|
# Set the values of axis ticks manually.
|
||||||
ticks: Var[List[Union[str, int]]]
|
ticks: Var[list[Union[str, int]]]
|
||||||
|
|
||||||
# If set false, no ticks will be drawn.
|
# If set false, no ticks will be drawn.
|
||||||
tick: Var[bool]
|
tick: Var[bool]
|
||||||
@ -184,7 +184,7 @@ class ZAxis(Recharts):
|
|||||||
z_axis_id: Var[Union[str, int]]
|
z_axis_id: Var[Union[str, int]]
|
||||||
|
|
||||||
# The range of axis. Default: [10, 10]
|
# The range of axis. Default: [10, 10]
|
||||||
range: Var[List[int]]
|
range: Var[list[int]]
|
||||||
|
|
||||||
# The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart.
|
# The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart.
|
||||||
unit: Var[Union[str, int]]
|
unit: Var[Union[str, int]]
|
||||||
@ -225,7 +225,7 @@ class Brush(Recharts):
|
|||||||
height: Var[int]
|
height: Var[int]
|
||||||
|
|
||||||
# The original data of a LineChart, a BarChart or an AreaChart.
|
# The original data of a LineChart, a BarChart or an AreaChart.
|
||||||
data: Var[List[Any]]
|
data: Var[list[Any]]
|
||||||
|
|
||||||
# The width of each traveller. Default: 5
|
# The width of each traveller. Default: 5
|
||||||
traveller_width: Var[int]
|
traveller_width: Var[int]
|
||||||
@ -357,10 +357,10 @@ class Area(Cartesian):
|
|||||||
label: Var[bool]
|
label: Var[bool]
|
||||||
|
|
||||||
# The value which can describle the line, usually calculated internally.
|
# The value which can describle the line, usually calculated internally.
|
||||||
base_line: Var[Union[str, List[Dict[str, Any]]]]
|
base_line: Var[Union[str, list[Dict[str, Any]]]]
|
||||||
|
|
||||||
# The coordinates of all the points in the area, usually calculated internally.
|
# The coordinates of all the points in the area, usually calculated internally.
|
||||||
points: Var[List[Dict[str, Any]]]
|
points: Var[list[Dict[str, Any]]]
|
||||||
|
|
||||||
# The stack id of area, when two areas have the same value axis and same stack_id, then the two areas are stacked in order.
|
# The stack id of area, when two areas have the same value axis and same stack_id, then the two areas are stacked in order.
|
||||||
stack_id: Var[Union[str, int]]
|
stack_id: Var[Union[str, int]]
|
||||||
@ -369,7 +369,7 @@ class Area(Cartesian):
|
|||||||
connect_nulls: Var[bool]
|
connect_nulls: Var[bool]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = ["LabelList"]
|
_valid_children: list[str] = ["LabelList"]
|
||||||
|
|
||||||
|
|
||||||
class Bar(Cartesian):
|
class Bar(Cartesian):
|
||||||
@ -413,13 +413,13 @@ class Bar(Cartesian):
|
|||||||
max_bar_size: Var[int]
|
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
|
# 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[Union[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.
|
# 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
|
# active_bar: Var[Union[bool, Dict[str, Any]]] #noqa: ERA001
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = ["Cell", "LabelList", "ErrorBar"]
|
_valid_children: list[str] = ["Cell", "LabelList", "ErrorBar"]
|
||||||
|
|
||||||
|
|
||||||
class Line(Cartesian):
|
class Line(Cartesian):
|
||||||
@ -467,13 +467,13 @@ class Line(Cartesian):
|
|||||||
unit: Var[Union[str, int]]
|
unit: Var[Union[str, int]]
|
||||||
|
|
||||||
# The coordinates of all the points in the line, usually calculated internally.
|
# The coordinates of all the points in the line, usually calculated internally.
|
||||||
points: Var[List[Dict[str, Any]]]
|
points: Var[list[Dict[str, Any]]]
|
||||||
|
|
||||||
# The pattern of dashes and gaps used to paint the line.
|
# The pattern of dashes and gaps used to paint the line.
|
||||||
stroke_dasharray: Var[str]
|
stroke_dasharray: Var[str]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = ["LabelList", "ErrorBar"]
|
_valid_children: list[str] = ["LabelList", "ErrorBar"]
|
||||||
|
|
||||||
|
|
||||||
class Scatter(Recharts):
|
class Scatter(Recharts):
|
||||||
@ -484,7 +484,7 @@ class Scatter(Recharts):
|
|||||||
alias = "RechartsScatter"
|
alias = "RechartsScatter"
|
||||||
|
|
||||||
# The source data, in which each element is an object.
|
# The source data, in which each element is an object.
|
||||||
data: Var[List[Dict[str, Any]]]
|
data: Var[list[Dict[str, Any]]]
|
||||||
|
|
||||||
# The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' | 'none'. Default: "circle"
|
# The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' | 'none'. Default: "circle"
|
||||||
legend_type: Var[LiteralLegendType]
|
legend_type: Var[LiteralLegendType]
|
||||||
@ -511,7 +511,7 @@ class Scatter(Recharts):
|
|||||||
fill: Var[Union[str, Color]] = LiteralVar.create(Color("accent", 9))
|
fill: Var[Union[str, Color]] = LiteralVar.create(Color("accent", 9))
|
||||||
|
|
||||||
# Valid children components.
|
# Valid children components.
|
||||||
_valid_children: List[str] = ["LabelList", "ErrorBar"]
|
_valid_children: list[str] = ["LabelList", "ErrorBar"]
|
||||||
|
|
||||||
# If set false, animation of bar will be disabled. Default: True in CSR, False in SSR
|
# If set false, animation of bar will be disabled. Default: True in CSR, False in SSR
|
||||||
is_animation_active: Var[bool]
|
is_animation_active: Var[bool]
|
||||||
@ -558,7 +558,7 @@ class Funnel(Recharts):
|
|||||||
alias = "RechartsFunnel"
|
alias = "RechartsFunnel"
|
||||||
|
|
||||||
# The source data, in which each element is an object.
|
# The source data, in which each element is an object.
|
||||||
data: Var[List[Dict[str, Any]]]
|
data: Var[list[Dict[str, Any]]]
|
||||||
|
|
||||||
# The key or getter of a group of data which should be unique in a FunnelChart.
|
# The key or getter of a group of data which should be unique in a FunnelChart.
|
||||||
data_key: Var[Union[str, int]]
|
data_key: Var[Union[str, int]]
|
||||||
@ -585,10 +585,10 @@ class Funnel(Recharts):
|
|||||||
stroke: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 3))
|
stroke: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 3))
|
||||||
|
|
||||||
# The coordinates of all the trapezoids in the funnel, usually calculated internally.
|
# The coordinates of all the trapezoids in the funnel, usually calculated internally.
|
||||||
trapezoids: Var[List[Dict[str, Any]]]
|
trapezoids: Var[list[Dict[str, Any]]]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = ["LabelList", "Cell"]
|
_valid_children: list[str] = ["LabelList", "Cell"]
|
||||||
|
|
||||||
# The customized event handler of animation start
|
# The customized event handler of animation start
|
||||||
on_animation_start: EventHandler[no_args_event_spec]
|
on_animation_start: EventHandler[no_args_event_spec]
|
||||||
@ -683,10 +683,10 @@ class ReferenceLine(Reference):
|
|||||||
stroke_width: Var[Union[str, int]]
|
stroke_width: Var[Union[str, int]]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = ["Label"]
|
_valid_children: list[str] = ["Label"]
|
||||||
|
|
||||||
# Array of endpoints in { x, y } format. These endpoints would be used to draw the ReferenceLine.
|
# Array of endpoints in { x, y } format. These endpoints would be used to draw the ReferenceLine.
|
||||||
segment: List[Any] = []
|
segment: list[Any] = []
|
||||||
|
|
||||||
|
|
||||||
class ReferenceDot(Reference):
|
class ReferenceDot(Reference):
|
||||||
@ -712,7 +712,7 @@ class ReferenceDot(Reference):
|
|||||||
stroke: Var[Union[str, Color]]
|
stroke: Var[Union[str, Color]]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = ["Label"]
|
_valid_children: list[str] = ["Label"]
|
||||||
|
|
||||||
# The customized event handler of click on the component in this chart
|
# The customized event handler of click on the component in this chart
|
||||||
on_click: EventHandler[no_args_event_spec]
|
on_click: EventHandler[no_args_event_spec]
|
||||||
@ -780,7 +780,7 @@ class ReferenceArea(Recharts):
|
|||||||
is_front: Var[bool]
|
is_front: Var[bool]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = ["Label"]
|
_valid_children: list[str] = ["Label"]
|
||||||
|
|
||||||
|
|
||||||
class Grid(Recharts):
|
class Grid(Recharts):
|
||||||
@ -813,10 +813,10 @@ class CartesianGrid(Grid):
|
|||||||
vertical: Var[bool]
|
vertical: Var[bool]
|
||||||
|
|
||||||
# The x-coordinates in pixel values of all vertical lines. Default: []
|
# The x-coordinates in pixel values of all vertical lines. Default: []
|
||||||
vertical_points: Var[List[Union[str, int]]]
|
vertical_points: Var[list[Union[str, int]]]
|
||||||
|
|
||||||
# The x-coordinates in pixel values of all vertical lines. Default: []
|
# The x-coordinates in pixel values of all vertical lines. Default: []
|
||||||
horizontal_points: Var[List[Union[str, int]]]
|
horizontal_points: Var[list[Union[str, int]]]
|
||||||
|
|
||||||
# The background of grid.
|
# The background of grid.
|
||||||
fill: Var[Union[str, Color]]
|
fill: Var[Union[str, Color]]
|
||||||
|
@ -100,7 +100,7 @@ class Axis(Recharts):
|
|||||||
unit: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
unit: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
name: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
name: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
ticks: Optional[
|
ticks: Optional[
|
||||||
Union[List[Union[int, str]], Var[List[Union[int, str]]]]
|
Union[Var[list[Union[int, str]]], list[Union[int, str]]]
|
||||||
] = None,
|
] = None,
|
||||||
tick: Optional[Union[Var[bool], bool]] = None,
|
tick: Optional[Union[Var[bool], bool]] = None,
|
||||||
tick_count: Optional[Union[Var[int], int]] = None,
|
tick_count: Optional[Union[Var[int], int]] = None,
|
||||||
@ -281,7 +281,7 @@ class XAxis(Axis):
|
|||||||
unit: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
unit: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
name: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
name: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
ticks: Optional[
|
ticks: Optional[
|
||||||
Union[List[Union[int, str]], Var[List[Union[int, str]]]]
|
Union[Var[list[Union[int, str]]], list[Union[int, str]]]
|
||||||
] = None,
|
] = None,
|
||||||
tick: Optional[Union[Var[bool], bool]] = None,
|
tick: Optional[Union[Var[bool], bool]] = None,
|
||||||
tick_count: Optional[Union[Var[int], int]] = None,
|
tick_count: Optional[Union[Var[int], int]] = None,
|
||||||
@ -465,7 +465,7 @@ class YAxis(Axis):
|
|||||||
unit: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
unit: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
name: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
name: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
ticks: Optional[
|
ticks: Optional[
|
||||||
Union[List[Union[int, str]], Var[List[Union[int, str]]]]
|
Union[Var[list[Union[int, str]]], list[Union[int, str]]]
|
||||||
] = None,
|
] = None,
|
||||||
tick: Optional[Union[Var[bool], bool]] = None,
|
tick: Optional[Union[Var[bool], bool]] = None,
|
||||||
tick_count: Optional[Union[Var[int], int]] = None,
|
tick_count: Optional[Union[Var[int], int]] = None,
|
||||||
@ -562,7 +562,7 @@ class ZAxis(Recharts):
|
|||||||
*children,
|
*children,
|
||||||
data_key: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
data_key: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
z_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
z_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
range: Optional[Union[List[int], Var[List[int]]]] = None,
|
range: Optional[Union[Var[list[int]], list[int]]] = None,
|
||||||
unit: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
unit: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
name: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
name: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
scale: Optional[
|
scale: Optional[
|
||||||
@ -665,7 +665,7 @@ class Brush(Recharts):
|
|||||||
y: Optional[Union[Var[int], int]] = None,
|
y: Optional[Union[Var[int], int]] = None,
|
||||||
width: Optional[Union[Var[int], int]] = None,
|
width: Optional[Union[Var[int], int]] = None,
|
||||||
height: Optional[Union[Var[int], int]] = None,
|
height: Optional[Union[Var[int], int]] = None,
|
||||||
data: Optional[Union[List[Any], Var[List[Any]]]] = None,
|
data: Optional[Union[Var[list[Any]], list[Any]]] = None,
|
||||||
traveller_width: Optional[Union[Var[int], int]] = None,
|
traveller_width: Optional[Union[Var[int], int]] = None,
|
||||||
gap: Optional[Union[Var[int], int]] = None,
|
gap: Optional[Union[Var[int], int]] = None,
|
||||||
start_index: Optional[Union[Var[int], int]] = None,
|
start_index: Optional[Union[Var[int], int]] = None,
|
||||||
@ -886,9 +886,9 @@ class Area(Cartesian):
|
|||||||
] = None,
|
] = None,
|
||||||
label: Optional[Union[Var[bool], bool]] = None,
|
label: Optional[Union[Var[bool], bool]] = None,
|
||||||
base_line: Optional[
|
base_line: Optional[
|
||||||
Union[List[Dict[str, Any]], Var[Union[List[Dict[str, Any]], str]], str]
|
Union[Var[Union[list[Dict[str, Any]], str]], list[Dict[str, Any]], str]
|
||||||
] = None,
|
] = None,
|
||||||
points: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
points: Optional[Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]] = None,
|
||||||
stack_id: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
stack_id: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
connect_nulls: Optional[Union[Var[bool], bool]] = None,
|
connect_nulls: Optional[Union[Var[bool], bool]] = None,
|
||||||
layout: Optional[
|
layout: Optional[
|
||||||
@ -1034,7 +1034,7 @@ class Bar(Cartesian):
|
|||||||
name: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
name: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
bar_size: Optional[Union[Var[int], int]] = None,
|
bar_size: Optional[Union[Var[int], int]] = None,
|
||||||
max_bar_size: Optional[Union[Var[int], int]] = None,
|
max_bar_size: Optional[Union[Var[int], int]] = None,
|
||||||
radius: Optional[Union[List[int], Var[Union[List[int], int]], int]] = None,
|
radius: Optional[Union[Var[Union[int, list[int]]], int, list[int]]] = None,
|
||||||
layout: Optional[
|
layout: Optional[
|
||||||
Union[
|
Union[
|
||||||
Literal["horizontal", "vertical"],
|
Literal["horizontal", "vertical"],
|
||||||
@ -1216,7 +1216,7 @@ class Line(Cartesian):
|
|||||||
hide: Optional[Union[Var[bool], bool]] = None,
|
hide: Optional[Union[Var[bool], bool]] = None,
|
||||||
connect_nulls: Optional[Union[Var[bool], bool]] = None,
|
connect_nulls: Optional[Union[Var[bool], bool]] = None,
|
||||||
unit: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
unit: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
points: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
points: Optional[Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]] = None,
|
||||||
stroke_dasharray: Optional[Union[Var[str], str]] = None,
|
stroke_dasharray: Optional[Union[Var[str], str]] = None,
|
||||||
layout: Optional[
|
layout: Optional[
|
||||||
Union[
|
Union[
|
||||||
@ -1348,7 +1348,7 @@ class Scatter(Recharts):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
data: Optional[Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]] = None,
|
||||||
legend_type: Optional[
|
legend_type: Optional[
|
||||||
Union[
|
Union[
|
||||||
Literal[
|
Literal[
|
||||||
@ -1483,7 +1483,7 @@ class Funnel(Recharts):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
data: Optional[Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]] = None,
|
||||||
data_key: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
data_key: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
name_key: Optional[Union[Var[str], str]] = None,
|
name_key: Optional[Union[Var[str], str]] = None,
|
||||||
legend_type: Optional[
|
legend_type: Optional[
|
||||||
@ -1529,7 +1529,7 @@ class Funnel(Recharts):
|
|||||||
] = None,
|
] = None,
|
||||||
stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None,
|
stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None,
|
||||||
trapezoids: Optional[
|
trapezoids: Optional[
|
||||||
Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]
|
Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]
|
||||||
] = None,
|
] = None,
|
||||||
style: Optional[Style] = None,
|
style: Optional[Style] = None,
|
||||||
key: Optional[Any] = None,
|
key: Optional[Any] = None,
|
||||||
@ -1720,7 +1720,7 @@ class ReferenceLine(Reference):
|
|||||||
y: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
y: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None,
|
stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None,
|
||||||
stroke_width: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
stroke_width: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
segment: Optional[List[Any]] = None,
|
segment: Optional[list[Any]] = None,
|
||||||
x_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
x_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
y_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
y_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
if_overflow: Optional[
|
if_overflow: Optional[
|
||||||
@ -1996,10 +1996,10 @@ class CartesianGrid(Grid):
|
|||||||
horizontal: Optional[Union[Var[bool], bool]] = None,
|
horizontal: Optional[Union[Var[bool], bool]] = None,
|
||||||
vertical: Optional[Union[Var[bool], bool]] = None,
|
vertical: Optional[Union[Var[bool], bool]] = None,
|
||||||
vertical_points: Optional[
|
vertical_points: Optional[
|
||||||
Union[List[Union[int, str]], Var[List[Union[int, str]]]]
|
Union[Var[list[Union[int, str]]], list[Union[int, str]]]
|
||||||
] = None,
|
] = None,
|
||||||
horizontal_points: Optional[
|
horizontal_points: Optional[
|
||||||
Union[List[Union[int, str]], Var[List[Union[int, str]]]]
|
Union[Var[list[Union[int, str]]], list[Union[int, str]]]
|
||||||
] = None,
|
] = None,
|
||||||
fill: Optional[Union[Color, Var[Union[Color, str]], str]] = None,
|
fill: Optional[Union[Color, Var[Union[Color, str]], str]] = None,
|
||||||
fill_opacity: Optional[Union[Var[float], float]] = None,
|
fill_opacity: Optional[Union[Var[float], float]] = None,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Dict, List, Union
|
from typing import Any, Dict, Union
|
||||||
|
|
||||||
from reflex.components.component import Component
|
from reflex.components.component import Component
|
||||||
from reflex.components.recharts.general import ResponsiveContainer
|
from reflex.components.recharts.general import ResponsiveContainer
|
||||||
@ -104,7 +104,7 @@ class CategoricalChartBase(ChartBase):
|
|||||||
"""A component that wraps a Categorical Recharts charts."""
|
"""A component that wraps a Categorical Recharts charts."""
|
||||||
|
|
||||||
# The source data, in which each element is an object.
|
# The source data, in which each element is an object.
|
||||||
data: Var[List[Dict[str, Any]]]
|
data: Var[list[Dict[str, Any]]]
|
||||||
|
|
||||||
# The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}.
|
# The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}.
|
||||||
margin: Var[Dict[str, Any]]
|
margin: Var[Dict[str, Any]]
|
||||||
@ -133,7 +133,7 @@ class AreaChart(CategoricalChartBase):
|
|||||||
base_value: Var[Union[int, LiteralComposedChartBaseValue]]
|
base_value: Var[Union[int, LiteralComposedChartBaseValue]]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = [
|
_valid_children: list[str] = [
|
||||||
"XAxis",
|
"XAxis",
|
||||||
"YAxis",
|
"YAxis",
|
||||||
"ReferenceArea",
|
"ReferenceArea",
|
||||||
@ -174,7 +174,7 @@ class BarChart(CategoricalChartBase):
|
|||||||
reverse_stack_order: Var[bool]
|
reverse_stack_order: Var[bool]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = [
|
_valid_children: list[str] = [
|
||||||
"XAxis",
|
"XAxis",
|
||||||
"YAxis",
|
"YAxis",
|
||||||
"ReferenceArea",
|
"ReferenceArea",
|
||||||
@ -196,7 +196,7 @@ class LineChart(CategoricalChartBase):
|
|||||||
alias = "RechartsLineChart"
|
alias = "RechartsLineChart"
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = [
|
_valid_children: list[str] = [
|
||||||
"XAxis",
|
"XAxis",
|
||||||
"YAxis",
|
"YAxis",
|
||||||
"ReferenceArea",
|
"ReferenceArea",
|
||||||
@ -233,7 +233,7 @@ class ComposedChart(CategoricalChartBase):
|
|||||||
reverse_stack_order: Var[bool]
|
reverse_stack_order: Var[bool]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = [
|
_valid_children: list[str] = [
|
||||||
"XAxis",
|
"XAxis",
|
||||||
"YAxis",
|
"YAxis",
|
||||||
"ReferenceArea",
|
"ReferenceArea",
|
||||||
@ -260,7 +260,7 @@ class PieChart(ChartBase):
|
|||||||
margin: Var[Dict[str, Any]]
|
margin: Var[Dict[str, Any]]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = [
|
_valid_children: list[str] = [
|
||||||
"PolarAngleAxis",
|
"PolarAngleAxis",
|
||||||
"PolarRadiusAxis",
|
"PolarRadiusAxis",
|
||||||
"PolarGrid",
|
"PolarGrid",
|
||||||
@ -290,7 +290,7 @@ class RadarChart(ChartBase):
|
|||||||
alias = "RechartsRadarChart"
|
alias = "RechartsRadarChart"
|
||||||
|
|
||||||
# The source data, in which each element is an object.
|
# The source data, in which each element is an object.
|
||||||
data: Var[List[Dict[str, Any]]]
|
data: Var[list[Dict[str, Any]]]
|
||||||
|
|
||||||
# The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. Default: {"top": 0, "right": 0, "left": 0, "bottom": 0}
|
# The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. Default: {"top": 0, "right": 0, "left": 0, "bottom": 0}
|
||||||
margin: Var[Dict[str, Any]]
|
margin: Var[Dict[str, Any]]
|
||||||
@ -314,7 +314,7 @@ class RadarChart(ChartBase):
|
|||||||
outer_radius: Var[Union[int, str]]
|
outer_radius: Var[Union[int, str]]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = [
|
_valid_children: list[str] = [
|
||||||
"PolarAngleAxis",
|
"PolarAngleAxis",
|
||||||
"PolarRadiusAxis",
|
"PolarRadiusAxis",
|
||||||
"PolarGrid",
|
"PolarGrid",
|
||||||
@ -344,7 +344,7 @@ class RadialBarChart(ChartBase):
|
|||||||
alias = "RechartsRadialBarChart"
|
alias = "RechartsRadialBarChart"
|
||||||
|
|
||||||
# The source data which each element is an object.
|
# The source data which each element is an object.
|
||||||
data: Var[List[Dict[str, Any]]]
|
data: Var[list[Dict[str, Any]]]
|
||||||
|
|
||||||
# The sizes of whitespace around the chart. Default: {"top": 5, "right": 5, "left": 5 "bottom": 5}
|
# The sizes of whitespace around the chart. Default: {"top": 5, "right": 5, "left": 5 "bottom": 5}
|
||||||
margin: Var[Dict[str, Any]]
|
margin: Var[Dict[str, Any]]
|
||||||
@ -377,7 +377,7 @@ class RadialBarChart(ChartBase):
|
|||||||
bar_size: Var[int]
|
bar_size: Var[int]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = [
|
_valid_children: list[str] = [
|
||||||
"PolarAngleAxis",
|
"PolarAngleAxis",
|
||||||
"PolarRadiusAxis",
|
"PolarRadiusAxis",
|
||||||
"PolarGrid",
|
"PolarGrid",
|
||||||
@ -398,7 +398,7 @@ class ScatterChart(ChartBase):
|
|||||||
margin: Var[Dict[str, Any]]
|
margin: Var[Dict[str, Any]]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = [
|
_valid_children: list[str] = [
|
||||||
"XAxis",
|
"XAxis",
|
||||||
"YAxis",
|
"YAxis",
|
||||||
"ZAxis",
|
"ZAxis",
|
||||||
@ -447,7 +447,7 @@ class FunnelChart(ChartBase):
|
|||||||
stroke: Var[Union[str, Color]]
|
stroke: Var[Union[str, Color]]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = ["Legend", "GraphingTooltip", "Funnel"]
|
_valid_children: list[str] = ["Legend", "GraphingTooltip", "Funnel"]
|
||||||
|
|
||||||
|
|
||||||
class Treemap(RechartsCharts):
|
class Treemap(RechartsCharts):
|
||||||
@ -464,7 +464,7 @@ class Treemap(RechartsCharts):
|
|||||||
height: Var[Union[str, int]] = Var.create("100%")
|
height: Var[Union[str, int]] = Var.create("100%")
|
||||||
|
|
||||||
# data of treemap. Array
|
# data of treemap. Array
|
||||||
data: Var[List[Dict[str, Any]]]
|
data: Var[list[Dict[str, Any]]]
|
||||||
|
|
||||||
# The key of a group of data which should be unique in a treemap. String | Number. Default: "value"
|
# The key of a group of data which should be unique in a treemap. String | Number. Default: "value"
|
||||||
data_key: Var[Union[str, int]]
|
data_key: Var[Union[str, int]]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# ------------------- DO NOT EDIT ----------------------
|
# ------------------- DO NOT EDIT ----------------------
|
||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from typing import Any, Dict, List, Literal, Optional, Union, overload
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
||||||
|
|
||||||
from reflex.constants.colors import Color
|
from reflex.constants.colors import Color
|
||||||
from reflex.event import EventType
|
from reflex.event import EventType
|
||||||
@ -72,7 +72,7 @@ class CategoricalChartBase(ChartBase):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
data: Optional[Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]] = None,
|
||||||
margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None,
|
margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None,
|
||||||
sync_id: Optional[Union[Var[str], str]] = None,
|
sync_id: Optional[Union[Var[str], str]] = None,
|
||||||
sync_method: Optional[
|
sync_method: Optional[
|
||||||
@ -157,7 +157,7 @@ class AreaChart(CategoricalChartBase):
|
|||||||
int,
|
int,
|
||||||
]
|
]
|
||||||
] = None,
|
] = None,
|
||||||
data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
data: Optional[Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]] = None,
|
||||||
margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None,
|
margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None,
|
||||||
sync_id: Optional[Union[Var[str], str]] = None,
|
sync_id: Optional[Union[Var[str], str]] = None,
|
||||||
sync_method: Optional[
|
sync_method: Optional[
|
||||||
@ -247,7 +247,7 @@ class BarChart(CategoricalChartBase):
|
|||||||
]
|
]
|
||||||
] = None,
|
] = None,
|
||||||
reverse_stack_order: Optional[Union[Var[bool], bool]] = None,
|
reverse_stack_order: Optional[Union[Var[bool], bool]] = None,
|
||||||
data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
data: Optional[Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]] = None,
|
||||||
margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None,
|
margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None,
|
||||||
sync_id: Optional[Union[Var[str], str]] = None,
|
sync_id: Optional[Union[Var[str], str]] = None,
|
||||||
sync_method: Optional[
|
sync_method: Optional[
|
||||||
@ -324,7 +324,7 @@ class LineChart(CategoricalChartBase):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
data: Optional[Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]] = None,
|
||||||
margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None,
|
margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None,
|
||||||
sync_id: Optional[Union[Var[str], str]] = None,
|
sync_id: Optional[Union[Var[str], str]] = None,
|
||||||
sync_method: Optional[
|
sync_method: Optional[
|
||||||
@ -413,7 +413,7 @@ class ComposedChart(CategoricalChartBase):
|
|||||||
bar_gap: Optional[Union[Var[int], int]] = None,
|
bar_gap: Optional[Union[Var[int], int]] = None,
|
||||||
bar_size: Optional[Union[Var[int], int]] = None,
|
bar_size: Optional[Union[Var[int], int]] = None,
|
||||||
reverse_stack_order: Optional[Union[Var[bool], bool]] = None,
|
reverse_stack_order: Optional[Union[Var[bool], bool]] = None,
|
||||||
data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
data: Optional[Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]] = None,
|
||||||
margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None,
|
margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None,
|
||||||
sync_id: Optional[Union[Var[str], str]] = None,
|
sync_id: Optional[Union[Var[str], str]] = None,
|
||||||
sync_method: Optional[
|
sync_method: Optional[
|
||||||
@ -557,7 +557,7 @@ class RadarChart(ChartBase):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
data: Optional[Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]] = None,
|
||||||
margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None,
|
margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None,
|
||||||
cx: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
cx: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
cy: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
cy: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
@ -614,7 +614,7 @@ class RadialBarChart(ChartBase):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
data: Optional[Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]] = None,
|
||||||
margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None,
|
margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None,
|
||||||
cx: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
cx: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
cy: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
cy: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
@ -802,7 +802,7 @@ class Treemap(RechartsCharts):
|
|||||||
*children,
|
*children,
|
||||||
width: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
width: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
height: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
height: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
data: Optional[Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]] = None,
|
||||||
data_key: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
data_key: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
name_key: Optional[Union[Var[str], str]] = None,
|
name_key: Optional[Union[Var[str], str]] = None,
|
||||||
aspect_ratio: Optional[Union[Var[int], int]] = None,
|
aspect_ratio: Optional[Union[Var[int], int]] = None,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Dict, List, Union
|
from typing import Any, Dict, Union
|
||||||
|
|
||||||
from reflex.components.component import MemoizationLeaf
|
from reflex.components.component import MemoizationLeaf
|
||||||
from reflex.constants.colors import Color
|
from reflex.constants.colors import Color
|
||||||
@ -49,7 +49,7 @@ class ResponsiveContainer(Recharts, MemoizationLeaf):
|
|||||||
on_resize: EventHandler[no_args_event_spec]
|
on_resize: EventHandler[no_args_event_spec]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = [
|
_valid_children: list[str] = [
|
||||||
"AreaChart",
|
"AreaChart",
|
||||||
"BarChart",
|
"BarChart",
|
||||||
"LineChart",
|
"LineChart",
|
||||||
@ -92,7 +92,7 @@ class Legend(Recharts):
|
|||||||
icon_type: Var[LiteralIconType]
|
icon_type: Var[LiteralIconType]
|
||||||
|
|
||||||
# The source data of the content to be displayed in the legend, usually calculated internally. Default: []
|
# The source data of the content to be displayed in the legend, usually calculated internally. Default: []
|
||||||
payload: Var[List[Dict[str, Any]]]
|
payload: Var[list[Dict[str, Any]]]
|
||||||
|
|
||||||
# The width of chart container, usually calculated internally.
|
# The width of chart container, usually calculated internally.
|
||||||
chart_width: Var[int]
|
chart_width: Var[int]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# ------------------- DO NOT EDIT ----------------------
|
# ------------------- DO NOT EDIT ----------------------
|
||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from typing import Any, Dict, List, Literal, Optional, Union, overload
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
||||||
|
|
||||||
from reflex.components.component import MemoizationLeaf
|
from reflex.components.component import MemoizationLeaf
|
||||||
from reflex.constants.colors import Color
|
from reflex.constants.colors import Color
|
||||||
@ -131,7 +131,7 @@ class Legend(Recharts):
|
|||||||
]
|
]
|
||||||
] = None,
|
] = None,
|
||||||
payload: Optional[
|
payload: Optional[
|
||||||
Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]
|
Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]
|
||||||
] = None,
|
] = None,
|
||||||
chart_width: Optional[Union[Var[int], int]] = None,
|
chart_width: Optional[Union[Var[int], int]] = None,
|
||||||
chart_height: Optional[Union[Var[int], int]] = None,
|
chart_height: Optional[Union[Var[int], int]] = None,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Dict, List, Union
|
from typing import Any, Dict, Union
|
||||||
|
|
||||||
from reflex.constants import EventTriggers
|
from reflex.constants import EventTriggers
|
||||||
from reflex.constants.colors import Color
|
from reflex.constants.colors import Color
|
||||||
@ -28,7 +28,7 @@ class Pie(Recharts):
|
|||||||
alias = "RechartsPie"
|
alias = "RechartsPie"
|
||||||
|
|
||||||
# The source data which each element is an object.
|
# The source data which each element is an object.
|
||||||
data: Var[List[Dict[str, Any]]]
|
data: Var[list[Dict[str, Any]]]
|
||||||
|
|
||||||
# The key of each sector's value.
|
# The key of each sector's value.
|
||||||
data_key: Var[Union[str, int]]
|
data_key: Var[Union[str, int]]
|
||||||
@ -70,10 +70,10 @@ class Pie(Recharts):
|
|||||||
label_line: Var[bool]
|
label_line: Var[bool]
|
||||||
|
|
||||||
# The index of active sector in Pie, this option can be changed in mouse event handlers.
|
# The index of active sector in Pie, this option can be changed in mouse event handlers.
|
||||||
data: Var[List[Dict[str, Any]]]
|
data: Var[list[Dict[str, Any]]]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = ["Cell", "LabelList", "Bare"]
|
_valid_children: list[str] = ["Cell", "LabelList", "Bare"]
|
||||||
|
|
||||||
# Stoke color. Default: rx.color("accent", 9)
|
# Stoke color. Default: rx.color("accent", 9)
|
||||||
stroke: Var[Union[str, Color]] = LiteralVar.create(Color("accent", 9))
|
stroke: Var[Union[str, Color]] = LiteralVar.create(Color("accent", 9))
|
||||||
@ -125,7 +125,7 @@ class Radar(Recharts):
|
|||||||
data_key: Var[Union[str, int]]
|
data_key: Var[Union[str, int]]
|
||||||
|
|
||||||
# The coordinates of all the vertices of the radar shape, like [{ x, y }].
|
# The coordinates of all the vertices of the radar shape, like [{ x, y }].
|
||||||
points: Var[List[Dict[str, Any]]]
|
points: Var[list[Dict[str, Any]]]
|
||||||
|
|
||||||
# If false set, dots will not be drawn. Default: True
|
# If false set, dots will not be drawn. Default: True
|
||||||
dot: Var[bool]
|
dot: Var[bool]
|
||||||
@ -158,7 +158,7 @@ class Radar(Recharts):
|
|||||||
animation_easing: Var[LiteralAnimationEasing]
|
animation_easing: Var[LiteralAnimationEasing]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = ["LabelList"]
|
_valid_children: list[str] = ["LabelList"]
|
||||||
|
|
||||||
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
|
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
|
||||||
"""Get the event triggers that pass the component's value to the handler.
|
"""Get the event triggers that pass the component's value to the handler.
|
||||||
@ -180,7 +180,7 @@ class RadialBar(Recharts):
|
|||||||
alias = "RechartsRadialBar"
|
alias = "RechartsRadialBar"
|
||||||
|
|
||||||
# The source data which each element is an object.
|
# The source data which each element is an object.
|
||||||
data: Var[List[Dict[str, Any]]]
|
data: Var[list[Dict[str, Any]]]
|
||||||
|
|
||||||
# The key of a group of data which should be unique to show the meaning of angle axis.
|
# The key of a group of data which should be unique to show the meaning of angle axis.
|
||||||
data_key: Var[Union[str, int]]
|
data_key: Var[Union[str, int]]
|
||||||
@ -210,7 +210,7 @@ class RadialBar(Recharts):
|
|||||||
animation_easing: Var[LiteralAnimationEasing]
|
animation_easing: Var[LiteralAnimationEasing]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = ["Cell", "LabelList"]
|
_valid_children: list[str] = ["Cell", "LabelList"]
|
||||||
|
|
||||||
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
|
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
|
||||||
"""Get the event triggers that pass the component's value to the handler.
|
"""Get the event triggers that pass the component's value to the handler.
|
||||||
@ -262,7 +262,7 @@ class PolarAngleAxis(Recharts):
|
|||||||
tick: Var[Union[bool, Dict[str, Any]]]
|
tick: Var[Union[bool, Dict[str, Any]]]
|
||||||
|
|
||||||
# The array of every tick's value and angle.
|
# The array of every tick's value and angle.
|
||||||
ticks: Var[List[Dict[str, Any]]]
|
ticks: Var[list[Dict[str, Any]]]
|
||||||
|
|
||||||
# The orientation of axis text. Default: "outer"
|
# The orientation of axis text. Default: "outer"
|
||||||
orientation: Var[str]
|
orientation: Var[str]
|
||||||
@ -274,7 +274,7 @@ class PolarAngleAxis(Recharts):
|
|||||||
allow_duplicated_category: Var[bool]
|
allow_duplicated_category: Var[bool]
|
||||||
|
|
||||||
# Valid children components.
|
# Valid children components.
|
||||||
_valid_children: List[str] = ["Label"]
|
_valid_children: list[str] = ["Label"]
|
||||||
|
|
||||||
# The customized event handler of click on the ticks of this axis.
|
# The customized event handler of click on the ticks of this axis.
|
||||||
on_click: EventHandler[no_args_event_spec]
|
on_click: EventHandler[no_args_event_spec]
|
||||||
@ -321,10 +321,10 @@ class PolarGrid(Recharts):
|
|||||||
outer_radius: Var[int]
|
outer_radius: Var[int]
|
||||||
|
|
||||||
# The array of every line grid's angle.
|
# The array of every line grid's angle.
|
||||||
polar_angles: Var[List[int]]
|
polar_angles: Var[list[int]]
|
||||||
|
|
||||||
# The array of every line grid's radius.
|
# The array of every line grid's radius.
|
||||||
polar_radius: Var[List[int]]
|
polar_radius: Var[list[int]]
|
||||||
|
|
||||||
# The type of polar grids. 'polygon' | 'circle'. Default: "polygon"
|
# The type of polar grids. 'polygon' | 'circle'. Default: "polygon"
|
||||||
grid_type: Var[LiteralGridType]
|
grid_type: Var[LiteralGridType]
|
||||||
@ -333,7 +333,7 @@ class PolarGrid(Recharts):
|
|||||||
stroke: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 10))
|
stroke: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 10))
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = ["RadarChart", "RadiarBarChart"]
|
_valid_children: list[str] = ["RadarChart", "RadiarBarChart"]
|
||||||
|
|
||||||
|
|
||||||
class PolarRadiusAxis(Recharts):
|
class PolarRadiusAxis(Recharts):
|
||||||
@ -377,10 +377,10 @@ class PolarRadiusAxis(Recharts):
|
|||||||
scale: Var[LiteralScale]
|
scale: Var[LiteralScale]
|
||||||
|
|
||||||
# Valid children components
|
# Valid children components
|
||||||
_valid_children: List[str] = ["Label"]
|
_valid_children: list[str] = ["Label"]
|
||||||
|
|
||||||
# The domain of the polar radius axis, specifying the minimum and maximum values. Default: [0, "auto"]
|
# The domain of the polar radius axis, specifying the minimum and maximum values. Default: [0, "auto"]
|
||||||
domain: Var[List[Union[int, str]]]
|
domain: Var[list[Union[int, str]]]
|
||||||
|
|
||||||
# The stroke color of axis. Default: rx.color("gray", 10)
|
# The stroke color of axis. Default: rx.color("gray", 10)
|
||||||
stroke: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 10))
|
stroke: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 10))
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# ------------------- DO NOT EDIT ----------------------
|
# ------------------- DO NOT EDIT ----------------------
|
||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from typing import Any, Dict, List, Literal, Optional, Union, overload
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
||||||
|
|
||||||
from reflex.constants.colors import Color
|
from reflex.constants.colors import Color
|
||||||
from reflex.event import EventType
|
from reflex.event import EventType
|
||||||
@ -19,7 +19,7 @@ class Pie(Recharts):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
data: Optional[Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]] = None,
|
||||||
data_key: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
data_key: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
cx: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
cx: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
cy: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
cy: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
@ -138,7 +138,7 @@ class Radar(Recharts):
|
|||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
data_key: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
data_key: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
points: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
points: Optional[Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]] = None,
|
||||||
dot: Optional[Union[Var[bool], bool]] = None,
|
dot: Optional[Union[Var[bool], bool]] = None,
|
||||||
stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None,
|
stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None,
|
||||||
fill: Optional[Union[Var[str], str]] = None,
|
fill: Optional[Union[Var[str], str]] = None,
|
||||||
@ -231,7 +231,7 @@ class RadialBar(Recharts):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
data: Optional[Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]] = None,
|
||||||
data_key: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
data_key: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||||
min_angle: Optional[Union[Var[int], int]] = None,
|
min_angle: Optional[Union[Var[int], int]] = None,
|
||||||
legend_type: Optional[
|
legend_type: Optional[
|
||||||
@ -346,7 +346,7 @@ class PolarAngleAxis(Recharts):
|
|||||||
tick: Optional[
|
tick: Optional[
|
||||||
Union[Dict[str, Any], Var[Union[Dict[str, Any], bool]], bool]
|
Union[Dict[str, Any], Var[Union[Dict[str, Any], bool]], bool]
|
||||||
] = None,
|
] = None,
|
||||||
ticks: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
ticks: Optional[Union[Var[list[Dict[str, Any]]], list[Dict[str, Any]]]] = None,
|
||||||
orientation: Optional[Union[Var[str], str]] = None,
|
orientation: Optional[Union[Var[str], str]] = None,
|
||||||
stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None,
|
stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None,
|
||||||
allow_duplicated_category: Optional[Union[Var[bool], bool]] = None,
|
allow_duplicated_category: Optional[Union[Var[bool], bool]] = None,
|
||||||
@ -420,8 +420,8 @@ class PolarGrid(Recharts):
|
|||||||
cy: Optional[Union[Var[int], int]] = None,
|
cy: Optional[Union[Var[int], int]] = None,
|
||||||
inner_radius: Optional[Union[Var[int], int]] = None,
|
inner_radius: Optional[Union[Var[int], int]] = None,
|
||||||
outer_radius: Optional[Union[Var[int], int]] = None,
|
outer_radius: Optional[Union[Var[int], int]] = None,
|
||||||
polar_angles: Optional[Union[List[int], Var[List[int]]]] = None,
|
polar_angles: Optional[Union[Var[list[int]], list[int]]] = None,
|
||||||
polar_radius: Optional[Union[List[int], Var[List[int]]]] = None,
|
polar_radius: Optional[Union[Var[list[int]], list[int]]] = None,
|
||||||
grid_type: Optional[
|
grid_type: Optional[
|
||||||
Union[Literal["circle", "polygon"], Var[Literal["circle", "polygon"]]]
|
Union[Literal["circle", "polygon"], Var[Literal["circle", "polygon"]]]
|
||||||
] = None,
|
] = None,
|
||||||
@ -543,7 +543,7 @@ class PolarRadiusAxis(Recharts):
|
|||||||
]
|
]
|
||||||
] = None,
|
] = None,
|
||||||
domain: Optional[
|
domain: Optional[
|
||||||
Union[List[Union[int, str]], Var[List[Union[int, str]]]]
|
Union[Var[list[Union[int, str]]], list[Union[int, str]]]
|
||||||
] = None,
|
] = None,
|
||||||
stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None,
|
stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None,
|
||||||
style: Optional[Style] = None,
|
style: Optional[Style] = None,
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import enum
|
import enum
|
||||||
from typing import Any, Dict, List, Literal, Optional, Tuple, Union
|
from typing import Any, Dict, Literal, Optional, Tuple, Union
|
||||||
|
|
||||||
from reflex.base import Base
|
from reflex.base import Base
|
||||||
from reflex.components.component import Component, NoSSRComponent
|
from reflex.components.component import Component, NoSSRComponent
|
||||||
@ -65,7 +65,7 @@ class EditorOptions(Base):
|
|||||||
rtl: Optional[bool] = None
|
rtl: Optional[bool] = None
|
||||||
|
|
||||||
# List of buttons to use in the toolbar.
|
# List of buttons to use in the toolbar.
|
||||||
button_list: Optional[List[Union[List[str], str]]]
|
button_list: Optional[list[Union[list[str], str]]]
|
||||||
|
|
||||||
|
|
||||||
def on_blur_spec(e: Var, content: Var[str]) -> Tuple[Var[str]]:
|
def on_blur_spec(e: Var, content: Var[str]) -> Tuple[Var[str]]:
|
||||||
@ -109,7 +109,7 @@ class Editor(NoSSRComponent):
|
|||||||
|
|
||||||
is_default = True
|
is_default = True
|
||||||
|
|
||||||
lib_dependencies: List[str] = ["suneditor"]
|
lib_dependencies: list[str] = ["suneditor"]
|
||||||
|
|
||||||
# Language of the editor.
|
# Language of the editor.
|
||||||
# Alternatively to a string, a dict of your language can be passed to this prop.
|
# Alternatively to a string, a dict of your language can be passed to this prop.
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
import enum
|
import enum
|
||||||
from typing import Any, Dict, List, Literal, Optional, Tuple, Union, overload
|
from typing import Any, Dict, Literal, Optional, Tuple, Union, overload
|
||||||
|
|
||||||
from reflex.base import Base
|
from reflex.base import Base
|
||||||
from reflex.components.component import NoSSRComponent
|
from reflex.components.component import NoSSRComponent
|
||||||
@ -42,7 +42,7 @@ class EditorOptions(Base):
|
|||||||
default_tag: Optional[str]
|
default_tag: Optional[str]
|
||||||
mode: Optional[str]
|
mode: Optional[str]
|
||||||
rtl: Optional[bool]
|
rtl: Optional[bool]
|
||||||
button_list: Optional[List[Union[List[str], str]]]
|
button_list: Optional[list[Union[list[str], str]]]
|
||||||
|
|
||||||
def on_blur_spec(e: Var, content: Var[str]) -> Tuple[Var[str]]: ...
|
def on_blur_spec(e: Var, content: Var[str]) -> Tuple[Var[str]]: ...
|
||||||
def on_paste_spec(
|
def on_paste_spec(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Tag to conditionally match cases."""
|
"""Tag to conditionally match cases."""
|
||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
from typing import Any, List
|
from typing import Any
|
||||||
|
|
||||||
from reflex.components.tags.tag import Tag
|
from reflex.components.tags.tag import Tag
|
||||||
from reflex.vars.base import Var
|
from reflex.vars.base import Var
|
||||||
@ -15,7 +15,7 @@ class MatchTag(Tag):
|
|||||||
cond: Var[Any] = dataclasses.field(default_factory=lambda: Var.create(True))
|
cond: Var[Any] = dataclasses.field(default_factory=lambda: Var.create(True))
|
||||||
|
|
||||||
# The list of match cases to be matched.
|
# The list of match cases to be matched.
|
||||||
match_cases: List[Any] = dataclasses.field(default_factory=list)
|
match_cases: list[Any] = dataclasses.field(default_factory=list)
|
||||||
|
|
||||||
# The catchall case to match.
|
# The catchall case to match.
|
||||||
default: Any = dataclasses.field(default=Var.create(None))
|
default: Any = dataclasses.field(default=Var.create(None))
|
||||||
|
@ -44,10 +44,10 @@ class Tag:
|
|||||||
contents: str = ""
|
contents: str = ""
|
||||||
|
|
||||||
# Special props that aren't key value pairs.
|
# Special props that aren't key value pairs.
|
||||||
special_props: List[Var] = dataclasses.field(default_factory=list)
|
special_props: list[Var] = dataclasses.field(default_factory=list)
|
||||||
|
|
||||||
# The children components.
|
# The children components.
|
||||||
children: List[Any] = dataclasses.field(default_factory=list)
|
children: list[Any] = dataclasses.field(default_factory=list)
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
"""Post initialize the tag."""
|
"""Post initialize the tag."""
|
||||||
|
@ -24,7 +24,6 @@ from typing import (
|
|||||||
Callable,
|
Callable,
|
||||||
Dict,
|
Dict,
|
||||||
Generic,
|
Generic,
|
||||||
List,
|
|
||||||
Optional,
|
Optional,
|
||||||
Set,
|
Set,
|
||||||
TypeVar,
|
TypeVar,
|
||||||
@ -703,10 +702,10 @@ class EnvironmentVariables:
|
|||||||
REFLEX_USE_TURBOPACK: EnvVar[bool] = env_var(True)
|
REFLEX_USE_TURBOPACK: EnvVar[bool] = env_var(True)
|
||||||
|
|
||||||
# Additional paths to include in the hot reload. Separated by a colon.
|
# Additional paths to include in the hot reload. Separated by a colon.
|
||||||
REFLEX_HOT_RELOAD_INCLUDE_PATHS: EnvVar[List[Path]] = env_var([])
|
REFLEX_HOT_RELOAD_INCLUDE_PATHS: EnvVar[list[Path]] = env_var([])
|
||||||
|
|
||||||
# Paths to exclude from the hot reload. Takes precedence over include paths. Separated by a colon.
|
# Paths to exclude from the hot reload. Takes precedence over include paths. Separated by a colon.
|
||||||
REFLEX_HOT_RELOAD_EXCLUDE_PATHS: EnvVar[List[Path]] = env_var([])
|
REFLEX_HOT_RELOAD_EXCLUDE_PATHS: EnvVar[list[Path]] = env_var([])
|
||||||
|
|
||||||
|
|
||||||
environment = EnvironmentVariables()
|
environment = EnvironmentVariables()
|
||||||
@ -791,7 +790,7 @@ class Config(Base):
|
|||||||
static_page_generation_timeout: int = 60
|
static_page_generation_timeout: int = 60
|
||||||
|
|
||||||
# List of origins that are allowed to connect to the backend API.
|
# List of origins that are allowed to connect to the backend API.
|
||||||
cors_allowed_origins: List[str] = ["*"]
|
cors_allowed_origins: list[str] = ["*"]
|
||||||
|
|
||||||
# Tailwind config.
|
# Tailwind config.
|
||||||
tailwind: Optional[Dict[str, Any]] = {"plugins": ["@tailwindcss/typography"]}
|
tailwind: Optional[Dict[str, Any]] = {"plugins": ["@tailwindcss/typography"]}
|
||||||
@ -806,7 +805,7 @@ class Config(Base):
|
|||||||
react_strict_mode: bool = True
|
react_strict_mode: bool = True
|
||||||
|
|
||||||
# Additional frontend packages to install.
|
# Additional frontend packages to install.
|
||||||
frontend_packages: List[str] = []
|
frontend_packages: list[str] = []
|
||||||
|
|
||||||
# The hosting service backend URL.
|
# The hosting service backend URL.
|
||||||
cp_backend_url: str = Hosting.HOSTING_SERVICE
|
cp_backend_url: str = Hosting.HOSTING_SERVICE
|
||||||
|
@ -451,7 +451,7 @@ class EventChain(EventActionsMixin):
|
|||||||
|
|
||||||
# If the input is a list of event handlers, create an event chain.
|
# If the input is a list of event handlers, create an event chain.
|
||||||
if isinstance(value, List):
|
if isinstance(value, List):
|
||||||
events: List[Union[EventSpec, EventVar]] = []
|
events: list[Union[EventSpec, EventVar]] = []
|
||||||
for v in value:
|
for v in value:
|
||||||
if isinstance(v, (EventHandler, EventSpec)):
|
if isinstance(v, (EventHandler, EventSpec)):
|
||||||
# Call the event handler to get the event.
|
# Call the event handler to get the event.
|
||||||
@ -1885,7 +1885,7 @@ LAMBDA_OR_STATE = TypeAliasType(
|
|||||||
type_params=(ARGS,),
|
type_params=(ARGS,),
|
||||||
)
|
)
|
||||||
|
|
||||||
ItemOrList = V | List[V]
|
ItemOrList = V | list[V]
|
||||||
|
|
||||||
BASIC_EVENT_TYPES = TypeAliasType(
|
BASIC_EVENT_TYPES = TypeAliasType(
|
||||||
"BASIC_EVENT_TYPES", EventSpec | EventHandler | Var[Any], type_params=()
|
"BASIC_EVENT_TYPES", EventSpec | EventHandler | Var[Any], type_params=()
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, List
|
from typing import Any
|
||||||
|
|
||||||
from reflex import color, cond
|
from reflex import color, cond
|
||||||
from reflex.components.base.fragment import Fragment
|
from reflex.components.base.fragment import Fragment
|
||||||
@ -64,7 +64,7 @@ class Sidebar(Box, MemoizationLeaf):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def add_hooks(self) -> List[Var]:
|
def add_hooks(self) -> list[Var]:
|
||||||
"""Get the hooks to render.
|
"""Get the hooks to render.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# ------------------- DO NOT EDIT ----------------------
|
# ------------------- DO NOT EDIT ----------------------
|
||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from typing import Any, Dict, List, Literal, Optional, Union, overload
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
||||||
|
|
||||||
from reflex import color
|
from reflex import color
|
||||||
from reflex.components.base.fragment import Fragment
|
from reflex.components.base.fragment import Fragment
|
||||||
@ -261,7 +261,7 @@ class Sidebar(Box, MemoizationLeaf):
|
|||||||
...
|
...
|
||||||
|
|
||||||
def add_style(self) -> dict[str, Any] | None: ...
|
def add_style(self) -> dict[str, Any] | None: ...
|
||||||
def add_hooks(self) -> List[Var]: ...
|
def add_hooks(self) -> list[Var]: ...
|
||||||
|
|
||||||
class StatefulSidebar(ComponentState):
|
class StatefulSidebar(ComponentState):
|
||||||
open: bool
|
open: bool
|
||||||
@ -287,7 +287,7 @@ class DrawerSidebar(DrawerRoot):
|
|||||||
] = None,
|
] = None,
|
||||||
dismissible: Optional[Union[Var[bool], bool]] = None,
|
dismissible: Optional[Union[Var[bool], bool]] = None,
|
||||||
handle_only: Optional[Union[Var[bool], bool]] = None,
|
handle_only: Optional[Union[Var[bool], bool]] = None,
|
||||||
snap_points: Optional[List[Union[float, str]]] = None,
|
snap_points: Optional[list[Union[float, str]]] = None,
|
||||||
fade_from_index: Optional[Union[Var[int], int]] = None,
|
fade_from_index: Optional[Union[Var[int], int]] = None,
|
||||||
scroll_lock_timeout: Optional[Union[Var[int], int]] = None,
|
scroll_lock_timeout: Optional[Union[Var[int], int]] = None,
|
||||||
prevent_scroll_restoration: Optional[Union[Var[bool], bool]] = None,
|
prevent_scroll_restoration: Optional[Union[Var[bool], bool]] = None,
|
||||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import atexit
|
import atexit
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Optional
|
from typing import Optional
|
||||||
|
|
||||||
import typer
|
import typer
|
||||||
import typer.core
|
import typer.core
|
||||||
@ -493,13 +493,13 @@ def deploy(
|
|||||||
"--app-id",
|
"--app-id",
|
||||||
help="The ID of the App to deploy over.",
|
help="The ID of the App to deploy over.",
|
||||||
),
|
),
|
||||||
regions: List[str] = typer.Option(
|
regions: list[str] = typer.Option(
|
||||||
[],
|
[],
|
||||||
"-r",
|
"-r",
|
||||||
"--region",
|
"--region",
|
||||||
help="The regions to deploy to. `reflex cloud regions` For multiple envs, repeat this option, e.g. --region sjc --region iad",
|
help="The regions to deploy to. `reflex cloud regions` For multiple envs, repeat this option, e.g. --region sjc --region iad",
|
||||||
),
|
),
|
||||||
envs: List[str] = typer.Option(
|
envs: list[str] = typer.Option(
|
||||||
[],
|
[],
|
||||||
"--env",
|
"--env",
|
||||||
help="The environment variables to set: <key>=<value>. For multiple envs, repeat this option, e.g. --env k1=v2 --env k2=v2.",
|
help="The environment variables to set: <key>=<value>. For multiple envs, repeat this option, e.g. --env k1=v2 --env k2=v2.",
|
||||||
|
@ -26,7 +26,6 @@ from typing import (
|
|||||||
Callable,
|
Callable,
|
||||||
ClassVar,
|
ClassVar,
|
||||||
Dict,
|
Dict,
|
||||||
List,
|
|
||||||
Optional,
|
Optional,
|
||||||
Sequence,
|
Sequence,
|
||||||
Set,
|
Set,
|
||||||
@ -707,7 +706,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|||||||
return getattr(cls, unique_var_name)
|
return getattr(cls, unique_var_name)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _mixins(cls) -> List[Type]:
|
def _mixins(cls) -> list[Type]:
|
||||||
"""Get the mixin classes of the state.
|
"""Get the mixin classes of the state.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -1194,7 +1193,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|||||||
return inner_func
|
return inner_func
|
||||||
|
|
||||||
def arglist_factory(param: str):
|
def arglist_factory(param: str):
|
||||||
def inner_func(self: BaseState) -> List[str]:
|
def inner_func(self: BaseState) -> list[str]:
|
||||||
return self.router.page.params.get(param, [])
|
return self.router.page.params.get(param, [])
|
||||||
|
|
||||||
return inner_func
|
return inner_func
|
||||||
@ -1697,7 +1696,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|||||||
return StateUpdate()
|
return StateUpdate()
|
||||||
|
|
||||||
event_specs_correct_type = cast(
|
event_specs_correct_type = cast(
|
||||||
Union[List[Union[EventSpec, EventHandler]], None],
|
Union[list[Union[EventSpec, EventHandler]], None],
|
||||||
[event_specs] if isinstance(event_specs, EventSpec) else event_specs,
|
[event_specs] if isinstance(event_specs, EventSpec) else event_specs,
|
||||||
)
|
)
|
||||||
fixed_events = fix_events(
|
fixed_events = fix_events(
|
||||||
@ -2755,7 +2754,7 @@ class StateUpdate:
|
|||||||
delta: Delta = dataclasses.field(default_factory=dict)
|
delta: Delta = dataclasses.field(default_factory=dict)
|
||||||
|
|
||||||
# Events to be added to the event queue.
|
# Events to be added to the event queue.
|
||||||
events: List[Event] = dataclasses.field(default_factory=list)
|
events: list[Event] = dataclasses.field(default_factory=list)
|
||||||
|
|
||||||
# Whether this is the final state update for the event.
|
# Whether this is the final state update for the event.
|
||||||
final: bool = True
|
final: bool = True
|
||||||
|
@ -26,7 +26,6 @@ from typing import (
|
|||||||
AsyncIterator,
|
AsyncIterator,
|
||||||
Callable,
|
Callable,
|
||||||
Coroutine,
|
Coroutine,
|
||||||
List,
|
|
||||||
Optional,
|
Optional,
|
||||||
Type,
|
Type,
|
||||||
TypeVar,
|
TypeVar,
|
||||||
@ -198,7 +197,7 @@ class AppHarness:
|
|||||||
f"{self.app_name}___{self.app_name}___" + state_cls_name
|
f"{self.app_name}___{self.app_name}___" + state_cls_name
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_full_state_name(self, path: List[str]) -> str:
|
def get_full_state_name(self, path: list[str]) -> str:
|
||||||
"""Get the full state name for the given state class name.
|
"""Get the full state name for the given state class name.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -596,7 +595,7 @@ class AppHarness:
|
|||||||
driver_clz: Optional[Type["WebDriver"]] = None,
|
driver_clz: Optional[Type["WebDriver"]] = None,
|
||||||
driver_kwargs: dict[str, Any] | None = None,
|
driver_kwargs: dict[str, Any] | None = None,
|
||||||
driver_options: ArgOptions | None = None,
|
driver_options: ArgOptions | None = None,
|
||||||
driver_option_args: List[str] | None = None,
|
driver_option_args: list[str] | None = None,
|
||||||
driver_option_capabilities: dict[str, Any] | None = None,
|
driver_option_capabilities: dict[str, Any] | None = None,
|
||||||
) -> "WebDriver":
|
) -> "WebDriver":
|
||||||
"""Get a selenium webdriver instance pointed at the app.
|
"""Get a selenium webdriver instance pointed at the app.
|
||||||
|
@ -6,7 +6,7 @@ import inspect
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from typing import TYPE_CHECKING, Any, List, Optional, Union
|
from typing import TYPE_CHECKING, Any, Optional, Union
|
||||||
|
|
||||||
from reflex import constants
|
from reflex import constants
|
||||||
from reflex.constants.state import FRONTEND_EVENT_STATE
|
from reflex.constants.state import FRONTEND_EVENT_STATE
|
||||||
@ -337,7 +337,7 @@ def format_route(route: str, format_case: bool = True) -> str:
|
|||||||
|
|
||||||
def format_match(
|
def format_match(
|
||||||
cond: str | Var,
|
cond: str | Var,
|
||||||
match_cases: List[List[Var]],
|
match_cases: list[list[Var]],
|
||||||
default: Var,
|
default: Var,
|
||||||
) -> str:
|
) -> str:
|
||||||
"""Format a match expression whose return type is a Var.
|
"""Format a match expression whose return type is a Var.
|
||||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from typing import DefaultDict, Dict, List, Optional, Tuple, Union
|
from typing import DefaultDict, Dict, Optional, Tuple, Union
|
||||||
|
|
||||||
|
|
||||||
def merge_imports(
|
def merge_imports(
|
||||||
@ -18,7 +18,7 @@ def merge_imports(
|
|||||||
Returns:
|
Returns:
|
||||||
The merged import dicts.
|
The merged import dicts.
|
||||||
"""
|
"""
|
||||||
all_imports: DefaultDict[str, List[ImportVar]] = defaultdict(list)
|
all_imports: DefaultDict[str, list[ImportVar]] = defaultdict(list)
|
||||||
for import_dict in imports:
|
for import_dict in imports:
|
||||||
for lib, fields in (
|
for lib, fields in (
|
||||||
import_dict if isinstance(import_dict, tuple) else import_dict.items()
|
import_dict if isinstance(import_dict, tuple) else import_dict.items()
|
||||||
@ -131,7 +131,7 @@ class ImportVar:
|
|||||||
return self.tag or ""
|
return self.tag or ""
|
||||||
|
|
||||||
|
|
||||||
ImportTypes = Union[str, ImportVar, List[Union[str, ImportVar]], List[ImportVar]]
|
ImportTypes = Union[str, ImportVar, list[Union[str, ImportVar]], list[ImportVar]]
|
||||||
ImportDict = Dict[str, ImportTypes]
|
ImportDict = Dict[str, ImportTypes]
|
||||||
ParsedImportDict = Dict[str, List[ImportVar]]
|
ParsedImportDict = Dict[str, list[ImportVar]]
|
||||||
ImmutableParsedImportDict = Tuple[Tuple[str, Tuple[ImportVar, ...]], ...]
|
ImmutableParsedImportDict = Tuple[Tuple[str, Tuple[ImportVar, ...]], ...]
|
||||||
|
@ -23,7 +23,7 @@ import zipfile
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
from typing import Any, Callable, List, NamedTuple, Optional
|
from typing import Any, Callable, NamedTuple, Optional
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
@ -886,7 +886,7 @@ def init_reflex_json(project_hash: int | None):
|
|||||||
|
|
||||||
|
|
||||||
def update_next_config(
|
def update_next_config(
|
||||||
export: bool = False, transpile_packages: Optional[List[str]] = None
|
export: bool = False, transpile_packages: Optional[list[str]] = None
|
||||||
):
|
):
|
||||||
"""Update Next.js config from Reflex config.
|
"""Update Next.js config from Reflex config.
|
||||||
|
|
||||||
@ -908,7 +908,7 @@ def update_next_config(
|
|||||||
|
|
||||||
|
|
||||||
def _update_next_config(
|
def _update_next_config(
|
||||||
config: Config, export: bool = False, transpile_packages: Optional[List[str]] = None
|
config: Config, export: bool = False, transpile_packages: Optional[list[str]] = None
|
||||||
):
|
):
|
||||||
next_config = {
|
next_config = {
|
||||||
"basePath": config.frontend_path or "",
|
"basePath": config.frontend_path or "",
|
||||||
|
@ -10,7 +10,7 @@ import signal
|
|||||||
import subprocess
|
import subprocess
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Callable, Generator, List, Optional, Tuple, Union
|
from typing import Callable, Generator, Optional, Tuple, Union
|
||||||
|
|
||||||
import psutil
|
import psutil
|
||||||
import typer
|
import typer
|
||||||
@ -335,7 +335,7 @@ def show_status(
|
|||||||
status.update(f"{message} {line}")
|
status.update(f"{message} {line}")
|
||||||
|
|
||||||
|
|
||||||
def show_progress(message: str, process: subprocess.Popen, checkpoints: List[str]):
|
def show_progress(message: str, process: subprocess.Popen, checkpoints: list[str]):
|
||||||
"""Show a progress bar for a process.
|
"""Show a progress bar for a process.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -431,7 +431,7 @@ def type_to_ast(typ: Any, cls: type) -> ast.AST:
|
|||||||
# Convert all type arguments recursively
|
# Convert all type arguments recursively
|
||||||
arg_nodes = [type_to_ast(arg, cls) for arg in args]
|
arg_nodes = [type_to_ast(arg, cls) for arg in args]
|
||||||
|
|
||||||
# Special case for single-argument types (like List[T] or Optional[T])
|
# Special case for single-argument types (like list[T] or Optional[T])
|
||||||
if len(arg_nodes) == 1:
|
if len(arg_nodes) == 1:
|
||||||
slice_value = arg_nodes[0]
|
slice_value = arg_nodes[0]
|
||||||
else:
|
else:
|
||||||
|
@ -13,7 +13,6 @@ from pathlib import Path
|
|||||||
from typing import (
|
from typing import (
|
||||||
Any,
|
Any,
|
||||||
Callable,
|
Callable,
|
||||||
List,
|
|
||||||
Literal,
|
Literal,
|
||||||
Optional,
|
Optional,
|
||||||
Set,
|
Set,
|
||||||
@ -370,7 +369,7 @@ def serialize_color(color: Color) -> str:
|
|||||||
with contextlib.suppress(ImportError):
|
with contextlib.suppress(ImportError):
|
||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
|
|
||||||
def format_dataframe_values(df: DataFrame) -> List[List[Any]]:
|
def format_dataframe_values(df: DataFrame) -> list[list[Any]]:
|
||||||
"""Format dataframe values to a list of lists.
|
"""Format dataframe values to a list of lists.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -76,7 +76,7 @@ if TYPE_CHECKING:
|
|||||||
| Callable[[Var, Var, Var, Var, Var, Var, Var], Sequence[Var]]
|
| Callable[[Var, Var, Var, Var, Var, Var, Var], Sequence[Var]]
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
ArgsSpec = Callable[..., List[Any]]
|
ArgsSpec = Callable[..., list[Any]]
|
||||||
|
|
||||||
|
|
||||||
PrimitiveToAnnotation = {
|
PrimitiveToAnnotation = {
|
||||||
@ -333,10 +333,10 @@ def get_attribute_access_type(cls: GenericType, name: str) -> GenericType | None
|
|||||||
if isinstance(prop, Relationship):
|
if isinstance(prop, Relationship):
|
||||||
type_ = prop.mapper.class_
|
type_ = prop.mapper.class_
|
||||||
# TODO: check for nullable?
|
# TODO: check for nullable?
|
||||||
type_ = List[type_] if prop.uselist else Optional[type_]
|
type_ = list[type_] if prop.uselist else Optional[type_]
|
||||||
return type_
|
return type_
|
||||||
if isinstance(attr, AssociationProxyInstance):
|
if isinstance(attr, AssociationProxyInstance):
|
||||||
return List[
|
return list[
|
||||||
get_attribute_access_type(
|
get_attribute_access_type(
|
||||||
attr.target_class,
|
attr.target_class,
|
||||||
attr.remote_attr.key, # type: ignore[attr-defined]
|
attr.remote_attr.key, # type: ignore[attr-defined]
|
||||||
@ -870,7 +870,7 @@ def typehint_issubclass(possible_subclass: Any, possible_superclass: Any) -> boo
|
|||||||
for provided_arg in provided_args
|
for provided_arg in provided_args
|
||||||
)
|
)
|
||||||
|
|
||||||
# Check if the origin of both types is the same (e.g., list for List[int])
|
# Check if the origin of both types is the same (e.g., list for list[int])
|
||||||
# This probably should be issubclass instead of ==
|
# This probably should be issubclass instead of ==
|
||||||
if (provided_type_origin or possible_subclass) != (
|
if (provided_type_origin or possible_subclass) != (
|
||||||
accepted_type_origin or possible_superclass
|
accepted_type_origin or possible_superclass
|
||||||
|
@ -103,8 +103,8 @@ class VarSubclassEntry:
|
|||||||
python_types: Tuple[GenericType, ...]
|
python_types: Tuple[GenericType, ...]
|
||||||
|
|
||||||
|
|
||||||
_var_subclasses: List[VarSubclassEntry] = []
|
_var_subclasses: list[VarSubclassEntry] = []
|
||||||
_var_literal_subclasses: List[Tuple[Type[LiteralVar], VarSubclassEntry]] = []
|
_var_literal_subclasses: list[Tuple[Type[LiteralVar], VarSubclassEntry]] = []
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(
|
@dataclasses.dataclass(
|
||||||
@ -1200,7 +1200,7 @@ class Var(Generic[VAR_TYPE]):
|
|||||||
|
|
||||||
@overload
|
@overload
|
||||||
@classmethod
|
@classmethod
|
||||||
def range(cls, stop: int | NumberVar, /) -> ArrayVar[List[int]]: ...
|
def range(cls, stop: int | NumberVar, /) -> ArrayVar[list[int]]: ...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -1210,7 +1210,7 @@ class Var(Generic[VAR_TYPE]):
|
|||||||
end: int | NumberVar,
|
end: int | NumberVar,
|
||||||
step: int | NumberVar = 1,
|
step: int | NumberVar = 1,
|
||||||
/,
|
/,
|
||||||
) -> ArrayVar[List[int]]: ...
|
) -> ArrayVar[list[int]]: ...
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def range(
|
def range(
|
||||||
@ -1218,7 +1218,7 @@ class Var(Generic[VAR_TYPE]):
|
|||||||
first_endpoint: int | NumberVar,
|
first_endpoint: int | NumberVar,
|
||||||
second_endpoint: int | NumberVar | None = None,
|
second_endpoint: int | NumberVar | None = None,
|
||||||
step: int | NumberVar | None = None,
|
step: int | NumberVar | None = None,
|
||||||
) -> ArrayVar[List[int]]:
|
) -> ArrayVar[list[int]]:
|
||||||
"""Create a range of numbers.
|
"""Create a range of numbers.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -1676,7 +1676,7 @@ def figure_out_type(value: Any) -> types.GenericType:
|
|||||||
if has_args(type_):
|
if has_args(type_):
|
||||||
return type_
|
return type_
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
return List[unionize(*(figure_out_type(v) for v in value))]
|
return list[unionize(*(figure_out_type(v) for v in value))]
|
||||||
if isinstance(value, set):
|
if isinstance(value, set):
|
||||||
return Set[unionize(*(figure_out_type(v) for v in value))]
|
return Set[unionize(*(figure_out_type(v) for v in value))]
|
||||||
if isinstance(value, tuple):
|
if isinstance(value, tuple):
|
||||||
@ -1967,7 +1967,7 @@ class ComputedVar(Var[RETURN_TYPE]):
|
|||||||
fget: Callable[[BASE_STATE], RETURN_TYPE],
|
fget: Callable[[BASE_STATE], RETURN_TYPE],
|
||||||
initial_value: RETURN_TYPE | types.Unset = types.Unset(),
|
initial_value: RETURN_TYPE | types.Unset = types.Unset(),
|
||||||
cache: bool = True,
|
cache: bool = True,
|
||||||
deps: Optional[List[Union[str, Var]]] = None,
|
deps: Optional[list[Union[str, Var]]] = None,
|
||||||
auto_deps: bool = True,
|
auto_deps: bool = True,
|
||||||
interval: Optional[Union[int, datetime.timedelta]] = None,
|
interval: Optional[Union[int, datetime.timedelta]] = None,
|
||||||
backend: bool | None = None,
|
backend: bool | None = None,
|
||||||
@ -2031,7 +2031,7 @@ class ComputedVar(Var[RETURN_TYPE]):
|
|||||||
|
|
||||||
def _calculate_static_deps(
|
def _calculate_static_deps(
|
||||||
self,
|
self,
|
||||||
deps: Union[List[Union[str, Var]], dict[str | None, set[str]]] | None = None,
|
deps: Union[list[Union[str, Var]], dict[str | None, set[str]]] | None = None,
|
||||||
) -> dict[str | None, set[str]]:
|
) -> dict[str | None, set[str]]:
|
||||||
"""Calculate the static dependencies of the computed var from user input or existing dependencies.
|
"""Calculate the static dependencies of the computed var from user input or existing dependencies.
|
||||||
|
|
||||||
@ -2406,7 +2406,7 @@ class ComputedVar(Var[RETURN_TYPE]):
|
|||||||
return self._fget
|
return self._fget
|
||||||
|
|
||||||
|
|
||||||
class DynamicRouteVar(ComputedVar[Union[str, List[str]]]):
|
class DynamicRouteVar(ComputedVar[Union[str, list[str]]]):
|
||||||
"""A ComputedVar that represents a dynamic route."""
|
"""A ComputedVar that represents a dynamic route."""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
@ -2562,7 +2562,7 @@ def computed_var(
|
|||||||
fget: None = None,
|
fget: None = None,
|
||||||
initial_value: Any | types.Unset = types.Unset(),
|
initial_value: Any | types.Unset = types.Unset(),
|
||||||
cache: bool = True,
|
cache: bool = True,
|
||||||
deps: Optional[List[Union[str, Var]]] = None,
|
deps: Optional[list[Union[str, Var]]] = None,
|
||||||
auto_deps: bool = True,
|
auto_deps: bool = True,
|
||||||
interval: Optional[Union[datetime.timedelta, int]] = None,
|
interval: Optional[Union[datetime.timedelta, int]] = None,
|
||||||
backend: bool | None = None,
|
backend: bool | None = None,
|
||||||
@ -2575,7 +2575,7 @@ def computed_var(
|
|||||||
fget: Callable[[BASE_STATE], RETURN_TYPE],
|
fget: Callable[[BASE_STATE], RETURN_TYPE],
|
||||||
initial_value: RETURN_TYPE | types.Unset = types.Unset(),
|
initial_value: RETURN_TYPE | types.Unset = types.Unset(),
|
||||||
cache: bool = True,
|
cache: bool = True,
|
||||||
deps: Optional[List[Union[str, Var]]] = None,
|
deps: Optional[list[Union[str, Var]]] = None,
|
||||||
auto_deps: bool = True,
|
auto_deps: bool = True,
|
||||||
interval: Optional[Union[datetime.timedelta, int]] = None,
|
interval: Optional[Union[datetime.timedelta, int]] = None,
|
||||||
backend: bool | None = None,
|
backend: bool | None = None,
|
||||||
@ -2587,7 +2587,7 @@ def computed_var(
|
|||||||
fget: Callable[[BASE_STATE], Any] | None = None,
|
fget: Callable[[BASE_STATE], Any] | None = None,
|
||||||
initial_value: Any | types.Unset = types.Unset(),
|
initial_value: Any | types.Unset = types.Unset(),
|
||||||
cache: bool = True,
|
cache: bool = True,
|
||||||
deps: Optional[List[Union[str, Var]]] = None,
|
deps: Optional[list[Union[str, Var]]] = None,
|
||||||
auto_deps: bool = True,
|
auto_deps: bool = True,
|
||||||
interval: Optional[Union[datetime.timedelta, int]] = None,
|
interval: Optional[Union[datetime.timedelta, int]] = None,
|
||||||
backend: bool | None = None,
|
backend: bool | None = None,
|
||||||
@ -3269,10 +3269,10 @@ class Field(Generic[FIELD_TYPE]):
|
|||||||
|
|
||||||
@overload
|
@overload
|
||||||
def __get__(
|
def __get__(
|
||||||
self: Field[List[V]] | Field[Set[V]] | Field[Tuple[V, ...]],
|
self: Field[list[V]] | Field[Set[V]] | Field[Tuple[V, ...]],
|
||||||
instance: None,
|
instance: None,
|
||||||
owner: Any,
|
owner: Any,
|
||||||
) -> ArrayVar[List[V]]: ...
|
) -> ArrayVar[list[V]]: ...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def __get__(
|
def __get__(
|
||||||
|
@ -7,7 +7,6 @@ import typing
|
|||||||
from inspect import isclass
|
from inspect import isclass
|
||||||
from typing import (
|
from typing import (
|
||||||
Any,
|
Any,
|
||||||
List,
|
|
||||||
Mapping,
|
Mapping,
|
||||||
NoReturn,
|
NoReturn,
|
||||||
Tuple,
|
Tuple,
|
||||||
@ -83,7 +82,7 @@ class ObjectVar(Var[OBJECT_TYPE], python_types=Mapping):
|
|||||||
args = get_args(self._var_type) if issubclass(fixed_type, Mapping) else ()
|
args = get_args(self._var_type) if issubclass(fixed_type, Mapping) else ()
|
||||||
return args[1] if args else Any # pyright: ignore [reportReturnType]
|
return args[1] if args else Any # pyright: ignore [reportReturnType]
|
||||||
|
|
||||||
def keys(self) -> ArrayVar[List[str]]:
|
def keys(self) -> ArrayVar[list[str]]:
|
||||||
"""Get the keys of the object.
|
"""Get the keys of the object.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -94,7 +93,7 @@ class ObjectVar(Var[OBJECT_TYPE], python_types=Mapping):
|
|||||||
@overload
|
@overload
|
||||||
def values(
|
def values(
|
||||||
self: ObjectVar[Mapping[Any, VALUE_TYPE]],
|
self: ObjectVar[Mapping[Any, VALUE_TYPE]],
|
||||||
) -> ArrayVar[List[VALUE_TYPE]]: ...
|
) -> ArrayVar[list[VALUE_TYPE]]: ...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def values(self) -> ArrayVar: ...
|
def values(self) -> ArrayVar: ...
|
||||||
@ -110,7 +109,7 @@ class ObjectVar(Var[OBJECT_TYPE], python_types=Mapping):
|
|||||||
@overload
|
@overload
|
||||||
def entries(
|
def entries(
|
||||||
self: ObjectVar[Mapping[Any, VALUE_TYPE]],
|
self: ObjectVar[Mapping[Any, VALUE_TYPE]],
|
||||||
) -> ArrayVar[List[Tuple[str, VALUE_TYPE]]]: ...
|
) -> ArrayVar[list[Tuple[str, VALUE_TYPE]]]: ...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def entries(self) -> ArrayVar: ...
|
def entries(self) -> ArrayVar: ...
|
||||||
@ -427,7 +426,7 @@ def object_keys_operation(value: ObjectVar):
|
|||||||
"""
|
"""
|
||||||
return var_operation_return(
|
return var_operation_return(
|
||||||
js_expression=f"Object.keys({value})",
|
js_expression=f"Object.keys({value})",
|
||||||
var_type=List[str],
|
var_type=list[str],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -443,7 +442,7 @@ def object_values_operation(value: ObjectVar):
|
|||||||
"""
|
"""
|
||||||
return var_operation_return(
|
return var_operation_return(
|
||||||
js_expression=f"Object.values({value})",
|
js_expression=f"Object.values({value})",
|
||||||
var_type=List[value._value_type()],
|
var_type=list[value._value_type()],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -459,7 +458,7 @@ def object_entries_operation(value: ObjectVar):
|
|||||||
"""
|
"""
|
||||||
return var_operation_return(
|
return var_operation_return(
|
||||||
js_expression=f"Object.entries({value})",
|
js_expression=f"Object.entries({value})",
|
||||||
var_type=List[Tuple[str, value._value_type()]],
|
var_type=list[Tuple[str, value._value_type()]],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ from typing import (
|
|||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
Any,
|
Any,
|
||||||
Dict,
|
Dict,
|
||||||
List,
|
|
||||||
Literal,
|
Literal,
|
||||||
NoReturn,
|
NoReturn,
|
||||||
Sequence,
|
Sequence,
|
||||||
@ -253,12 +252,12 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|||||||
return string_contains_operation(self, other)
|
return string_contains_operation(self, other)
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def split(self, separator: StringVar | str = "") -> ArrayVar[List[str]]: ...
|
def split(self, separator: StringVar | str = "") -> ArrayVar[list[str]]: ...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def split(self, separator: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
def split(self, separator: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
||||||
|
|
||||||
def split(self, separator: Any = "") -> ArrayVar[List[str]]:
|
def split(self, separator: Any = "") -> ArrayVar[list[str]]:
|
||||||
"""Split the string.
|
"""Split the string.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -810,7 +809,7 @@ class ConcatVarOperation(CachedVarOperation, StringVar[str]):
|
|||||||
Returns:
|
Returns:
|
||||||
The name of the var.
|
The name of the var.
|
||||||
"""
|
"""
|
||||||
list_of_strs: List[Union[str, Var]] = []
|
list_of_strs: list[Union[str, Var]] = []
|
||||||
last_string = ""
|
last_string = ""
|
||||||
for var in self._var_value:
|
for var in self._var_value:
|
||||||
if isinstance(var, LiteralStringVar):
|
if isinstance(var, LiteralStringVar):
|
||||||
@ -1018,9 +1017,9 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
|
|||||||
|
|
||||||
@overload
|
@overload
|
||||||
def __getitem__(
|
def __getitem__(
|
||||||
self: ARRAY_VAR_OF_LIST_ELEMENT[List[INNER_ARRAY_VAR]],
|
self: ARRAY_VAR_OF_LIST_ELEMENT[list[INNER_ARRAY_VAR]],
|
||||||
i: int | NumberVar,
|
i: int | NumberVar,
|
||||||
) -> ArrayVar[List[INNER_ARRAY_VAR]]: ...
|
) -> ArrayVar[list[INNER_ARRAY_VAR]]: ...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def __getitem__(
|
def __getitem__(
|
||||||
@ -1088,7 +1087,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
|
|||||||
|
|
||||||
@overload
|
@overload
|
||||||
@classmethod
|
@classmethod
|
||||||
def range(cls, stop: int | NumberVar, /) -> ArrayVar[List[int]]: ...
|
def range(cls, stop: int | NumberVar, /) -> ArrayVar[list[int]]: ...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -1098,7 +1097,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
|
|||||||
end: int | NumberVar,
|
end: int | NumberVar,
|
||||||
step: int | NumberVar = 1,
|
step: int | NumberVar = 1,
|
||||||
/,
|
/,
|
||||||
) -> ArrayVar[List[int]]: ...
|
) -> ArrayVar[list[int]]: ...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -1107,7 +1106,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
|
|||||||
first_endpoint: int | NumberVar,
|
first_endpoint: int | NumberVar,
|
||||||
second_endpoint: int | NumberVar | None = None,
|
second_endpoint: int | NumberVar | None = None,
|
||||||
step: int | NumberVar | None = None,
|
step: int | NumberVar | None = None,
|
||||||
) -> ArrayVar[List[int]]: ...
|
) -> ArrayVar[list[int]]: ...
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def range(
|
def range(
|
||||||
@ -1115,7 +1114,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
|
|||||||
first_endpoint: int | NumberVar,
|
first_endpoint: int | NumberVar,
|
||||||
second_endpoint: int | NumberVar | None = None,
|
second_endpoint: int | NumberVar | None = None,
|
||||||
step: int | NumberVar | None = None,
|
step: int | NumberVar | None = None,
|
||||||
) -> ArrayVar[List[int]]:
|
) -> ArrayVar[list[int]]:
|
||||||
"""Create a range of numbers.
|
"""Create a range of numbers.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -1438,7 +1437,7 @@ def string_split_operation(string: StringVar[Any], sep: StringVar | str = ""):
|
|||||||
The split string.
|
The split string.
|
||||||
"""
|
"""
|
||||||
return var_operation_return(
|
return var_operation_return(
|
||||||
js_expression=f"{string}.split({sep})", var_type=List[str]
|
js_expression=f"{string}.split({sep})", var_type=list[str]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -1683,7 +1682,7 @@ def array_range_operation(
|
|||||||
"""
|
"""
|
||||||
return var_operation_return(
|
return var_operation_return(
|
||||||
js_expression=f"Array.from({{ length: Math.ceil(({stop!s} - {start!s}) / {step!s}) }}, (_, i) => {start!s} + i * {step!s})",
|
js_expression=f"Array.from({{ length: Math.ceil(({stop!s} - {start!s}) / {step!s}) }}, (_, i) => {start!s} + i * {step!s})",
|
||||||
var_type=List[int],
|
var_type=list[int],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -1749,7 +1748,7 @@ def repeat_array_operation(
|
|||||||
def map_array_operation(
|
def map_array_operation(
|
||||||
array: ArrayVar[ARRAY_VAR_TYPE],
|
array: ArrayVar[ARRAY_VAR_TYPE],
|
||||||
function: FunctionVar,
|
function: FunctionVar,
|
||||||
) -> CustomVarOperationReturn[List[Any]]:
|
) -> CustomVarOperationReturn[list[Any]]:
|
||||||
"""Map a function over an array.
|
"""Map a function over an array.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -1760,7 +1759,7 @@ def map_array_operation(
|
|||||||
The mapped array.
|
The mapped array.
|
||||||
"""
|
"""
|
||||||
return var_operation_return(
|
return var_operation_return(
|
||||||
js_expression=f"{array}.map({function})", var_type=List[Any]
|
js_expression=f"{array}.map({function})", var_type=list[Any]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,12 +16,10 @@ from .utils import poll_for_navigation
|
|||||||
|
|
||||||
def DynamicRoute():
|
def DynamicRoute():
|
||||||
"""App for testing dynamic routes."""
|
"""App for testing dynamic routes."""
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import reflex as rx
|
import reflex as rx
|
||||||
|
|
||||||
class DynamicState(rx.State):
|
class DynamicState(rx.State):
|
||||||
order: List[str] = []
|
order: list[str] = []
|
||||||
|
|
||||||
@rx.event
|
@rx.event
|
||||||
def on_load(self):
|
def on_load(self):
|
||||||
|
@ -14,12 +14,12 @@ from reflex.testing import AppHarness, WebDriver
|
|||||||
|
|
||||||
def TestEventAction():
|
def TestEventAction():
|
||||||
"""App for testing event_actions."""
|
"""App for testing event_actions."""
|
||||||
from typing import List, Optional
|
from typing import Optional
|
||||||
|
|
||||||
import reflex as rx
|
import reflex as rx
|
||||||
|
|
||||||
class EventActionState(rx.State):
|
class EventActionState(rx.State):
|
||||||
order: List[str]
|
order: list[str]
|
||||||
|
|
||||||
def on_click(self, ev):
|
def on_click(self, ev):
|
||||||
self.order.append(f"on_click:{ev}")
|
self.order.append(f"on_click:{ev}")
|
||||||
|
@ -16,7 +16,6 @@ def EventChain():
|
|||||||
"""App with chained event handlers."""
|
"""App with chained event handlers."""
|
||||||
import asyncio
|
import asyncio
|
||||||
import time
|
import time
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import reflex as rx
|
import reflex as rx
|
||||||
|
|
||||||
@ -24,7 +23,7 @@ def EventChain():
|
|||||||
MANY_EVENTS = 50
|
MANY_EVENTS = 50
|
||||||
|
|
||||||
class State(rx.State):
|
class State(rx.State):
|
||||||
event_order: List[str] = []
|
event_order: list[str] = []
|
||||||
interim_value: str = ""
|
interim_value: str = ""
|
||||||
|
|
||||||
@rx.event
|
@rx.event
|
||||||
|
@ -18,14 +18,14 @@ def FormSubmit(form_component):
|
|||||||
Args:
|
Args:
|
||||||
form_component: The str name of the form component to use.
|
form_component: The str name of the form component to use.
|
||||||
"""
|
"""
|
||||||
from typing import Dict, List
|
from typing import Dict
|
||||||
|
|
||||||
import reflex as rx
|
import reflex as rx
|
||||||
|
|
||||||
class FormState(rx.State):
|
class FormState(rx.State):
|
||||||
form_data: Dict = {}
|
form_data: Dict = {}
|
||||||
|
|
||||||
var_options: List[str] = ["option3", "option4"]
|
var_options: list[str] = ["option3", "option4"]
|
||||||
|
|
||||||
def form_submit(self, form_data: Dict):
|
def form_submit(self, form_data: Dict):
|
||||||
self.form_data = form_data
|
self.form_data = form_data
|
||||||
@ -78,14 +78,14 @@ def FormSubmitName(form_component):
|
|||||||
Args:
|
Args:
|
||||||
form_component: The str name of the form component to use.
|
form_component: The str name of the form component to use.
|
||||||
"""
|
"""
|
||||||
from typing import Dict, List
|
from typing import Dict
|
||||||
|
|
||||||
import reflex as rx
|
import reflex as rx
|
||||||
|
|
||||||
class FormState(rx.State):
|
class FormState(rx.State):
|
||||||
form_data: Dict = {}
|
form_data: Dict = {}
|
||||||
val: str = "foo"
|
val: str = "foo"
|
||||||
options: List[str] = ["option1", "option2"]
|
options: list[str] = ["option1", "option2"]
|
||||||
|
|
||||||
def form_submit(self, form_data: Dict):
|
def form_submit(self, form_data: Dict):
|
||||||
self.form_data = form_data
|
self.form_data = form_data
|
||||||
|
@ -19,7 +19,7 @@ from .utils import poll_for_navigation
|
|||||||
|
|
||||||
def UploadFile():
|
def UploadFile():
|
||||||
"""App for testing dynamic routes."""
|
"""App for testing dynamic routes."""
|
||||||
from typing import Dict, List
|
from typing import Dict
|
||||||
|
|
||||||
import reflex as rx
|
import reflex as rx
|
||||||
|
|
||||||
@ -27,17 +27,17 @@ def UploadFile():
|
|||||||
|
|
||||||
class UploadState(rx.State):
|
class UploadState(rx.State):
|
||||||
_file_data: Dict[str, str] = {}
|
_file_data: Dict[str, str] = {}
|
||||||
event_order: rx.Field[List[str]] = rx.field([])
|
event_order: rx.Field[list[str]] = rx.field([])
|
||||||
progress_dicts: List[dict] = []
|
progress_dicts: list[dict] = []
|
||||||
disabled: bool = False
|
disabled: bool = False
|
||||||
large_data: str = ""
|
large_data: str = ""
|
||||||
|
|
||||||
async def handle_upload(self, files: List[rx.UploadFile]):
|
async def handle_upload(self, files: list[rx.UploadFile]):
|
||||||
for file in files:
|
for file in files:
|
||||||
upload_data = await file.read()
|
upload_data = await file.read()
|
||||||
self._file_data[file.filename or ""] = upload_data.decode("utf-8")
|
self._file_data[file.filename or ""] = upload_data.decode("utf-8")
|
||||||
|
|
||||||
async def handle_upload_secondary(self, files: List[rx.UploadFile]):
|
async def handle_upload_secondary(self, files: list[rx.UploadFile]):
|
||||||
for file in files:
|
for file in files:
|
||||||
upload_data = await file.read()
|
upload_data = await file.read()
|
||||||
self._file_data[file.filename or ""] = upload_data.decode("utf-8")
|
self._file_data[file.filename or ""] = upload_data.decode("utf-8")
|
||||||
@ -55,7 +55,7 @@ def UploadFile():
|
|||||||
self.event_order.append("chain_event")
|
self.event_order.append("chain_event")
|
||||||
|
|
||||||
@rx.event
|
@rx.event
|
||||||
async def handle_upload_tertiary(self, files: List[rx.UploadFile]):
|
async def handle_upload_tertiary(self, files: list[rx.UploadFile]):
|
||||||
for file in files:
|
for file in files:
|
||||||
(rx.get_upload_dir() / (file.filename or "INVALID")).write_bytes(
|
(rx.get_upload_dir() / (file.filename or "INVALID")).write_bytes(
|
||||||
await file.read()
|
await file.read()
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@ -32,7 +31,7 @@ from reflex.utils.imports import ImportVar, ParsedImportDict
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_compile_import_statement(
|
def test_compile_import_statement(
|
||||||
fields: List[ImportVar], test_default: str, test_rest: str
|
fields: list[ImportVar], test_default: str, test_rest: str
|
||||||
):
|
):
|
||||||
"""Test the compile_import_statement function.
|
"""Test the compile_import_statement function.
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from typing import Dict, List, Set, Tuple, Union
|
from typing import Dict, Set, Tuple, Union
|
||||||
|
|
||||||
import pydantic.v1
|
import pydantic.v1
|
||||||
import pytest
|
import pytest
|
||||||
@ -29,21 +29,21 @@ class ForEachTag(Base):
|
|||||||
class ForEachState(BaseState):
|
class ForEachState(BaseState):
|
||||||
"""A state for testing the ForEach component."""
|
"""A state for testing the ForEach component."""
|
||||||
|
|
||||||
colors_list: List[str] = ["red", "yellow"]
|
colors_list: list[str] = ["red", "yellow"]
|
||||||
nested_colors_list: List[List[str]] = [["red", "yellow"], ["blue", "green"]]
|
nested_colors_list: list[list[str]] = [["red", "yellow"], ["blue", "green"]]
|
||||||
colors_dict_list: List[Dict[str, str]] = [
|
colors_dict_list: list[Dict[str, str]] = [
|
||||||
{
|
{
|
||||||
"name": "red",
|
"name": "red",
|
||||||
},
|
},
|
||||||
{"name": "yellow"},
|
{"name": "yellow"},
|
||||||
]
|
]
|
||||||
colors_nested_dict_list: List[Dict[str, List[str]]] = [{"shades": ["light-red"]}]
|
colors_nested_dict_list: list[Dict[str, list[str]]] = [{"shades": ["light-red"]}]
|
||||||
primary_color: Dict[str, str] = {"category": "primary", "name": "red"}
|
primary_color: Dict[str, str] = {"category": "primary", "name": "red"}
|
||||||
color_with_shades: Dict[str, List[str]] = {
|
color_with_shades: Dict[str, list[str]] = {
|
||||||
"red": ["orange", "yellow"],
|
"red": ["orange", "yellow"],
|
||||||
"yellow": ["orange", "green"],
|
"yellow": ["orange", "green"],
|
||||||
}
|
}
|
||||||
nested_colors_with_shades: Dict[str, Dict[str, List[Dict[str, str]]]] = {
|
nested_colors_with_shades: Dict[str, Dict[str, list[Dict[str, str]]]] = {
|
||||||
"primary": {"red": [{"shade": "dark"}]}
|
"primary": {"red": [{"shade": "dark"}]}
|
||||||
}
|
}
|
||||||
color_tuple: Tuple[str, str] = (
|
color_tuple: Tuple[str, str] = (
|
||||||
@ -87,7 +87,7 @@ def display_color_name(color):
|
|||||||
|
|
||||||
|
|
||||||
def display_shade(color):
|
def display_shade(color):
|
||||||
assert color._var_type == Dict[str, List[str]]
|
assert color._var_type == Dict[str, list[str]]
|
||||||
return box(text(color["shades"][0]))
|
return box(text(color["shades"][0]))
|
||||||
|
|
||||||
|
|
||||||
@ -97,12 +97,12 @@ def display_primary_colors(color):
|
|||||||
|
|
||||||
|
|
||||||
def display_color_with_shades(color):
|
def display_color_with_shades(color):
|
||||||
assert color._var_type == Tuple[str, List[str]]
|
assert color._var_type == Tuple[str, list[str]]
|
||||||
return box(text(color[0]), text(color[1][0]))
|
return box(text(color[0]), text(color[1][0]))
|
||||||
|
|
||||||
|
|
||||||
def display_nested_color_with_shades(color):
|
def display_nested_color_with_shades(color):
|
||||||
assert color._var_type == Tuple[str, Dict[str, List[Dict[str, str]]]]
|
assert color._var_type == Tuple[str, Dict[str, list[Dict[str, str]]]]
|
||||||
return box(text(color[0]), text(color[1]["red"][0]["shade"]))
|
return box(text(color[0]), text(color[1]["red"][0]["shade"]))
|
||||||
|
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ def show_shade(item):
|
|||||||
|
|
||||||
|
|
||||||
def display_nested_color_with_shades_v2(color):
|
def display_nested_color_with_shades_v2(color):
|
||||||
assert color._var_type == Tuple[str, Dict[str, List[Dict[str, str]]]]
|
assert color._var_type == Tuple[str, Dict[str, list[Dict[str, str]]]]
|
||||||
return box(text(foreach(color[1], show_shade)))
|
return box(text(foreach(color[1], show_shade)))
|
||||||
|
|
||||||
|
|
||||||
@ -125,8 +125,8 @@ def display_colors_set(color):
|
|||||||
return box(text(color))
|
return box(text(color))
|
||||||
|
|
||||||
|
|
||||||
def display_nested_list_element(element: ArrayVar[List[str]], index: NumberVar[int]):
|
def display_nested_list_element(element: ArrayVar[list[str]], index: NumberVar[int]):
|
||||||
assert element._var_type == List[str]
|
assert element._var_type == list[str]
|
||||||
assert index._var_type is int
|
assert index._var_type is int
|
||||||
return box(text(element[index]))
|
return box(text(element[index]))
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from typing import List, Mapping, Tuple
|
from typing import Mapping, Tuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ def test_match_components():
|
|||||||
assert second_return_value_render["children"][0]["contents"] == '{"second value"}'
|
assert second_return_value_render["children"][0]["contents"] == '{"second value"}'
|
||||||
|
|
||||||
assert match_cases[2][0]._js_expr == "[1, 2]"
|
assert match_cases[2][0]._js_expr == "[1, 2]"
|
||||||
assert match_cases[2][0]._var_type == List[int]
|
assert match_cases[2][0]._var_type == list[int]
|
||||||
third_return_value_render = match_cases[2][1]
|
third_return_value_render = match_cases[2][1]
|
||||||
assert third_return_value_render["name"] == "RadixThemesText"
|
assert third_return_value_render["name"] == "RadixThemesText"
|
||||||
assert third_return_value_render["children"][0]["contents"] == '{"third value"}'
|
assert third_return_value_render["children"][0]["contents"] == '{"third value"}'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from contextlib import nullcontext
|
from contextlib import nullcontext
|
||||||
from typing import Any, Dict, List, Optional, Type, Union
|
from typing import Any, Dict, Optional, Type, Union
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ def component2() -> Type[Component]:
|
|||||||
|
|
||||||
class TestComponent2(Component):
|
class TestComponent2(Component):
|
||||||
# A test list prop.
|
# A test list prop.
|
||||||
arr: Var[List[str]]
|
arr: Var[list[str]]
|
||||||
|
|
||||||
on_prop_event: EventHandler[on_prop_event_spec]
|
on_prop_event: EventHandler[on_prop_event_spec]
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ def component2() -> Type[Component]:
|
|||||||
"on_open": passthrough_event_spec(bool),
|
"on_open": passthrough_event_spec(bool),
|
||||||
"on_close": passthrough_event_spec(bool),
|
"on_close": passthrough_event_spec(bool),
|
||||||
"on_user_visited_count_changed": passthrough_event_spec(int),
|
"on_user_visited_count_changed": passthrough_event_spec(int),
|
||||||
"on_user_list_changed": passthrough_event_spec(List[str]),
|
"on_user_list_changed": passthrough_event_spec(list[str]),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_imports(self) -> ParsedImportDict:
|
def _get_imports(self) -> ParsedImportDict:
|
||||||
@ -173,11 +173,11 @@ def component5() -> Type[Component]:
|
|||||||
class TestComponent5(Component):
|
class TestComponent5(Component):
|
||||||
tag = "RandomComponent"
|
tag = "RandomComponent"
|
||||||
|
|
||||||
_invalid_children: List[str] = ["Text"]
|
_invalid_children: list[str] = ["Text"]
|
||||||
|
|
||||||
_valid_children: List[str] = ["Text"]
|
_valid_children: list[str] = ["Text"]
|
||||||
|
|
||||||
_valid_parents: List[str] = ["Text"]
|
_valid_parents: list[str] = ["Text"]
|
||||||
|
|
||||||
return TestComponent5
|
return TestComponent5
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ def component6() -> Type[Component]:
|
|||||||
class TestComponent6(Component):
|
class TestComponent6(Component):
|
||||||
tag = "RandomComponent"
|
tag = "RandomComponent"
|
||||||
|
|
||||||
_invalid_children: List[str] = ["Text"]
|
_invalid_children: list[str] = ["Text"]
|
||||||
|
|
||||||
return TestComponent6
|
return TestComponent6
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ def component7() -> Type[Component]:
|
|||||||
class TestComponent7(Component):
|
class TestComponent7(Component):
|
||||||
tag = "RandomComponent"
|
tag = "RandomComponent"
|
||||||
|
|
||||||
_valid_children: List[str] = ["Text"]
|
_valid_children: list[str] = ["Text"]
|
||||||
|
|
||||||
return TestComponent7
|
return TestComponent7
|
||||||
|
|
||||||
@ -1247,9 +1247,9 @@ class ComponentNestedVar(Component):
|
|||||||
"""A component with nested Var types."""
|
"""A component with nested Var types."""
|
||||||
|
|
||||||
dict_of_dict: Var[Dict[str, Dict[str, str]]]
|
dict_of_dict: Var[Dict[str, Dict[str, str]]]
|
||||||
list_of_list: Var[List[List[str]]]
|
list_of_list: Var[list[list[str]]]
|
||||||
list_of_list_of_list: Var[List[List[List[str]]]]
|
list_of_list_of_list: Var[list[list[list[str]]]]
|
||||||
list_of_dict: Var[List[Dict[str, str]]]
|
list_of_dict: Var[list[Dict[str, str]]]
|
||||||
|
|
||||||
|
|
||||||
class EventState(rx.State):
|
class EventState(rx.State):
|
||||||
@ -1885,13 +1885,13 @@ def test_component_add_imports(tags):
|
|||||||
class TestBase(Component):
|
class TestBase(Component):
|
||||||
def add_imports( # pyright: ignore [reportIncompatibleMethodOverride]
|
def add_imports( # pyright: ignore [reportIncompatibleMethodOverride]
|
||||||
self,
|
self,
|
||||||
) -> Dict[str, Union[str, ImportVar, List[str], List[ImportVar]]]:
|
) -> Dict[str, Union[str, ImportVar, list[str], list[ImportVar]]]:
|
||||||
return {"foo": "bar"}
|
return {"foo": "bar"}
|
||||||
|
|
||||||
class Test(TestBase):
|
class Test(TestBase):
|
||||||
def add_imports(
|
def add_imports(
|
||||||
self,
|
self,
|
||||||
) -> Dict[str, Union[str, ImportVar, List[str], List[ImportVar]]]:
|
) -> Dict[str, Union[str, ImportVar, list[str], list[ImportVar]]]:
|
||||||
return {"react": (tags[0] if len(tags) == 1 else tags)}
|
return {"react": (tags[0] if len(tags) == 1 else tags)}
|
||||||
|
|
||||||
baseline = Reference.create()
|
baseline = Reference.create()
|
||||||
|
@ -143,7 +143,7 @@ class CustomVar(rx.Base):
|
|||||||
"""A Base model with multiple fields."""
|
"""A Base model with multiple fields."""
|
||||||
|
|
||||||
foo: str = ""
|
foo: str = ""
|
||||||
array: List[str] = []
|
array: list[str] = []
|
||||||
hashmap: Dict[str, str] = {}
|
hashmap: Dict[str, str] = {}
|
||||||
test_set: Set[str] = set()
|
test_set: Set[str] = set()
|
||||||
custom: OtherBase = OtherBase()
|
custom: OtherBase = OtherBase()
|
||||||
@ -161,7 +161,7 @@ class MutableSQLAModel(MutableSQLABase):
|
|||||||
__tablename__: str = "mutable_test_state"
|
__tablename__: str = "mutable_test_state"
|
||||||
|
|
||||||
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
||||||
strlist: Mapped[List[str]] = mapped_column(ARRAY(String))
|
strlist: Mapped[list[str]] = mapped_column(ARRAY(String))
|
||||||
hashmap: Mapped[Dict[str, str]] = mapped_column(JSON)
|
hashmap: Mapped[Dict[str, str]] = mapped_column(JSON)
|
||||||
test_set: Mapped[Set[str]] = mapped_column(ARRAY(String))
|
test_set: Mapped[Set[str]] = mapped_column(ARRAY(String))
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ class MutableSQLAModel(MutableSQLABase):
|
|||||||
@serializer
|
@serializer
|
||||||
def serialize_mutable_sqla_model(
|
def serialize_mutable_sqla_model(
|
||||||
model: MutableSQLAModel,
|
model: MutableSQLAModel,
|
||||||
) -> Dict[str, Union[List[str], Dict[str, str]]]:
|
) -> Dict[str, Union[list[str], Dict[str, str]]]:
|
||||||
"""Serialize the MutableSQLAModel.
|
"""Serialize the MutableSQLAModel.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -184,7 +184,7 @@ def serialize_mutable_sqla_model(
|
|||||||
class MutableTestState(BaseState):
|
class MutableTestState(BaseState):
|
||||||
"""A test state."""
|
"""A test state."""
|
||||||
|
|
||||||
array: List[Union[str, int, List, Dict[str, str]]] = [
|
array: list[Union[str, int, List, Dict[str, str]]] = [
|
||||||
"value",
|
"value",
|
||||||
[1, 2, 3],
|
[1, 2, 3],
|
||||||
{"key": "value"},
|
{"key": "value"},
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Test states for upload-related tests."""
|
"""Test states for upload-related tests."""
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import ClassVar, List
|
from typing import ClassVar
|
||||||
|
|
||||||
import reflex as rx
|
import reflex as rx
|
||||||
from reflex.state import BaseState, State
|
from reflex.state import BaseState, State
|
||||||
@ -10,7 +10,7 @@ from reflex.state import BaseState, State
|
|||||||
class UploadState(BaseState):
|
class UploadState(BaseState):
|
||||||
"""The base state for uploading a file."""
|
"""The base state for uploading a file."""
|
||||||
|
|
||||||
async def handle_upload1(self, files: List[rx.UploadFile]):
|
async def handle_upload1(self, files: list[rx.UploadFile]):
|
||||||
"""Handle the upload of a file.
|
"""Handle the upload of a file.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -30,7 +30,7 @@ class SubUploadState(BaseState):
|
|||||||
|
|
||||||
img: str
|
img: str
|
||||||
|
|
||||||
async def handle_upload(self, files: List[rx.UploadFile]):
|
async def handle_upload(self, files: list[rx.UploadFile]):
|
||||||
"""Handle the upload of a file.
|
"""Handle the upload of a file.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -42,7 +42,7 @@ class SubUploadState(BaseState):
|
|||||||
class FileUploadState(State):
|
class FileUploadState(State):
|
||||||
"""The base state for uploading a file."""
|
"""The base state for uploading a file."""
|
||||||
|
|
||||||
img_list: List[str]
|
img_list: list[str]
|
||||||
_tmp_path: ClassVar[Path]
|
_tmp_path: ClassVar[Path]
|
||||||
|
|
||||||
async def handle_upload2(self, files):
|
async def handle_upload2(self, files):
|
||||||
@ -53,7 +53,7 @@ class FileUploadState(State):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def multi_handle_upload(self, files: List[rx.UploadFile]):
|
async def multi_handle_upload(self, files: list[rx.UploadFile]):
|
||||||
"""Handle the upload of a file.
|
"""Handle the upload of a file.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -71,7 +71,7 @@ class FileUploadState(State):
|
|||||||
self.img_list.append(file.filename)
|
self.img_list.append(file.filename)
|
||||||
|
|
||||||
@rx.event(background=True)
|
@rx.event(background=True)
|
||||||
async def bg_upload(self, files: List[rx.UploadFile]):
|
async def bg_upload(self, files: list[rx.UploadFile]):
|
||||||
"""Background task cannot be upload handler.
|
"""Background task cannot be upload handler.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -89,7 +89,7 @@ class FileStateBase1(State):
|
|||||||
class ChildFileUploadState(FileStateBase1):
|
class ChildFileUploadState(FileStateBase1):
|
||||||
"""The child state for uploading a file."""
|
"""The child state for uploading a file."""
|
||||||
|
|
||||||
img_list: List[str]
|
img_list: list[str]
|
||||||
_tmp_path: ClassVar[Path]
|
_tmp_path: ClassVar[Path]
|
||||||
|
|
||||||
async def handle_upload2(self, files):
|
async def handle_upload2(self, files):
|
||||||
@ -100,7 +100,7 @@ class ChildFileUploadState(FileStateBase1):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def multi_handle_upload(self, files: List[rx.UploadFile]):
|
async def multi_handle_upload(self, files: list[rx.UploadFile]):
|
||||||
"""Handle the upload of a file.
|
"""Handle the upload of a file.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -118,7 +118,7 @@ class ChildFileUploadState(FileStateBase1):
|
|||||||
self.img_list.append(file.filename)
|
self.img_list.append(file.filename)
|
||||||
|
|
||||||
@rx.event(background=True)
|
@rx.event(background=True)
|
||||||
async def bg_upload(self, files: List[rx.UploadFile]):
|
async def bg_upload(self, files: list[rx.UploadFile]):
|
||||||
"""Background task cannot be upload handler.
|
"""Background task cannot be upload handler.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -136,7 +136,7 @@ class FileStateBase2(FileStateBase1):
|
|||||||
class GrandChildFileUploadState(FileStateBase2):
|
class GrandChildFileUploadState(FileStateBase2):
|
||||||
"""The child state for uploading a file."""
|
"""The child state for uploading a file."""
|
||||||
|
|
||||||
img_list: List[str]
|
img_list: list[str]
|
||||||
_tmp_path: ClassVar[Path]
|
_tmp_path: ClassVar[Path]
|
||||||
|
|
||||||
async def handle_upload2(self, files):
|
async def handle_upload2(self, files):
|
||||||
@ -147,7 +147,7 @@ class GrandChildFileUploadState(FileStateBase2):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def multi_handle_upload(self, files: List[rx.UploadFile]):
|
async def multi_handle_upload(self, files: list[rx.UploadFile]):
|
||||||
"""Handle the upload of a file.
|
"""Handle the upload of a file.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -165,7 +165,7 @@ class GrandChildFileUploadState(FileStateBase2):
|
|||||||
self.img_list.append(file.filename)
|
self.img_list.append(file.filename)
|
||||||
|
|
||||||
@rx.event(background=True)
|
@rx.event(background=True)
|
||||||
async def bg_upload(self, files: List[rx.UploadFile]):
|
async def bg_upload(self, files: list[rx.UploadFile]):
|
||||||
"""Background task cannot be upload handler.
|
"""Background task cannot be upload handler.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -9,7 +9,7 @@ import unittest.mock
|
|||||||
import uuid
|
import uuid
|
||||||
from contextlib import nullcontext as does_not_raise
|
from contextlib import nullcontext as does_not_raise
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Generator, List, Tuple, Type
|
from typing import Generator, Tuple, Type
|
||||||
from unittest.mock import AsyncMock
|
from unittest.mock import AsyncMock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -570,7 +570,7 @@ async def test_dynamic_var_event(test_state: Type[ATestState], token: str):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_list_mutation_detection__plain_list(
|
async def test_list_mutation_detection__plain_list(
|
||||||
event_tuples: List[Tuple[str, List[str]]],
|
event_tuples: list[Tuple[str, list[str]]],
|
||||||
list_mutation_state: State,
|
list_mutation_state: State,
|
||||||
token: str,
|
token: str,
|
||||||
):
|
):
|
||||||
@ -695,7 +695,7 @@ async def test_list_mutation_detection__plain_list(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_dict_mutation_detection__plain_list(
|
async def test_dict_mutation_detection__plain_list(
|
||||||
event_tuples: List[Tuple[str, List[str]]],
|
event_tuples: list[Tuple[str, list[str]]],
|
||||||
dict_mutation_state: State,
|
dict_mutation_state: State,
|
||||||
token: str,
|
token: str,
|
||||||
):
|
):
|
||||||
@ -817,7 +817,7 @@ async def test_upload_file(tmp_path, state, delta, token: str, mocker):
|
|||||||
[FileUploadState, ChildFileUploadState, GrandChildFileUploadState],
|
[FileUploadState, ChildFileUploadState, GrandChildFileUploadState],
|
||||||
)
|
)
|
||||||
async def test_upload_file_without_annotation(state, tmp_path, token):
|
async def test_upload_file_without_annotation(state, tmp_path, token):
|
||||||
"""Test that an error is thrown when there's no param annotated with rx.UploadFile or List[UploadFile].
|
"""Test that an error is thrown when there's no param annotated with rx.UploadFile or list[UploadFile].
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
state: The state class.
|
state: The state class.
|
||||||
@ -838,7 +838,7 @@ async def test_upload_file_without_annotation(state, tmp_path, token):
|
|||||||
await fn(request_mock, [file_mock])
|
await fn(request_mock, [file_mock])
|
||||||
assert (
|
assert (
|
||||||
err.value.args[0]
|
err.value.args[0]
|
||||||
== f"`{state.get_full_name()}.handle_upload2` handler should have a parameter annotated as List[rx.UploadFile]"
|
== f"`{state.get_full_name()}.handle_upload2` handler should have a parameter annotated as list[rx.UploadFile]"
|
||||||
)
|
)
|
||||||
|
|
||||||
if isinstance(app.state_manager, StateManagerRedis):
|
if isinstance(app.state_manager, StateManagerRedis):
|
||||||
@ -1523,22 +1523,22 @@ def test_app_with_transpile_packages(compilable_app: tuple[App, Path], export: b
|
|||||||
class C1(rx.Component):
|
class C1(rx.Component):
|
||||||
library = "foo@1.2.3"
|
library = "foo@1.2.3"
|
||||||
tag = "Foo"
|
tag = "Foo"
|
||||||
transpile_packages: List[str] = ["foo"]
|
transpile_packages: list[str] = ["foo"]
|
||||||
|
|
||||||
class C2(rx.Component):
|
class C2(rx.Component):
|
||||||
library = "bar@4.5.6"
|
library = "bar@4.5.6"
|
||||||
tag = "Bar"
|
tag = "Bar"
|
||||||
transpile_packages: List[str] = ["bar@4.5.6"]
|
transpile_packages: list[str] = ["bar@4.5.6"]
|
||||||
|
|
||||||
class C3(rx.NoSSRComponent):
|
class C3(rx.NoSSRComponent):
|
||||||
library = "baz@7.8.10"
|
library = "baz@7.8.10"
|
||||||
tag = "Baz"
|
tag = "Baz"
|
||||||
transpile_packages: List[str] = ["baz@7.8.9"]
|
transpile_packages: list[str] = ["baz@7.8.9"]
|
||||||
|
|
||||||
class C4(rx.NoSSRComponent):
|
class C4(rx.NoSSRComponent):
|
||||||
library = "quuc@2.3.4"
|
library = "quuc@2.3.4"
|
||||||
tag = "Quuc"
|
tag = "Quuc"
|
||||||
transpile_packages: List[str] = ["quuc"]
|
transpile_packages: list[str] = ["quuc"]
|
||||||
|
|
||||||
class C5(rx.Component):
|
class C5(rx.Component):
|
||||||
library = "quuc"
|
library = "quuc"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Dict, List, Optional, Type, Union
|
from typing import Dict, Optional, Type, Union
|
||||||
|
|
||||||
import attrs
|
import attrs
|
||||||
import pydantic.v1
|
import pydantic.v1
|
||||||
@ -74,16 +74,16 @@ class SQLAClass(SQLABase):
|
|||||||
id: Mapped[int] = mapped_column(primary_key=True)
|
id: Mapped[int] = mapped_column(primary_key=True)
|
||||||
count: Mapped[int] = mapped_column()
|
count: Mapped[int] = mapped_column()
|
||||||
name: Mapped[str] = mapped_column()
|
name: Mapped[str] = mapped_column()
|
||||||
int_list: Mapped[List[int]] = mapped_column(
|
int_list: Mapped[list[int]] = mapped_column(
|
||||||
sqlalchemy.types.ARRAY(item_type=sqlalchemy.INTEGER)
|
sqlalchemy.types.ARRAY(item_type=sqlalchemy.INTEGER)
|
||||||
)
|
)
|
||||||
str_list: Mapped[List[str]] = mapped_column(
|
str_list: Mapped[list[str]] = mapped_column(
|
||||||
sqlalchemy.types.ARRAY(item_type=sqlalchemy.String)
|
sqlalchemy.types.ARRAY(item_type=sqlalchemy.String)
|
||||||
)
|
)
|
||||||
optional_int: Mapped[Optional[int]] = mapped_column(nullable=True)
|
optional_int: Mapped[Optional[int]] = mapped_column(nullable=True)
|
||||||
sqla_tag_id: Mapped[int] = mapped_column(sqlalchemy.ForeignKey(SQLATag.id))
|
sqla_tag_id: Mapped[int] = mapped_column(sqlalchemy.ForeignKey(SQLATag.id))
|
||||||
sqla_tag: Mapped[Optional[SQLATag]] = relationship()
|
sqla_tag: Mapped[Optional[SQLATag]] = relationship()
|
||||||
labels: Mapped[List[SQLALabel]] = relationship(back_populates="test")
|
labels: Mapped[list[SQLALabel]] = relationship(back_populates="test")
|
||||||
# do not use lower case dict here!
|
# do not use lower case dict here!
|
||||||
# https://github.com/sqlalchemy/sqlalchemy/issues/9902
|
# https://github.com/sqlalchemy/sqlalchemy/issues/9902
|
||||||
dict_str_str: Mapped[Dict[str, str]] = mapped_column()
|
dict_str_str: Mapped[Dict[str, str]] = mapped_column()
|
||||||
@ -123,20 +123,20 @@ class SQLAClassDataclass(MappedAsDataclass, SQLABase):
|
|||||||
no_default: Mapped[int] = mapped_column(nullable=True)
|
no_default: Mapped[int] = mapped_column(nullable=True)
|
||||||
count: Mapped[int] = mapped_column()
|
count: Mapped[int] = mapped_column()
|
||||||
name: Mapped[str] = mapped_column()
|
name: Mapped[str] = mapped_column()
|
||||||
int_list: Mapped[List[int]] = mapped_column(
|
int_list: Mapped[list[int]] = mapped_column(
|
||||||
sqlalchemy.types.ARRAY(item_type=sqlalchemy.INTEGER)
|
sqlalchemy.types.ARRAY(item_type=sqlalchemy.INTEGER)
|
||||||
)
|
)
|
||||||
str_list: Mapped[List[str]] = mapped_column(
|
str_list: Mapped[list[str]] = mapped_column(
|
||||||
sqlalchemy.types.ARRAY(item_type=sqlalchemy.String)
|
sqlalchemy.types.ARRAY(item_type=sqlalchemy.String)
|
||||||
)
|
)
|
||||||
optional_int: Mapped[Optional[int]] = mapped_column(nullable=True)
|
optional_int: Mapped[Optional[int]] = mapped_column(nullable=True)
|
||||||
sqla_tag_id: Mapped[int] = mapped_column(sqlalchemy.ForeignKey(SQLATag.id))
|
sqla_tag_id: Mapped[int] = mapped_column(sqlalchemy.ForeignKey(SQLATag.id))
|
||||||
sqla_tag: Mapped[Optional[SQLATag]] = relationship()
|
sqla_tag: Mapped[Optional[SQLATag]] = relationship()
|
||||||
labels: Mapped[List[SQLALabel]] = relationship(back_populates="test_dataclass")
|
labels: Mapped[list[SQLALabel]] = relationship(back_populates="test_dataclass")
|
||||||
# do not use lower case dict here!
|
# do not use lower case dict here!
|
||||||
# https://github.com/sqlalchemy/sqlalchemy/issues/9902
|
# https://github.com/sqlalchemy/sqlalchemy/issues/9902
|
||||||
dict_str_str: Mapped[Dict[str, str]] = mapped_column()
|
dict_str_str: Mapped[Dict[str, str]] = mapped_column()
|
||||||
default_factory: Mapped[List[int]] = mapped_column(
|
default_factory: Mapped[list[int]] = mapped_column(
|
||||||
sqlalchemy.types.ARRAY(item_type=sqlalchemy.INTEGER),
|
sqlalchemy.types.ARRAY(item_type=sqlalchemy.INTEGER),
|
||||||
default_factory=list,
|
default_factory=list,
|
||||||
)
|
)
|
||||||
@ -176,13 +176,13 @@ class ModelClass(rx.Model):
|
|||||||
no_default: Optional[int] = sqlmodel.Field(nullable=True)
|
no_default: Optional[int] = sqlmodel.Field(nullable=True)
|
||||||
count: int = 0
|
count: int = 0
|
||||||
name: str = "test"
|
name: str = "test"
|
||||||
int_list: List[int] = []
|
int_list: list[int] = []
|
||||||
str_list: List[str] = []
|
str_list: list[str] = []
|
||||||
optional_int: Optional[int] = None
|
optional_int: Optional[int] = None
|
||||||
sqla_tag: Optional[SQLATag] = None
|
sqla_tag: Optional[SQLATag] = None
|
||||||
labels: List[SQLALabel] = []
|
labels: list[SQLALabel] = []
|
||||||
dict_str_str: Dict[str, str] = {}
|
dict_str_str: Dict[str, str] = {}
|
||||||
default_factory: List[int] = sqlmodel.Field(default_factory=list)
|
default_factory: list[int] = sqlmodel.Field(default_factory=list)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def str_property(self) -> str:
|
def str_property(self) -> str:
|
||||||
@ -218,13 +218,13 @@ class BaseClass(rx.Base):
|
|||||||
no_default: Optional[int] = pydantic.v1.Field(required=False)
|
no_default: Optional[int] = pydantic.v1.Field(required=False)
|
||||||
count: int = 0
|
count: int = 0
|
||||||
name: str = "test"
|
name: str = "test"
|
||||||
int_list: List[int] = []
|
int_list: list[int] = []
|
||||||
str_list: List[str] = []
|
str_list: list[str] = []
|
||||||
optional_int: Optional[int] = None
|
optional_int: Optional[int] = None
|
||||||
sqla_tag: Optional[SQLATag] = None
|
sqla_tag: Optional[SQLATag] = None
|
||||||
labels: List[SQLALabel] = []
|
labels: list[SQLALabel] = []
|
||||||
dict_str_str: Dict[str, str] = {}
|
dict_str_str: Dict[str, str] = {}
|
||||||
default_factory: List[int] = pydantic.v1.Field(default_factory=list)
|
default_factory: list[int] = pydantic.v1.Field(default_factory=list)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def str_property(self) -> str:
|
def str_property(self) -> str:
|
||||||
@ -259,11 +259,11 @@ class BareClass:
|
|||||||
|
|
||||||
count: int = 0
|
count: int = 0
|
||||||
name: str = "test"
|
name: str = "test"
|
||||||
int_list: List[int] = []
|
int_list: list[int] = []
|
||||||
str_list: List[str] = []
|
str_list: list[str] = []
|
||||||
optional_int: Optional[int] = None
|
optional_int: Optional[int] = None
|
||||||
sqla_tag: Optional[SQLATag] = None
|
sqla_tag: Optional[SQLATag] = None
|
||||||
labels: List[SQLALabel] = []
|
labels: list[SQLALabel] = []
|
||||||
dict_str_str: Dict[str, str] = {}
|
dict_str_str: Dict[str, str] = {}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -300,13 +300,13 @@ class AttrClass:
|
|||||||
|
|
||||||
count: int = 0
|
count: int = 0
|
||||||
name: str = "test"
|
name: str = "test"
|
||||||
int_list: List[int] = []
|
int_list: list[int] = []
|
||||||
str_list: List[str] = []
|
str_list: list[str] = []
|
||||||
optional_int: Optional[int] = None
|
optional_int: Optional[int] = None
|
||||||
sqla_tag: Optional[SQLATag] = None
|
sqla_tag: Optional[SQLATag] = None
|
||||||
labels: List[SQLALabel] = []
|
labels: list[SQLALabel] = []
|
||||||
dict_str_str: Dict[str, str] = {}
|
dict_str_str: Dict[str, str] = {}
|
||||||
default_factory: List[int] = attrs.field(factory=list)
|
default_factory: list[int] = attrs.field(factory=list)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def str_property(self) -> str:
|
def str_property(self) -> str:
|
||||||
@ -352,11 +352,11 @@ class AttrClass:
|
|||||||
[
|
[
|
||||||
pytest.param("count", int, id="int"),
|
pytest.param("count", int, id="int"),
|
||||||
pytest.param("name", str, id="str"),
|
pytest.param("name", str, id="str"),
|
||||||
pytest.param("int_list", List[int], id="List[int]"),
|
pytest.param("int_list", list[int], id="list[int]"),
|
||||||
pytest.param("str_list", List[str], id="List[str]"),
|
pytest.param("str_list", list[str], id="list[str]"),
|
||||||
pytest.param("optional_int", Optional[int], id="Optional[int]"),
|
pytest.param("optional_int", Optional[int], id="Optional[int]"),
|
||||||
pytest.param("sqla_tag", Optional[SQLATag], id="Optional[SQLATag]"),
|
pytest.param("sqla_tag", Optional[SQLATag], id="Optional[SQLATag]"),
|
||||||
pytest.param("labels", List[SQLALabel], id="List[SQLALabel]"),
|
pytest.param("labels", list[SQLALabel], id="list[SQLALabel]"),
|
||||||
pytest.param("dict_str_str", Dict[str, str], id="Dict[str, str]"),
|
pytest.param("dict_str_str", Dict[str, str], id="Dict[str, str]"),
|
||||||
pytest.param("str_property", str, id="str_property"),
|
pytest.param("str_property", str, id="str_property"),
|
||||||
pytest.param("str_or_int_property", Union[str, int], id="str_or_int_property"),
|
pytest.param("str_or_int_property", Union[str, int], id="str_or_int_property"),
|
||||||
@ -389,7 +389,7 @@ def test_get_attribute_access_type_default_factory(cls: type) -> None:
|
|||||||
Args:
|
Args:
|
||||||
cls: Class to test.
|
cls: Class to test.
|
||||||
"""
|
"""
|
||||||
assert get_attribute_access_type(cls, "default_factory") == List[int]
|
assert get_attribute_access_type(cls, "default_factory") == list[int]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from typing import Callable, List
|
from typing import Callable
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ def test_call_event_handler_partial():
|
|||||||
|
|
||||||
test_fn_with_args.__qualname__ = "test_fn_with_args"
|
test_fn_with_args.__qualname__ = "test_fn_with_args"
|
||||||
|
|
||||||
def spec(a2: Var[str]) -> List[Var[str]]:
|
def spec(a2: Var[str]) -> list[Var[str]]:
|
||||||
return [a2]
|
return [a2]
|
||||||
|
|
||||||
handler = EventHandler(fn=test_fn_with_args, state_full_name="BigState")
|
handler = EventHandler(fn=test_fn_with_args, state_full_name="BigState")
|
||||||
|
@ -16,7 +16,6 @@ from typing import (
|
|||||||
Callable,
|
Callable,
|
||||||
ClassVar,
|
ClassVar,
|
||||||
Dict,
|
Dict,
|
||||||
List,
|
|
||||||
Optional,
|
Optional,
|
||||||
Set,
|
Set,
|
||||||
Tuple,
|
Tuple,
|
||||||
@ -121,8 +120,8 @@ class TestState(BaseState):
|
|||||||
num2: float = 3.14
|
num2: float = 3.14
|
||||||
key: str
|
key: str
|
||||||
map_key: str = "a"
|
map_key: str = "a"
|
||||||
array: List[float] = [1, 2, 3.14]
|
array: list[float] = [1, 2, 3.14]
|
||||||
mapping: Dict[str, List[int]] = {"a": [1, 2, 3], "b": [4, 5, 6]}
|
mapping: Dict[str, list[int]] = {"a": [1, 2, 3], "b": [4, 5, 6]}
|
||||||
obj: Object = Object()
|
obj: Object = Object()
|
||||||
complex: Dict[int, Object] = {1: Object(), 2: Object()}
|
complex: Dict[int, Object] = {1: Object(), 2: Object()}
|
||||||
fig: Figure = Figure()
|
fig: Figure = Figure()
|
||||||
@ -952,7 +951,7 @@ def test_add_var():
|
|||||||
# New instances get an actual value with the default
|
# New instances get an actual value with the default
|
||||||
assert DynamicState().dynamic_int == 42
|
assert DynamicState().dynamic_int == 42
|
||||||
|
|
||||||
ds1.add_var("dynamic_list", List[int], [5, 10])
|
ds1.add_var("dynamic_list", list[int], [5, 10])
|
||||||
assert ds1.dynamic_list.equals(DynamicState.dynamic_list) # pyright: ignore [reportAttributeAccessIssue]
|
assert ds1.dynamic_list.equals(DynamicState.dynamic_list) # pyright: ignore [reportAttributeAccessIssue]
|
||||||
ds2 = DynamicState()
|
ds2 = DynamicState()
|
||||||
assert ds2.dynamic_list == [5, 10]
|
assert ds2.dynamic_list == [5, 10]
|
||||||
@ -1393,8 +1392,8 @@ def test_computed_var_dependencies():
|
|||||||
v: int = 0
|
v: int = 0
|
||||||
w: int = 0
|
w: int = 0
|
||||||
x: int = 0
|
x: int = 0
|
||||||
y: List[int] = [1, 2, 3]
|
y: list[int] = [1, 2, 3]
|
||||||
_z: List[int] = [1, 2, 3]
|
_z: list[int] = [1, 2, 3]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def testprop(self) -> int:
|
def testprop(self) -> int:
|
||||||
@ -1459,7 +1458,7 @@ def test_computed_var_dependencies():
|
|||||||
return [round(y) for y in self.y]
|
return [round(y) for y in self.y]
|
||||||
|
|
||||||
@rx.var
|
@rx.var
|
||||||
def comp_z(self) -> List[bool]:
|
def comp_z(self) -> list[bool]:
|
||||||
"""Comprehension accesses attribute.
|
"""Comprehension accesses attribute.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -2048,8 +2047,8 @@ async def test_state_proxy(grandchild_state: GrandchildState, mock_app: rx.App):
|
|||||||
class BackgroundTaskState(BaseState):
|
class BackgroundTaskState(BaseState):
|
||||||
"""A state with a background task."""
|
"""A state with a background task."""
|
||||||
|
|
||||||
order: List[str] = []
|
order: list[str] = []
|
||||||
dict_list: Dict[str, List[int]] = {"foo": [1, 2, 3]}
|
dict_list: Dict[str, list[int]] = {"foo": [1, 2, 3]}
|
||||||
dc: ModelDC = ModelDC()
|
dc: ModelDC = ModelDC()
|
||||||
|
|
||||||
def __init__(self, **kwargs): # noqa: D107
|
def __init__(self, **kwargs): # noqa: D107
|
||||||
@ -2057,7 +2056,7 @@ class BackgroundTaskState(BaseState):
|
|||||||
self.router_data = {"simulate": "hydrate"}
|
self.router_data = {"simulate": "hydrate"}
|
||||||
|
|
||||||
@rx.var(cache=False)
|
@rx.var(cache=False)
|
||||||
def computed_order(self) -> List[str]:
|
def computed_order(self) -> list[str]:
|
||||||
"""Get the order as a computed var.
|
"""Get the order as a computed var.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -2642,14 +2641,14 @@ def test_duplicate_substate_class(mocker):
|
|||||||
class Foo(Base):
|
class Foo(Base):
|
||||||
"""A class containing a list of str."""
|
"""A class containing a list of str."""
|
||||||
|
|
||||||
tags: List[str] = ["123", "456"]
|
tags: list[str] = ["123", "456"]
|
||||||
|
|
||||||
|
|
||||||
def test_json_dumps_with_mutables():
|
def test_json_dumps_with_mutables():
|
||||||
"""Test that json.dumps works with Base vars inside mutable types."""
|
"""Test that json.dumps works with Base vars inside mutable types."""
|
||||||
|
|
||||||
class MutableContainsBase(BaseState):
|
class MutableContainsBase(BaseState):
|
||||||
items: List[Foo] = [Foo()]
|
items: list[Foo] = [Foo()]
|
||||||
|
|
||||||
dict_val = MutableContainsBase().dict()
|
dict_val = MutableContainsBase().dict()
|
||||||
assert isinstance(dict_val[MutableContainsBase.get_full_name()]["items"][0], Foo)
|
assert isinstance(dict_val[MutableContainsBase.get_full_name()]["items"][0], Foo)
|
||||||
@ -2668,7 +2667,7 @@ def test_reset_with_mutables():
|
|||||||
copied_default = copy.deepcopy(default)
|
copied_default = copy.deepcopy(default)
|
||||||
|
|
||||||
class MutableResetState(BaseState):
|
class MutableResetState(BaseState):
|
||||||
items: List[List[int]] = default
|
items: list[list[int]] = default
|
||||||
|
|
||||||
instance = MutableResetState()
|
instance = MutableResetState()
|
||||||
assert instance.items.__wrapped__ is not default # pyright: ignore [reportAttributeAccessIssue]
|
assert instance.items.__wrapped__ is not default # pyright: ignore [reportAttributeAccessIssue]
|
||||||
@ -3890,7 +3889,7 @@ class Table(rx.ComponentState):
|
|||||||
data: ClassVar[Var]
|
data: ClassVar[Var]
|
||||||
|
|
||||||
@rx.var(cache=True, auto_deps=False)
|
@rx.var(cache=True, auto_deps=False)
|
||||||
async def rows(self) -> List[Dict[str, Any]]:
|
async def rows(self) -> list[Dict[str, Any]]:
|
||||||
"""Computed var over the given rows.
|
"""Computed var over the given rows.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -3925,7 +3924,7 @@ async def test_async_computed_var_get_var_value(mock_app: rx.App, token: str):
|
|||||||
class OtherState(rx.State):
|
class OtherState(rx.State):
|
||||||
"""A state with a var."""
|
"""A state with a var."""
|
||||||
|
|
||||||
data: List[Dict[str, Any]] = [{"foo": "bar"}]
|
data: list[Dict[str, Any]] = [{"foo": "bar"}]
|
||||||
|
|
||||||
mock_app.state_manager.state = mock_app._state = rx.State
|
mock_app.state_manager.state = mock_app._state = rx.State
|
||||||
comp = Table.create(data=OtherState.data)
|
comp = Table.create(data=OtherState.data)
|
||||||
|
@ -273,7 +273,7 @@ def test_get_setter(prop: Var, expected):
|
|||||||
(1, Var(_js_expr="1", _var_type=int)),
|
(1, Var(_js_expr="1", _var_type=int)),
|
||||||
("key", Var(_js_expr='"key"', _var_type=str)),
|
("key", Var(_js_expr='"key"', _var_type=str)),
|
||||||
(3.14, Var(_js_expr="3.14", _var_type=float)),
|
(3.14, Var(_js_expr="3.14", _var_type=float)),
|
||||||
([1, 2, 3], Var(_js_expr="[1, 2, 3]", _var_type=List[int])),
|
([1, 2, 3], Var(_js_expr="[1, 2, 3]", _var_type=list[int])),
|
||||||
(
|
(
|
||||||
{"a": 1, "b": 2},
|
{"a": 1, "b": 2},
|
||||||
Var(_js_expr='({ ["a"] : 1, ["b"] : 2 })', _var_type=Mapping[str, int]),
|
Var(_js_expr='({ ["a"] : 1, ["b"] : 2 })', _var_type=Mapping[str, int]),
|
||||||
@ -482,7 +482,7 @@ def test_dict_contains(var, expected):
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"var",
|
"var",
|
||||||
[
|
[
|
||||||
Var(_js_expr="list", _var_type=List[int]).guess_type(),
|
Var(_js_expr="list", _var_type=list[int]).guess_type(),
|
||||||
Var(_js_expr="tuple", _var_type=Tuple[int, int]).guess_type(),
|
Var(_js_expr="tuple", _var_type=Tuple[int, int]).guess_type(),
|
||||||
Var(_js_expr="str", _var_type=str).guess_type(),
|
Var(_js_expr="str", _var_type=str).guess_type(),
|
||||||
],
|
],
|
||||||
@ -504,7 +504,7 @@ def test_var_indexing_lists(var):
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"var, type_",
|
"var, type_",
|
||||||
[
|
[
|
||||||
(Var(_js_expr="list", _var_type=List[int]).guess_type(), [int, int]),
|
(Var(_js_expr="list", _var_type=list[int]).guess_type(), [int, int]),
|
||||||
(
|
(
|
||||||
Var(_js_expr="tuple", _var_type=Tuple[int, str]).guess_type(),
|
Var(_js_expr="tuple", _var_type=Tuple[int, str]).guess_type(),
|
||||||
[int, str],
|
[int, str],
|
||||||
@ -565,39 +565,39 @@ def test_computed_var_replace_with_invalid_kwargs():
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"var, index",
|
"var, index",
|
||||||
[
|
[
|
||||||
(Var(_js_expr="lst", _var_type=List[int]).guess_type(), [1, 2]),
|
(Var(_js_expr="lst", _var_type=list[int]).guess_type(), [1, 2]),
|
||||||
(
|
(
|
||||||
Var(_js_expr="lst", _var_type=List[int]).guess_type(),
|
Var(_js_expr="lst", _var_type=list[int]).guess_type(),
|
||||||
{"name": "dict"},
|
{"name": "dict"},
|
||||||
),
|
),
|
||||||
(Var(_js_expr="lst", _var_type=List[int]).guess_type(), {"set"}),
|
(Var(_js_expr="lst", _var_type=list[int]).guess_type(), {"set"}),
|
||||||
(
|
(
|
||||||
Var(_js_expr="lst", _var_type=List[int]).guess_type(),
|
Var(_js_expr="lst", _var_type=list[int]).guess_type(),
|
||||||
(
|
(
|
||||||
1,
|
1,
|
||||||
2,
|
2,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(Var(_js_expr="lst", _var_type=List[int]).guess_type(), 1.5),
|
(Var(_js_expr="lst", _var_type=list[int]).guess_type(), 1.5),
|
||||||
(Var(_js_expr="lst", _var_type=List[int]).guess_type(), "str"),
|
(Var(_js_expr="lst", _var_type=list[int]).guess_type(), "str"),
|
||||||
(
|
(
|
||||||
Var(_js_expr="lst", _var_type=List[int]).guess_type(),
|
Var(_js_expr="lst", _var_type=list[int]).guess_type(),
|
||||||
Var(_js_expr="string_var", _var_type=str).guess_type(),
|
Var(_js_expr="string_var", _var_type=str).guess_type(),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
Var(_js_expr="lst", _var_type=List[int]).guess_type(),
|
Var(_js_expr="lst", _var_type=list[int]).guess_type(),
|
||||||
Var(_js_expr="float_var", _var_type=float).guess_type(),
|
Var(_js_expr="float_var", _var_type=float).guess_type(),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
Var(_js_expr="lst", _var_type=List[int]).guess_type(),
|
Var(_js_expr="lst", _var_type=list[int]).guess_type(),
|
||||||
Var(_js_expr="list_var", _var_type=List[int]).guess_type(),
|
Var(_js_expr="list_var", _var_type=list[int]).guess_type(),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
Var(_js_expr="lst", _var_type=List[int]).guess_type(),
|
Var(_js_expr="lst", _var_type=list[int]).guess_type(),
|
||||||
Var(_js_expr="set_var", _var_type=Set[str]).guess_type(),
|
Var(_js_expr="set_var", _var_type=Set[str]).guess_type(),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
Var(_js_expr="lst", _var_type=List[int]).guess_type(),
|
Var(_js_expr="lst", _var_type=list[int]).guess_type(),
|
||||||
Var(_js_expr="dict_var", _var_type=Dict[str, str]).guess_type(),
|
Var(_js_expr="dict_var", _var_type=Dict[str, str]).guess_type(),
|
||||||
),
|
),
|
||||||
(Var(_js_expr="str", _var_type=str).guess_type(), [1, 2]),
|
(Var(_js_expr="str", _var_type=str).guess_type(), [1, 2]),
|
||||||
@ -641,7 +641,7 @@ def test_var_unsupported_indexing_lists(var, index):
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"var",
|
"var",
|
||||||
[
|
[
|
||||||
Var(_js_expr="lst", _var_type=List[int]).guess_type(),
|
Var(_js_expr="lst", _var_type=list[int]).guess_type(),
|
||||||
Var(_js_expr="tuple", _var_type=Tuple[int, int]).guess_type(),
|
Var(_js_expr="tuple", _var_type=Tuple[int, int]).guess_type(),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@ -710,7 +710,7 @@ def test_dict_indexing():
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
Var(_js_expr="lst", _var_type=Dict[str, str]).guess_type(),
|
Var(_js_expr="lst", _var_type=Dict[str, str]).guess_type(),
|
||||||
Var(_js_expr="list_var", _var_type=List[int]).guess_type(),
|
Var(_js_expr="list_var", _var_type=list[int]).guess_type(),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
Var(_js_expr="lst", _var_type=Dict[str, str]).guess_type(),
|
Var(_js_expr="lst", _var_type=Dict[str, str]).guess_type(),
|
||||||
@ -741,7 +741,7 @@ def test_dict_indexing():
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
Var(_js_expr="df", _var_type=DataFrame).guess_type(),
|
Var(_js_expr="df", _var_type=DataFrame).guess_type(),
|
||||||
Var(_js_expr="list_var", _var_type=List[int]).guess_type(),
|
Var(_js_expr="list_var", _var_type=list[int]).guess_type(),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
Var(_js_expr="df", _var_type=DataFrame).guess_type(),
|
Var(_js_expr="df", _var_type=DataFrame).guess_type(),
|
||||||
@ -1135,8 +1135,8 @@ def test_type_chains():
|
|||||||
object_var = LiteralObjectVar.create({"a": 1, "b": 2, "c": 3})
|
object_var = LiteralObjectVar.create({"a": 1, "b": 2, "c": 3})
|
||||||
assert (object_var._key_type(), object_var._value_type()) == (str, int)
|
assert (object_var._key_type(), object_var._value_type()) == (str, int)
|
||||||
assert (object_var.keys()._var_type, object_var.values()._var_type) == (
|
assert (object_var.keys()._var_type, object_var.values()._var_type) == (
|
||||||
List[str],
|
list[str],
|
||||||
List[int],
|
list[int],
|
||||||
)
|
)
|
||||||
assert (
|
assert (
|
||||||
str(object_var.keys()[0].upper())
|
str(object_var.keys()[0].upper())
|
||||||
@ -1153,7 +1153,7 @@ def test_type_chains():
|
|||||||
|
|
||||||
|
|
||||||
def test_nested_dict():
|
def test_nested_dict():
|
||||||
arr = LiteralArrayVar.create([{"bar": ["foo", "bar"]}], List[Dict[str, List[str]]])
|
arr = LiteralArrayVar.create([{"bar": ["foo", "bar"]}], list[Dict[str, list[str]]])
|
||||||
|
|
||||||
assert (
|
assert (
|
||||||
str(arr[0]["bar"][0]) == '[({ ["bar"] : ["foo", "bar"] })].at(0)["bar"].at(0)' # pyright: ignore [reportIndexIssue]
|
str(arr[0]["bar"][0]) == '[({ ["bar"] : ["foo", "bar"] })].at(0)["bar"].at(0)' # pyright: ignore [reportIndexIssue]
|
||||||
@ -1474,7 +1474,7 @@ def test_unsupported_default_contains():
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[str]):
|
def test_valid_var_operations(operand1_var: Var, operand2_var, operators: list[str]):
|
||||||
"""Test that operations do not raise a TypeError.
|
"""Test that operations do not raise a TypeError.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -1766,7 +1766,7 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_invalid_var_operations(operand1_var: Var, operand2_var, operators: List[str]):
|
def test_invalid_var_operations(operand1_var: Var, operand2_var, operators: list[str]):
|
||||||
for operator in operators:
|
for operator in operators:
|
||||||
print(f"testing {operator} on {operand1_var!s} and {operand2_var!s}")
|
print(f"testing {operator} on {operand1_var!s} and {operand2_var!s}")
|
||||||
with pytest.raises(TypeError):
|
with pytest.raises(TypeError):
|
||||||
@ -1813,7 +1813,7 @@ def cv_fget(state: BaseState) -> int:
|
|||||||
([ComputedVar(fget=cv_fget)], {None: {"cv_fget"}}),
|
([ComputedVar(fget=cv_fget)], {None: {"cv_fget"}}),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_computed_var_deps(deps: List[Union[str, Var]], expected: Set[str]):
|
def test_computed_var_deps(deps: list[Union[str, Var]], expected: Set[str]):
|
||||||
@computed_var(deps=deps)
|
@computed_var(deps=deps)
|
||||||
def test_var(state) -> int:
|
def test_var(state) -> int:
|
||||||
return 1
|
return 1
|
||||||
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
from typing import Any, List
|
from typing import Any
|
||||||
|
|
||||||
import plotly.graph_objects as go
|
import plotly.graph_objects as go
|
||||||
import pytest
|
import pytest
|
||||||
@ -334,7 +334,7 @@ def test_format_route(route: str, format_case: bool, expected: bool):
|
|||||||
)
|
)
|
||||||
def test_format_match(
|
def test_format_match(
|
||||||
condition: str,
|
condition: str,
|
||||||
match_cases: List[List[Var]],
|
match_cases: list[list[Var]],
|
||||||
default: Var,
|
default: Var,
|
||||||
expected: str,
|
expected: str,
|
||||||
):
|
):
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Dict, List, Literal, Tuple, Union
|
from typing import Any, Dict, Literal, Tuple, Union
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ def test_validate_literal_error_msg(params, allowed_value_str, value_str):
|
|||||||
[
|
[
|
||||||
(int, Any, True),
|
(int, Any, True),
|
||||||
(Tuple[int], Any, True),
|
(Tuple[int], Any, True),
|
||||||
(List[int], Any, True),
|
(list[int], Any, True),
|
||||||
(int, int, True),
|
(int, int, True),
|
||||||
(int, object, True),
|
(int, object, True),
|
||||||
(int, Union[int, str], True),
|
(int, Union[int, str], True),
|
||||||
@ -38,7 +38,7 @@ def test_validate_literal_error_msg(params, allowed_value_str, value_str):
|
|||||||
(int, Union[str, float], False),
|
(int, Union[str, float], False),
|
||||||
(int, Union[float, str], False),
|
(int, Union[float, str], False),
|
||||||
(int, str, False),
|
(int, str, False),
|
||||||
(int, List[int], False),
|
(int, list[int], False),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_issubclass(
|
def test_issubclass(
|
||||||
@ -78,7 +78,7 @@ class ChildGenericDict(GenericDict):
|
|||||||
(str, False),
|
(str, False),
|
||||||
(float, False),
|
(float, False),
|
||||||
(Tuple[int], True),
|
(Tuple[int], True),
|
||||||
(List[int], True),
|
(list[int], True),
|
||||||
(Union[int, str], True),
|
(Union[int, str], True),
|
||||||
(Union[str, int], True),
|
(Union[str, int], True),
|
||||||
(Dict[str, int], True),
|
(Dict[str, int], True),
|
||||||
|
@ -61,7 +61,7 @@ def test_func():
|
|||||||
(float, False),
|
(float, False),
|
||||||
(bool, False),
|
(bool, False),
|
||||||
(List, True),
|
(List, True),
|
||||||
(List[int], True),
|
(list[int], True),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_is_generic_alias(cls: type, expected: bool):
|
def test_is_generic_alias(cls: type, expected: bool):
|
||||||
@ -90,16 +90,16 @@ def test_is_generic_alias(cls: type, expected: bool):
|
|||||||
(bool, int, True),
|
(bool, int, True),
|
||||||
(int, bool, False),
|
(int, bool, False),
|
||||||
(list, List, True),
|
(list, List, True),
|
||||||
(list, List[str], True), # this is wrong, but it's a limitation of the function
|
(list, list[str], True), # this is wrong, but it's a limitation of the function
|
||||||
(List, list, True),
|
(List, list, True),
|
||||||
(List[int], list, True),
|
(list[int], list, True),
|
||||||
(List[int], List, True),
|
(list[int], List, True),
|
||||||
(List[int], List[str], False),
|
(list[int], list[str], False),
|
||||||
(List[int], List[int], True),
|
(list[int], list[int], True),
|
||||||
(List[int], List[float], False),
|
(list[int], list[float], False),
|
||||||
(List[int], List[Union[int, float]], True),
|
(list[int], list[Union[int, float]], True),
|
||||||
(List[int], List[Union[float, str]], False),
|
(list[int], list[Union[float, str]], False),
|
||||||
(Union[int, float], List[Union[int, float]], False),
|
(Union[int, float], list[Union[int, float]], False),
|
||||||
(Union[int, float], Union[int, float, str], True),
|
(Union[int, float], Union[int, float, str], True),
|
||||||
(Union[int, float], Union[str, float], False),
|
(Union[int, float], Union[str, float], False),
|
||||||
(Dict[str, int], Dict[str, int], True),
|
(Dict[str, int], Dict[str, int], True),
|
||||||
@ -252,8 +252,8 @@ def test_is_backend_base_variable(
|
|||||||
(int, Union[int, float], True),
|
(int, Union[int, float], True),
|
||||||
(float, Union[int, float], True),
|
(float, Union[int, float], True),
|
||||||
(str, Union[int, float], False),
|
(str, Union[int, float], False),
|
||||||
(List[int], List[int], True),
|
(list[int], list[int], True),
|
||||||
(List[int], List[float], True),
|
(list[int], list[float], True),
|
||||||
(Union[int, float], Union[int, float], False),
|
(Union[int, float], Union[int, float], False),
|
||||||
(Union[int, Var[int]], Var[int], False),
|
(Union[int, Var[int]], Var[int], False),
|
||||||
(int, Any, True),
|
(int, Any, True),
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from typing import List, Mapping, Union
|
from typing import Mapping, Union
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@ -36,8 +36,8 @@ class ChildGenericDict(GenericDict):
|
|||||||
(1, int),
|
(1, int),
|
||||||
(1.0, float),
|
(1.0, float),
|
||||||
("a", str),
|
("a", str),
|
||||||
([1, 2, 3], List[int]),
|
([1, 2, 3], list[int]),
|
||||||
([1, 2.0, "a"], List[Union[int, float, str]]),
|
([1, 2.0, "a"], list[Union[int, float, str]]),
|
||||||
({"a": 1, "b": 2}, Mapping[str, int]),
|
({"a": 1, "b": 2}, Mapping[str, int]),
|
||||||
({"a": 1, 2: "b"}, Mapping[Union[int, str], Union[str, int]]),
|
({"a": 1, 2: "b"}, Mapping[Union[int, str], Union[str, int]]),
|
||||||
(CustomDict(), CustomDict),
|
(CustomDict(), CustomDict),
|
||||||
|
Loading…
Reference in New Issue
Block a user