check_generated_pyi: fix diff checking (#2029)

This commit is contained in:
Masen Furer 2023-11-17 15:21:52 -08:00 committed by GitHub
parent c3e652b8c1
commit 8e7d4819ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 48 additions and 49 deletions

View File

@ -26,8 +26,11 @@ jobs:
create-venv-at-path: .venv create-venv-at-path: .venv
- run: | - run: |
poetry run python scripts/pyi_generator.py poetry run python scripts/pyi_generator.py
if git diff; then if [[ $(git status --porcelain) ]]; then
echo "No diffs - AOK!" git status
else git diff
echo "ERROR: pyi_generator.py output is out of date. Please run scripts/pyi_generator.py and commit the changes." echo "ERROR: pyi_generator.py output is out of date. Please run scripts/pyi_generator.py and commit the changes."
fi exit 1
else
echo "No diffs - AOK!"
fi

1
.gitignore vendored
View File

@ -6,4 +6,5 @@ examples/
.vscode .vscode
.coverage .coverage
.coverage.* .coverage.*
.venv
venv venv

View File

@ -27,6 +27,7 @@ class IconButton(Text):
is_round: Optional[Union[Var[bool], bool]] = None, is_round: Optional[Union[Var[bool], bool]] = None,
spinner: Optional[Union[Var[str], str]] = None, spinner: Optional[Union[Var[str], str]] = None,
as_: Optional[Union[Var[str], str]] = None, as_: Optional[Union[Var[str], str]] = None,
no_of_lines: Optional[Union[Var[int], int]] = 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,
@ -93,6 +94,7 @@ class IconButton(Text):
is_round: If true, the button will be perfectly round. Else, it'll be slightly round is_round: If true, the button will be perfectly round. Else, it'll be slightly round
spinner: Replace the spinner component when isLoading is set to true spinner: Replace the spinner component when isLoading is set to true
as_: Override the tag. The default tag is `<p>`. as_: Override the tag. The default tag is `<p>`.
no_of_lines: Truncate text after a specific number of lines. It will render an ellipsis when the text exceeds the width of the viewport or max_width prop.
style: The style of the component. style: The style of the component.
key: A unique key for the component. key: A unique key for the component.
id: The id for the component. id: The id for the component.

View File

@ -118,6 +118,7 @@ class Radio(Text):
is_read_only: Optional[Union[Var[bool], bool]] = None, is_read_only: Optional[Union[Var[bool], bool]] = None,
is_required: Optional[Union[Var[bool], bool]] = None, is_required: Optional[Union[Var[bool], bool]] = None,
as_: Optional[Union[Var[str], str]] = None, as_: Optional[Union[Var[str], str]] = None,
no_of_lines: Optional[Union[Var[int], int]] = 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,
@ -187,6 +188,7 @@ class Radio(Text):
is_read_only: If true, the radio will be read-only is_read_only: If true, the radio will be read-only
is_required: If true, the radio button will be required. This also sets `aria-required` to true. is_required: If true, the radio button will be required. This also sets `aria-required` to true.
as_: Override the tag. The default tag is `<p>`. as_: Override the tag. The default tag is `<p>`.
no_of_lines: Truncate text after a specific number of lines. It will render an ellipsis when the text exceeds the width of the viewport or max_width prop.
style: The style of the component. style: The style of the component.
key: A unique key for the component. key: A unique key for the component.
id: The id for the component. id: The id for the component.

View File

@ -134,6 +134,7 @@ class Option(Text):
*children, *children,
value: Optional[Union[Var[Any], Any]] = None, value: Optional[Union[Var[Any], Any]] = None,
as_: Optional[Union[Var[str], str]] = None, as_: Optional[Union[Var[str], str]] = None,
no_of_lines: Optional[Union[Var[int], int]] = 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,
@ -194,6 +195,7 @@ class Option(Text):
Args: Args:
*children: The children of the component. *children: The children of the component.
as_: Override the tag. The default tag is `<p>`. as_: Override the tag. The default tag is `<p>`.
no_of_lines: Truncate text after a specific number of lines. It will render an ellipsis when the text exceeds the width of the viewport or max_width prop.
style: The style of the component. style: The style of the component.
key: A unique key for the component. key: A unique key for the component.
id: The id for the component. id: The id for the component.

View File

@ -278,7 +278,7 @@ class Bar(Cartesian):
max_bar_size: Var[int] max_bar_size: Var[int]
# 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):
@ -313,7 +313,7 @@ class Line(Cartesian):
connect_nulls: Var[bool] connect_nulls: Var[bool]
# Valid children components # Valid children components
valid_children: List[str] = ["LabelList", "ErrorBar"] _valid_children: List[str] = ["LabelList", "ErrorBar"]
class Scatter(Cartesian): class Scatter(Cartesian):
@ -345,7 +345,7 @@ class Scatter(Cartesian):
name: Var[Union[str, int]] name: Var[Union[str, int]]
# Valid children components. # Valid children components.
valid_children: List[str] = ["LabelList", "ErrorBar"] _valid_children: List[str] = ["LabelList", "ErrorBar"]
class Funnel(Cartesian): class Funnel(Cartesian):
@ -368,7 +368,7 @@ class Funnel(Cartesian):
animation_easing: Var[LiteralAnimationEasing] animation_easing: Var[LiteralAnimationEasing]
# Valid children components # Valid children components
valid_children: List[str] = ["LabelList", "Cell"] _valid_children: List[str] = ["LabelList", "Cell"]
class ErrorBar(Recharts): class ErrorBar(Recharts):
@ -427,7 +427,7 @@ class ReferenceLine(Reference):
stroke_width: Var[int] stroke_width: Var[int]
# Valid children components # Valid children components
valid_children: List[str] = ["Label"] _valid_children: List[str] = ["Label"]
class ReferenceDot(Reference): class ReferenceDot(Reference):
@ -438,7 +438,7 @@ class ReferenceDot(Reference):
alias = "RechartsReferenceDot" alias = "RechartsReferenceDot"
# Valid children components # Valid children components
valid_children: List[str] = ["Label"] _valid_children: List[str] = ["Label"]
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.
@ -497,7 +497,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):

View File

@ -130,7 +130,7 @@ class AreaChart(ChartBase):
stack_offset: Var[LiteralStackOffset] stack_offset: Var[LiteralStackOffset]
# Valid children components # Valid children components
valid_children: List[str] = [ _valid_children: List[str] = [
"XAxis", "XAxis",
"YAxis", "YAxis",
"ReferenceArea", "ReferenceArea",
@ -170,7 +170,7 @@ class BarChart(ChartBase):
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",
@ -192,7 +192,7 @@ class LineChart(ChartBase):
alias = "RechartsLineChart" alias = "RechartsLineChart"
# Valid children components # Valid children components
valid_children: List[str] = [ _valid_children: List[str] = [
"XAxis", "XAxis",
"YAxis", "YAxis",
"ReferenceArea", "ReferenceArea",
@ -229,7 +229,7 @@ class ComposedChart(ChartBase):
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",
@ -253,7 +253,7 @@ class PieChart(ChartBase):
alias = "RechartsPieChart" alias = "RechartsPieChart"
# Valid children components # Valid children components
valid_children: List[str] = [ _valid_children: List[str] = [
"PolarAngleAxis", "PolarAngleAxis",
"PolarRadiusAxis", "PolarRadiusAxis",
"PolarGrid", "PolarGrid",
@ -301,7 +301,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",
@ -359,7 +359,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",
@ -390,7 +390,7 @@ class ScatterChart(ChartBase):
alias = "RechartsScatterChart" alias = "RechartsScatterChart"
# Valid children components # Valid children components
valid_children: List[str] = [ _valid_children: List[str] = [
"XAxis", "XAxis",
"YAxis", "YAxis",
"ZAxis", "ZAxis",
@ -455,7 +455,7 @@ class FunnelChart(RechartsCharts):
layout: Var[str] layout: Var[str]
# Valid children components # Valid children components
valid_children: List[str] = ["Legend", "GraphingTooltip", "Funnel"] _valid_children: List[str] = ["Legend", "GraphingTooltip", "Funnel"]
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.

View File

@ -42,7 +42,7 @@ class ResponsiveContainer(Recharts):
debounce: Var[int] debounce: Var[int]
# Valid children components # Valid children components
valid_children: List[str] = [ _valid_children: List[str] = [
"AreaChart", "AreaChart",
"BarChart", "BarChart",
"LineChart", "LineChart",

View File

@ -65,7 +65,7 @@ class Pie(Recharts):
label_line: Var[bool] label_line: Var[bool]
# Valid children components # Valid children components
valid_children: List[str] = ["Cell", "LabelList"] _valid_children: List[str] = ["Cell", "LabelList"]
# fill color # fill color
fill: Var[str] fill: Var[str]
@ -130,7 +130,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"]
class RadialBar(Recharts): class RadialBar(Recharts):
@ -156,7 +156,7 @@ class RadialBar(Recharts):
background: Var[bool] background: Var[bool]
# 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.
@ -215,7 +215,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"]
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 PolarGrid(Recharts):
grid_type: Var[LiteralGridType] grid_type: Var[LiteralGridType]
# Valid children components # Valid children components
valid_children: List[str] = ["RadarChart", "RadiarBarChart"] _valid_children: List[str] = ["RadarChart", "RadiarBarChart"]
class PolarRadiusAxis(Recharts): class PolarRadiusAxis(Recharts):
@ -306,7 +306,7 @@ 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"]
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.

View File

@ -7,12 +7,14 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.vars import Var, BaseVar, ComputedVar from reflex.vars import Var, BaseVar, ComputedVar
from reflex.event import EventChain, EventHandler, EventSpec from reflex.event import EventChain, EventHandler, EventSpec
from reflex.style import Style from reflex.style import Style
from typing import Any, Optional, Union from typing import Any, Literal, Optional, Union
from reflex.components.component import Component from reflex.components.component import Component
from reflex.components.libs.chakra import ChakraComponent, LiteralAlertDialogSize from reflex.components.libs.chakra import ChakraComponent
from reflex.components.media import Icon from reflex.components.media import Icon
from reflex.vars import Var from reflex.vars import Var
ModalSizes = Literal["xs", "sm", "md", "lg", "xl", "full"]
class Modal(ChakraComponent): class Modal(ChakraComponent):
def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ... def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ...
@overload @overload
@ -37,23 +39,8 @@ class Modal(ChakraComponent):
return_focus_on_close: Optional[Union[Var[bool], bool]] = None, return_focus_on_close: Optional[Union[Var[bool], bool]] = None,
size: Optional[ size: Optional[
Union[ Union[
Var[ Var[Literal["xs", "sm", "md", "lg", "xl", "full"]],
Literal[ Literal["xs", "sm", "md", "lg", "xl", "full"],
"sm",
"md",
"lg",
"xs",
"2xl",
"full",
"3xl",
"4xl",
"5xl",
"6xl",
]
],
Literal[
"sm", "md", "lg", "xs", "2xl", "full", "3xl", "4xl", "5xl", "6xl"
],
] ]
] = None, ] = None,
use_inert: Optional[Union[Var[bool], bool]] = None, use_inert: Optional[Union[Var[bool], bool]] = None,
@ -141,7 +128,7 @@ class Modal(ChakraComponent):
motion_preset: The transition that should be used for the modal motion_preset: The transition that should be used for the modal
preserve_scroll_bar_gap: If true, a `padding-right` will be applied to the body element that's equal to the width of the scrollbar. This can help prevent some unpleasant flickering effect and content adjustment when the modal opens preserve_scroll_bar_gap: If true, a `padding-right` will be applied to the body element that's equal to the width of the scrollbar. This can help prevent some unpleasant flickering effect and content adjustment when the modal opens
return_focus_on_close: If true, the modal will return focus to the element that triggered it when it closes. return_focus_on_close: If true, the modal will return focus to the element that triggered it when it closes.
size: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "full" size: "xs" | "sm" | "md" | "lg" | "xl" | "full"
use_inert: A11y: If true, the siblings of the modal will have `aria-hidden` set to true so that screen readers can only see the modal. This is commonly known as making the other elements **inert** use_inert: A11y: If true, the siblings of the modal will have `aria-hidden` set to true so that screen readers can only see the modal. This is commonly known as making the other elements **inert**
style: The style of the component. style: The style of the component.
key: A unique key for the component. key: A unique key for the component.

View File

@ -17,6 +17,7 @@ class Text(ChakraComponent):
cls, cls,
*children, *children,
as_: Optional[Union[Var[str], str]] = None, as_: Optional[Union[Var[str], str]] = None,
no_of_lines: Optional[Union[Var[int], int]] = 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,
@ -75,6 +76,7 @@ class Text(ChakraComponent):
Args: Args:
*children: The children of the component. *children: The children of the component.
as_: Override the tag. The default tag is `<p>`. as_: Override the tag. The default tag is `<p>`.
no_of_lines: Truncate text after a specific number of lines. It will render an ellipsis when the text exceeds the width of the viewport or max_width prop.
style: The style of the component. style: The style of the component.
key: A unique key for the component. key: A unique key for the component.
id: The id for the component. id: The id for the component.

View File

@ -38,13 +38,13 @@ EXCLUDED_PROPS = [
"alias", "alias",
"children", "children",
"event_triggers", "event_triggers",
"invalid_children",
"library", "library",
"lib_dependencies", "lib_dependencies",
"tag", "tag",
"is_default", "is_default",
"special_props", "special_props",
"valid_children", "_invalid_children",
"_valid_children",
] ]
DEFAULT_TYPING_IMPORTS = { DEFAULT_TYPING_IMPORTS = {