Skip to content

Commit

Permalink
add ERA rules to detect commented out code (#4472)
Browse files Browse the repository at this point in the history
* add eradicate rules for commented out code

* remove output change

* fix pyi messed up indent

* fix pyi again

* fix layout docstring

* fix pyi_generator to remove commented out props from docs

* fix pyi_generator and regenerate some pyi

* fix double strip

* update all pyi

* try to fix stuff in pyi_gen

* whatever

* remove that maybe? i don't know

* fix that shit?

* fix more shit, idk

* better not see you ever again, extra line
  • Loading branch information
Lendemor authored Dec 12, 2024
1 parent e4b5755 commit fb444ad
Show file tree
Hide file tree
Showing 91 changed files with 272 additions and 349 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ build-backend = "poetry.core.masonry.api"
[tool.ruff]
target-version = "py39"
lint.isort.split-on-trailing-comma = false
lint.select = ["B", "D", "E", "F", "I", "SIM", "W", "RUF", "FURB"]
lint.select = ["B", "D", "E", "F", "I", "SIM", "W", "RUF", "FURB", "ERA"]
lint.ignore = ["B008", "D205", "E501", "F403", "SIM115", "RUF006", "RUF012"]
lint.pydocstyle.convention = "google"

Expand Down
1 change: 0 additions & 1 deletion reflex/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,6 @@ def get_compilation_time() -> str:

def _submit_work(fn, *args, **kwargs):
f = executor.submit(fn, *args, **kwargs)
# f = executor.apipe(fn, *args, **kwargs)
result_futures.append(f)

# Compile the pre-compiled pages.
Expand Down
1 change: 0 additions & 1 deletion reflex/components/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,6 @@ def get_event_triggers(
Returns:
The event triggers.
"""
default_triggers: Dict[str, types.ArgsSpec | Sequence[types.ArgsSpec]] = {
EventTriggers.ON_FOCUS: no_args_event_spec,
Expand Down
2 changes: 1 addition & 1 deletion reflex/components/core/banner.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class ConnectionPulser(Div):
"""Create a connection pulser component.
Args:
access_key: Provides a hint for generating a keyboard shortcut for the current element.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
Expand Down
2 changes: 1 addition & 1 deletion reflex/components/core/html.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Html(Div):
Args:
*children: The children of the component.
dangerouslySetInnerHTML: The HTML to render.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
Expand Down
23 changes: 1 addition & 22 deletions reflex/components/datadisplay/dataeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,6 @@ class GridColumnIcons(Enum):
VideoUri = "video_uri"


# @serializer
# def serialize_gridcolumn_icon(icon: GridColumnIcons) -> str:
# """Serialize grid column icon.

# Args:
# icon: the Icon to serialize.

# Returns:
# The serialized value.
# """
# return "prefix" + str(icon)


# class DataEditorColumn(Base):
# """Column."""

# title: str
# id: Optional[str] = None
# type_: str = "str"


class DataEditorTheme(Base):
"""The theme for the DataEditor component."""

Expand Down Expand Up @@ -229,7 +208,7 @@ class DataEditor(NoSSRComponent):
header_height: Var[int]

# Additional header icons:
# header_icons: Var[Any] # (TODO: must be a map of name: svg)
# header_icons: Var[Any] # (TODO: must be a map of name: svg) #noqa: ERA001

# The maximum width a column can be automatically sized to.
max_column_auto_width: Var[int]
Expand Down
2 changes: 1 addition & 1 deletion reflex/components/datadisplay/dataeditor.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class DataEditor(NoSSRComponent):
freeze_columns: The number of columns which should remain in place when scrolling horizontally. Doesn't include rowMarkers.
group_header_height: Controls the header of the group header row.
header_height: Controls the height of the header row.
max_column_auto_width: Additional header icons: header_icons: Var[Any] # (TODO: must be a map of name: svg) The maximum width a column can be automatically sized to.
max_column_auto_width: The maximum width a column can be automatically sized to.
max_column_width: The maximum width a column can be resized to.
min_column_width: The minimum width a column can be resized to.
row_height: Determins the height of each row.
Expand Down
14 changes: 7 additions & 7 deletions reflex/components/datadisplay/shiki_code_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,17 +490,17 @@ class ShikiJsTransformer(ShikiBaseTransformers):
},
# White Space
# ".tab, .space": {
# "position": "relative",
# "position": "relative", # noqa: ERA001
# },
# ".tab::before": {
# "content": "'⇥'",
# "position": "absolute",
# "opacity": "0.3",
# "content": "'⇥'", # noqa: ERA001
# "position": "absolute", # noqa: ERA001
# "opacity": "0.3",# noqa: ERA001
# },
# ".space::before": {
# "content": "'·'",
# "position": "absolute",
# "opacity": "0.3",
# "content": "'·'", # noqa: ERA001
# "position": "absolute", # noqa: ERA001
# "opacity": "0.3", # noqa: ERA001
# },
}
)
Expand Down
4 changes: 2 additions & 2 deletions reflex/components/el/elements/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
"""Base classes."""

from typing import Union

Expand All @@ -9,7 +9,7 @@
class BaseHTML(Element):
"""Base class for common attributes."""

# Provides a hint for generating a keyboard shortcut for the current element.
# Provides a hint for generating a keyboard shortcut for the current element.
access_key: Var[Union[str, int, bool]]

# Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
Expand Down
2 changes: 1 addition & 1 deletion reflex/components/el/elements/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class BaseHTML(Element):
Args:
*children: The children of the component.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
Expand Down
5 changes: 1 addition & 4 deletions reflex/components/el/elements/forms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
"""Forms classes."""

from __future__ import annotations

Expand Down Expand Up @@ -84,7 +84,6 @@ class Datalist(BaseHTML):
"""Display the datalist element."""

tag = "datalist"
# No unique attributes, only common ones are inherited


class Fieldset(Element):
Expand Down Expand Up @@ -250,7 +249,6 @@ def _get_form_refs(self) -> Dict[str, Any]:
_js_expr=f"getRefValue({ref_var!s})",
_var_data=VarData.merge(ref_var._get_all_var_data()),
)
# print(repr(form_refs))
return form_refs

def _get_vars(self, include_children: bool = True) -> Iterator[Var]:
Expand Down Expand Up @@ -401,7 +399,6 @@ class Legend(BaseHTML):
"""Display the legend element."""

tag = "legend"
# No unique attributes, only common ones are inherited


class Meter(BaseHTML):
Expand Down
26 changes: 13 additions & 13 deletions reflex/components/el/elements/forms.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class Button(BaseHTML):
name: Name of the button, used when sending form data
type: Type of the button (submit, reset, or button)
value: Value of the button, used when sending form data
access_key: Provides a hint for generating a keyboard shortcut for the current element.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
Expand Down Expand Up @@ -189,7 +189,7 @@ class Datalist(BaseHTML):
Args:
*children: The children of the component.
access_key: No unique attributes, only common ones are inherited Provides a hint for generating a keyboard shortcut for the current element.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
Expand Down Expand Up @@ -367,7 +367,7 @@ class Form(BaseHTML):
reset_on_submit: If true, the form will be cleared after submit.
handle_submit_unique_name: The name used to make this form's submit handler function unique.
on_submit: Fired when the form is submitted
access_key: Provides a hint for generating a keyboard shortcut for the current element.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
Expand Down Expand Up @@ -554,7 +554,7 @@ class Input(BaseHTML):
on_blur: Fired when the input loses focus
on_key_down: Fired when a key is pressed down
on_key_up: Fired when a key is released
access_key: Provides a hint for generating a keyboard shortcut for the current element.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
Expand Down Expand Up @@ -644,7 +644,7 @@ class Label(BaseHTML):
*children: The children of the component.
html_for: ID of a form control with which the label is associated
form: Associates the label with a form (by id)
access_key: Provides a hint for generating a keyboard shortcut for the current element.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
Expand Down Expand Up @@ -730,7 +730,7 @@ class Legend(BaseHTML):
Args:
*children: The children of the component.
access_key: No unique attributes, only common ones are inherited Provides a hint for generating a keyboard shortcut for the current element.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
Expand Down Expand Up @@ -830,7 +830,7 @@ class Meter(BaseHTML):
min: Minimum value of the range
optimum: Optimum value in the range
value: Current value of the meter
access_key: Provides a hint for generating a keyboard shortcut for the current element.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
Expand Down Expand Up @@ -920,7 +920,7 @@ class Optgroup(BaseHTML):
*children: The children of the component.
disabled: Disables the optgroup
label: Label for the optgroup
access_key: Provides a hint for generating a keyboard shortcut for the current element.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
Expand Down Expand Up @@ -1014,7 +1014,7 @@ class Option(BaseHTML):
label: Label for the option, if the text is not the label
selected: Indicates that the option is initially selected
value: Value to be sent as form data
access_key: Provides a hint for generating a keyboard shortcut for the current element.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
Expand Down Expand Up @@ -1106,7 +1106,7 @@ class Output(BaseHTML):
html_for: Associates the output with one or more elements (by their IDs)
form: Associates the output with a form (by id)
name: Name of the output element for form submission
access_key: Provides a hint for generating a keyboard shortcut for the current element.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
Expand Down Expand Up @@ -1198,7 +1198,7 @@ class Progress(BaseHTML):
form: Associates the progress element with a form (by id)
max: Maximum value of the progress indicator
value: Current value of the progress indicator
access_key: Provides a hint for generating a keyboard shortcut for the current element.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
Expand Down Expand Up @@ -1306,7 +1306,7 @@ class Select(BaseHTML):
required: Indicates that the select control must have a selected option
size: Number of visible options in a drop-down list
on_change: Fired when the select value changes
access_key: Provides a hint for generating a keyboard shortcut for the current element.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
Expand Down Expand Up @@ -1459,7 +1459,7 @@ class Textarea(BaseHTML):
on_blur: Fired when the input loses focus
on_key_down: Fired when a key is pressed down
on_key_up: Fired when a key is released
access_key: Provides a hint for generating a keyboard shortcut for the current element.
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
Expand Down
2 changes: 1 addition & 1 deletion reflex/components/el/elements/inline.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
"""Inline classes."""

from typing import Union

Expand Down
Loading

0 comments on commit fb444ad

Please sign in to comment.