1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-12-24 17:23:23 +03:00

fix(bridge/python): usage of dict instead of empty TypedDict to avoid types errors

We might in the future generate automatically from the TypeScript types, generate the Python types.
For the moment, it is not typed, so we use a dict.
This commit is contained in:
Théo LUDWIG 2024-02-25 20:57:02 +01:00
parent a16ab4abfa
commit 39cbd7114e
No known key found for this signature in database
GPG Key ID: ADFE5A563D718F3B
28 changed files with 54 additions and 183 deletions

View File

@ -4,7 +4,7 @@ from ..widget_component import WidgetComponent
class ButtonProps(TypedDict, total=False):
type: Optional[Union[Literal['button'], Literal['submit'], Literal['reset']]]
iconaName: Optional[str]
iconName: Optional[str]
iconPosition: Optional[Union[Literal['left'], Literal['right']]]
secondary: Optional[bool]
danger: Optional[bool]

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class CardProps(TypedDict, total=False):
pass
class Card(WidgetComponent[CardProps]):
def __init__(self, props: CardProps):
class Card(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class CheckboxProps(TypedDict, total=False):
pass
class Checkbox(WidgetComponent[CheckboxProps]):
def __init__(self, props: CheckboxProps):
class Checkbox(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class CircularProgressProps(TypedDict, total=False):
pass
class CircularProgress(WidgetComponent[CircularProgressProps]):
def __init__(self, props: CircularProgressProps):
class CircularProgress(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class FlexboxProps(TypedDict, total=False):
pass
class Flexbox(WidgetComponent[FlexboxProps]):
def __init__(self, props: FlexboxProps):
class Flexbox(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class IconProps(TypedDict, total=False):
pass
class Icon(WidgetComponent[IconProps]):
def __init__(self, props: IconProps):
class Icon(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class IconButtonProps(TypedDict, total=False):
pass
class IconButton(WidgetComponent[IconButtonProps]):
def __init__(self, props: IconButtonProps):
class IconButton(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class ImageProps(TypedDict, total=False):
pass
class Image(WidgetComponent[ImageProps]):
def __init__(self, props: ImageProps):
class Image(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class LinkProps(TypedDict, total=False):
pass
class Link(WidgetComponent[LinkProps]):
def __init__(self, props: LinkProps):
class Link(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class ListProps(TypedDict, total=False):
pass
class List(WidgetComponent[ListProps]):
def __init__(self, props: ListProps):
class List(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class ListHeaderProps(TypedDict, total=False):
pass
class ListHeader(WidgetComponent[ListHeaderProps]):
def __init__(self, props: ListHeaderProps):
class ListHeader(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class ListItemProps(TypedDict, total=False):
pass
class ListItem(WidgetComponent[ListItemProps]):
def __init__(self, props: ListItemProps):
class ListItem(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class LoaderProps(TypedDict, total=False):
pass
class Loader(WidgetComponent[LoaderProps]):
def __init__(self, props: LoaderProps):
class Loader(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class ProgressProps(TypedDict, total=False):
pass
class Progress(WidgetComponent[ProgressProps]):
def __init__(self, props: ProgressProps):
class Progress(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class RadioProps(TypedDict, total=False):
pass
class Radio(WidgetComponent[RadioProps]):
def __init__(self, props: RadioProps):
class Radio(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class RadioGroupProps(TypedDict, total=False):
pass
class RadioGroup(WidgetComponent[RadioGroupProps]):
def __init__(self, props: RadioGroupProps):
class RadioGroup(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class ScrollContainerProps(TypedDict, total=False):
pass
class ScrollContainer(WidgetComponent[ScrollContainerProps]):
def __init__(self, props: ScrollContainerProps):
class ScrollContainer(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class SelectProps(TypedDict, total=False):
pass
class Select(WidgetComponent[SelectProps]):
def __init__(self, props: SelectProps):
class Select(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class SelectOptionProps(TypedDict, total=False):
pass
class SelectOption(WidgetComponent[SelectOptionProps]):
def __init__(self, props: SelectOptionProps):
class SelectOption(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class SliderProps(TypedDict, total=False):
pass
class Slider(WidgetComponent[SliderProps]):
def __init__(self, props: SliderProps):
class Slider(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class SwitchProps(TypedDict, total=False):
pass
class Switch(WidgetComponent[SwitchProps]):
def __init__(self, props: SwitchProps):
class Switch(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class TabProps(TypedDict, total=False):
pass
class Tab(WidgetComponent[TabProps]):
def __init__(self, props: TabProps):
class Tab(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class TabContentProps(TypedDict, total=False):
pass
class TabContent(WidgetComponent[TabContentProps]):
def __init__(self, props: TabContentProps):
class TabContent(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class TabGroupProps(TypedDict, total=False):
pass
class TabGroup(WidgetComponent[TabGroupProps]):
def __init__(self, props: TabGroupProps):
class TabGroup(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class TabListProps(TypedDict, total=False):
pass
class TabList(WidgetComponent[TabListProps]):
def __init__(self, props: TabListProps):
class TabList(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class TextProps(TypedDict, total=False):
pass
class Text(WidgetComponent[TextProps]):
def __init__(self, props: TextProps):
class Text(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -1,11 +1,6 @@
from typing import TypedDict
from ..widget_component import WidgetComponent
class TextInputProps(TypedDict, total=False):
pass
class TextInput(WidgetComponent[TextInputProps]):
def __init__(self, props: TextInputProps):
class TextInput(WidgetComponent[dict]):
def __init__(self, props: dict):
super().__init__(props)

View File

@ -6,6 +6,7 @@ from bridges.python.src.sdk.aurora.flexbox import Flexbox
from bridges.python.src.sdk.widget import Widget, WidgetOptions
from bridges.python.src.sdk.widget_component import WidgetComponent
class NumberWidgetParams(TypedDict):
random_number: int