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
- run: |
poetry run python scripts/pyi_generator.py
if git diff; then
echo "No diffs - AOK!"
else
if [[ $(git status --porcelain) ]]; then
git status
git diff
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
.coverage
.coverage.*
.venv
venv

View File

@ -27,6 +27,7 @@ class IconButton(Text):
is_round: Optional[Union[Var[bool], bool]] = None,
spinner: 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,
key: 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
spinner: Replace the spinner component when isLoading is set to true
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.
key: A unique key 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_required: Optional[Union[Var[bool], bool]] = None,
as_: Optional[Union[Var[str], str]] = None,
no_of_lines: Optional[Union[Var[int], int]] = None,
style: Optional[Style] = None,
key: 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_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>`.
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.
key: A unique key for the component.
id: The id for the component.

View File

@ -134,6 +134,7 @@ class Option(Text):
*children,
value: Optional[Union[Var[Any], Any]] = None,
as_: Optional[Union[Var[str], str]] = None,
no_of_lines: Optional[Union[Var[int], int]] = None,
style: Optional[Style] = None,
key: Optional[Any] = None,
id: Optional[Any] = None,
@ -194,6 +195,7 @@ class Option(Text):
Args:
*children: The children of the component.
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.
key: A unique key for the component.
id: The id for the component.

View File

@ -278,7 +278,7 @@ class Bar(Cartesian):
max_bar_size: Var[int]
# Valid children components
valid_children: List[str] = ["Cell", "LabelList", "ErrorBar"]
_valid_children: List[str] = ["Cell", "LabelList", "ErrorBar"]
class Line(Cartesian):
@ -313,7 +313,7 @@ class Line(Cartesian):
connect_nulls: Var[bool]
# Valid children components
valid_children: List[str] = ["LabelList", "ErrorBar"]
_valid_children: List[str] = ["LabelList", "ErrorBar"]
class Scatter(Cartesian):
@ -345,7 +345,7 @@ class Scatter(Cartesian):
name: Var[Union[str, int]]
# Valid children components.
valid_children: List[str] = ["LabelList", "ErrorBar"]
_valid_children: List[str] = ["LabelList", "ErrorBar"]
class Funnel(Cartesian):
@ -368,7 +368,7 @@ class Funnel(Cartesian):
animation_easing: Var[LiteralAnimationEasing]
# Valid children components
valid_children: List[str] = ["LabelList", "Cell"]
_valid_children: List[str] = ["LabelList", "Cell"]
class ErrorBar(Recharts):
@ -427,7 +427,7 @@ class ReferenceLine(Reference):
stroke_width: Var[int]
# Valid children components
valid_children: List[str] = ["Label"]
_valid_children: List[str] = ["Label"]
class ReferenceDot(Reference):
@ -438,7 +438,7 @@ class ReferenceDot(Reference):
alias = "RechartsReferenceDot"
# Valid children components
valid_children: List[str] = ["Label"]
_valid_children: List[str] = ["Label"]
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""Get the event triggers that pass the component's value to the handler.
@ -497,7 +497,7 @@ class ReferenceArea(Recharts):
is_front: Var[bool]
# Valid children components
valid_children: List[str] = ["Label"]
_valid_children: List[str] = ["Label"]
class Grid(Recharts):

View File

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

View File

@ -65,7 +65,7 @@ class Pie(Recharts):
label_line: Var[bool]
# Valid children components
valid_children: List[str] = ["Cell", "LabelList"]
_valid_children: List[str] = ["Cell", "LabelList"]
# fill color
fill: Var[str]
@ -130,7 +130,7 @@ class Radar(Recharts):
animation_easing: Var[LiteralAnimationEasing]
# Valid children components
valid_children: List[str] = ["LabelList"]
_valid_children: List[str] = ["LabelList"]
class RadialBar(Recharts):
@ -156,7 +156,7 @@ class RadialBar(Recharts):
background: Var[bool]
# Valid children components
valid_children: List[str] = ["LabelList"]
_valid_children: List[str] = ["LabelList"]
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""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]
# Valid children components
valid_children: List[str] = ["Label"]
_valid_children: List[str] = ["Label"]
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""Get the event triggers that pass the component's value to the handler.
@ -262,7 +262,7 @@ class PolarGrid(Recharts):
grid_type: Var[LiteralGridType]
# Valid children components
valid_children: List[str] = ["RadarChart", "RadiarBarChart"]
_valid_children: List[str] = ["RadarChart", "RadiarBarChart"]
class PolarRadiusAxis(Recharts):
@ -306,7 +306,7 @@ class PolarRadiusAxis(Recharts):
scale: Var[LiteralScale]
# Valid children components
valid_children: List[str] = ["Label"]
_valid_children: List[str] = ["Label"]
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""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.event import EventChain, EventHandler, EventSpec
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.libs.chakra import ChakraComponent, LiteralAlertDialogSize
from reflex.components.libs.chakra import ChakraComponent
from reflex.components.media import Icon
from reflex.vars import Var
ModalSizes = Literal["xs", "sm", "md", "lg", "xl", "full"]
class Modal(ChakraComponent):
def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ...
@overload
@ -37,23 +39,8 @@ class Modal(ChakraComponent):
return_focus_on_close: Optional[Union[Var[bool], bool]] = None,
size: Optional[
Union[
Var[
Literal[
"sm",
"md",
"lg",
"xs",
"2xl",
"full",
"3xl",
"4xl",
"5xl",
"6xl",
]
],
Literal[
"sm", "md", "lg", "xs", "2xl", "full", "3xl", "4xl", "5xl", "6xl"
],
Var[Literal["xs", "sm", "md", "lg", "xl", "full"]],
Literal["xs", "sm", "md", "lg", "xl", "full"],
]
] = 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
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.
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**
style: The style of the component.
key: A unique key for the component.

View File

@ -17,6 +17,7 @@ class Text(ChakraComponent):
cls,
*children,
as_: Optional[Union[Var[str], str]] = None,
no_of_lines: Optional[Union[Var[int], int]] = None,
style: Optional[Style] = None,
key: Optional[Any] = None,
id: Optional[Any] = None,
@ -75,6 +76,7 @@ class Text(ChakraComponent):
Args:
*children: The children of the component.
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.
key: A unique key for the component.
id: The id for the component.

View File

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