add eradicate rules for commented out code

This commit is contained in:
Lendemor 2024-12-03 22:22:46 +01:00
parent c721227a06
commit cb9c5e2a1b
36 changed files with 138 additions and 210 deletions

View File

@ -92,8 +92,9 @@ build-backend = "poetry.core.masonry.api"
[tool.ruff] [tool.ruff]
target-version = "py39" target-version = "py39"
output-format="concise"
lint.isort.split-on-trailing-comma = false lint.isort.split-on-trailing-comma = false
lint.select = ["B", "D", "E", "F", "I", "SIM", "W"] lint.select = ["B", "D", "E", "F", "I", "SIM", "W", "ERA"]
lint.ignore = ["B008", "D205", "E501", "F403", "SIM115"] lint.ignore = ["B008", "D205", "E501", "F403", "SIM115"]
lint.pydocstyle.convention = "google" lint.pydocstyle.convention = "google"

View File

@ -965,7 +965,6 @@ class App(MiddlewareMixin, LifespanMixin):
def _submit_work(fn, *args, **kwargs): def _submit_work(fn, *args, **kwargs):
f = executor.submit(fn, *args, **kwargs) f = executor.submit(fn, *args, **kwargs)
# f = executor.apipe(fn, *args, **kwargs)
result_futures.append(f) result_futures.append(f)
# Compile the pre-compiled pages. # Compile the pre-compiled pages.

View File

@ -51,27 +51,6 @@ class GridColumnIcons(Enum):
VideoUri = "video_uri" 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): class DataEditorTheme(Base):
"""The theme for the DataEditor component.""" """The theme for the DataEditor component."""
@ -229,7 +208,7 @@ class DataEditor(NoSSRComponent):
header_height: Var[int] header_height: Var[int]
# Additional header icons: # 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. # The maximum width a column can be automatically sized to.
max_column_auto_width: Var[int] max_column_auto_width: Var[int]

View File

@ -275,65 +275,65 @@ class DataEditor(NoSSRComponent):
"""Create the DataEditor component. """Create the DataEditor component.
Args: Args:
*children: The children of the data editor. *children: The children of the data editor.
rows: Number of rows. rows: Number of rows.
columns: Headers of the columns for the data grid. columns: Headers of the columns for the data grid.
data: The data. data: The data.
get_cell_content: The name of the callback used to find the data to display. get_cell_content: The name of the callback used to find the data to display.
get_cells_for_selection: Allow selection for copying. get_cells_for_selection: Allow selection for copying.
on_paste: Allow paste. on_paste: Allow paste.
draw_focus_ring: Controls the drawing of the focus ring. draw_focus_ring: Controls the drawing of the focus ring.
fixed_shadow_x: Enables or disables the overlay shadow when scrolling horizontally. fixed_shadow_x: Enables or disables the overlay shadow when scrolling horizontally.
fixed_shadow_y: Enables or disables the overlay shadow when scrolling vertically. fixed_shadow_y: Enables or disables the overlay shadow when scrolling vertically.
freeze_columns: The number of columns which should remain in place when scrolling horizontally. Doesn't include rowMarkers. 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. group_header_height: Controls the header of the group header row.
header_height: Controls the height of the 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: Additional header icons: 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_width: The maximum width a column can be resized 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. min_column_width: The minimum width a column can be resized to.
row_height: Determins the height of each row. row_height: Determins the height of each row.
row_markers: Kind of row markers. row_markers: Kind of row markers.
row_marker_start_index: Changes the starting index for row markers. row_marker_start_index: Changes the starting index for row markers.
row_marker_width: Sets the width of row markers in pixels, if unset row markers will automatically size. row_marker_width: Sets the width of row markers in pixels, if unset row markers will automatically size.
smooth_scroll_x: Enable horizontal smooth scrolling. smooth_scroll_x: Enable horizontal smooth scrolling.
smooth_scroll_y: Enable vertical smooth scrolling. smooth_scroll_y: Enable vertical smooth scrolling.
vertical_border: Controls the drawing of the left hand vertical border of a column. If set to a boolean value it controls all borders. vertical_border: Controls the drawing of the left hand vertical border of a column. If set to a boolean value it controls all borders.
column_select: Allow columns selections. ("none", "single", "multi") column_select: Allow columns selections. ("none", "single", "multi")
prevent_diagonal_scrolling: Prevent diagonal scrolling. prevent_diagonal_scrolling: Prevent diagonal scrolling.
overscroll_x: Allow to scroll past the limit of the actual content on the horizontal axis. overscroll_x: Allow to scroll past the limit of the actual content on the horizontal axis.
overscroll_y: Allow to scroll past the limit of the actual content on the vertical axis. overscroll_y: Allow to scroll past the limit of the actual content on the vertical axis.
scroll_offset_x: Initial scroll offset on the horizontal axis. scroll_offset_x: Initial scroll offset on the horizontal axis.
scroll_offset_y: Initial scroll offset on the vertical axis. scroll_offset_y: Initial scroll offset on the vertical axis.
theme: global theme theme: global theme
on_cell_activated: Fired when a cell is activated. on_cell_activated: Fired when a cell is activated.
on_cell_clicked: Fired when a cell is clicked. on_cell_clicked: Fired when a cell is clicked.
on_cell_context_menu: Fired when a cell is right-clicked. on_cell_context_menu: Fired when a cell is right-clicked.
on_cell_edited: Fired when a cell is edited. on_cell_edited: Fired when a cell is edited.
on_group_header_clicked: Fired when a group header is clicked. on_group_header_clicked: Fired when a group header is clicked.
on_group_header_context_menu: Fired when a group header is right-clicked. on_group_header_context_menu: Fired when a group header is right-clicked.
on_group_header_renamed: Fired when a group header is renamed. on_group_header_renamed: Fired when a group header is renamed.
on_header_clicked: Fired when a header is clicked. on_header_clicked: Fired when a header is clicked.
on_header_context_menu: Fired when a header is right-clicked. on_header_context_menu: Fired when a header is right-clicked.
on_header_menu_click: Fired when a header menu item is clicked. on_header_menu_click: Fired when a header menu item is clicked.
on_item_hovered: Fired when an item is hovered. on_item_hovered: Fired when an item is hovered.
on_delete: Fired when a selection is deleted. on_delete: Fired when a selection is deleted.
on_finished_editing: Fired when editing is finished. on_finished_editing: Fired when editing is finished.
on_row_appended: Fired when a row is appended. on_row_appended: Fired when a row is appended.
on_selection_cleared: Fired when the selection is cleared. on_selection_cleared: Fired when the selection is cleared.
on_column_resize: Fired when a column is resized. on_column_resize: Fired when a column is resized.
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.
class_name: The class name for the component. class_name: The class name for the component.
autofocus: Whether the component should take the focus once the page is loaded autofocus: Whether the component should take the focus once the page is loaded
custom_attrs: custom attribute custom_attrs: custom attribute
**props: The props of the data editor. **props: The props of the data editor.
Raises: Raises:
ValueError: invalid input. ValueError: invalid input.
Returns: Returns:
The DataEditor component.& The DataEditor component.&
""" """
... ...

View File

@ -490,17 +490,17 @@ class ShikiJsTransformer(ShikiBaseTransformers):
}, },
# White Space # White Space
# ".tab, .space": { # ".tab, .space": {
# "position": "relative", # "position": "relative", # noqa: ERA001
# }, # },
# ".tab::before": { # ".tab::before": {
# "content": "'⇥'", # "content": "'⇥'", # noqa: ERA001
# "position": "absolute", # "position": "absolute", # noqa: ERA001
# "opacity": "0.3", # "opacity": "0.3",# noqa: ERA001
# }, # },
# ".space::before": { # ".space::before": {
# "content": "'·'", # "content": "'·'", # noqa: ERA001
# "position": "absolute", # "position": "absolute", # noqa: ERA001
# "opacity": "0.3", # "opacity": "0.3", # noqa: ERA001
# }, # },
} }
) )

View File

@ -250,7 +250,6 @@ class Form(BaseHTML):
_js_expr=f"getRefValue({str(ref_var)})", _js_expr=f"getRefValue({str(ref_var)})",
_var_data=VarData.merge(ref_var._get_all_var_data()), _var_data=VarData.merge(ref_var._get_all_var_data()),
) )
# print(repr(form_refs))
return form_refs return form_refs
def _get_vars(self, include_children: bool = True) -> Iterator[Var]: def _get_vars(self, include_children: bool = True) -> Iterator[Var]:

View File

@ -47,7 +47,7 @@ class Image(NextComponent):
placeholder: Var[str] placeholder: Var[str]
# Allows passing CSS styles to the underlying image element. # Allows passing CSS styles to the underlying image element.
# style: Var[Any] # style: Var[Any] #noqa: ERA001
# The loading behavior of the image. Defaults to lazy. Can hurt performance, recommended to use `priority` instead. # The loading behavior of the image. Defaults to lazy. Can hurt performance, recommended to use `priority` instead.
loading: Var[Literal["lazy", "eager"]] loading: Var[Literal["lazy", "eager"]]

View File

@ -70,7 +70,7 @@ class Image(NextComponent):
quality: The quality of the optimized image, an integer between 1 and 100, where 100 is the best quality and therefore largest file size. Defaults to 75. quality: The quality of the optimized image, an integer between 1 and 100, where 100 is the best quality and therefore largest file size. Defaults to 75.
priority: When true, the image will be considered high priority and preload. Lazy loading is automatically disabled for images using priority. priority: When true, the image will be considered high priority and preload. Lazy loading is automatically disabled for images using priority.
placeholder: A placeholder to use while the image is loading. Possible values are blur, empty, or data:image/.... Defaults to empty. placeholder: A placeholder to use while the image is loading. Possible values are blur, empty, or data:image/.... Defaults to empty.
loading: Allows passing CSS styles to the underlying image element. style: Var[Any] The loading behavior of the image. Defaults to lazy. Can hurt performance, recommended to use `priority` instead. loading: Allows passing CSS styles to the underlying image element. style: Var[Any] #noqa: ERA001 The loading behavior of the image. Defaults to lazy. Can hurt performance, recommended to use `priority` instead.
blurDataURL: A Data URL to be used as a placeholder image before the src image successfully loads. Only takes effect when combined with placeholder="blur". blurDataURL: A Data URL to be used as a placeholder image before the src image successfully loads. Only takes effect when combined with placeholder="blur".
on_load: Fires when the image has loaded. on_load: Fires when the image has loaded.
on_error: Fires when the image has an error. on_error: Fires when the image has an error.

View File

@ -188,7 +188,7 @@ class Slider(ComponentNamespace):
else: else:
children = [ children = [
track, track,
# Foreach.create(props.get("value"), lambda e: SliderThumb.create()), # foreach doesn't render Thumbs properly # Foreach.create(props.get("value"), lambda e: SliderThumb.create()), # foreach doesn't render Thumbs properly # noqa: ERA001
] ]
return SliderRoot.create(*children, **props) return SliderRoot.create(*children, **props)

View File

@ -53,7 +53,7 @@ LiteralAccentColor = Literal[
class CommonMarginProps(Component): class CommonMarginProps(Component):
"""Many radix-themes elements accept shorthand margin props.""" """Many radix-themes elements accept shorthand margin props."""
# Margin: "0" - "9" # Margin global: "0" - "9"
m: Var[LiteralSpacing] m: Var[LiteralSpacing]
# Margin horizontal: "0" - "9" # Margin horizontal: "0" - "9"
@ -78,7 +78,7 @@ class CommonMarginProps(Component):
class CommonPaddingProps(Component): class CommonPaddingProps(Component):
"""Many radix-themes elements accept shorthand padding props.""" """Many radix-themes elements accept shorthand padding props."""
# Padding: "0" - "9" # Padding global: "0" - "9"
p: Var[Responsive[LiteralSpacing]] p: Var[Responsive[LiteralSpacing]]
# Padding horizontal: "0" - "9" # Padding horizontal: "0" - "9"
@ -142,11 +142,6 @@ class RadixThemesComponent(Component):
component.alias = "RadixThemes" + ( component.alias = "RadixThemes" + (
component.tag or component.__class__.__name__ component.tag or component.__class__.__name__
) )
# value = props.get("value")
# if value is not None and component.alias == "RadixThemesSelect.Root":
# lv = LiteralVar.create(value)
# print(repr(lv))
# print(f"Warning: Value {value} is not used in {component.alias}.")
return component return component
@staticmethod @staticmethod

View File

@ -125,7 +125,7 @@ class CommonMarginProps(Component):
Args: Args:
*children: The children of the component. *children: The children of the component.
m: Margin: "0" - "9" m: Margin global: "0" - "9"
mx: Margin horizontal: "0" - "9" mx: Margin horizontal: "0" - "9"
my: Margin vertical: "0" - "9" my: Margin vertical: "0" - "9"
mt: Margin top: "0" - "9" mt: Margin top: "0" - "9"
@ -297,7 +297,7 @@ class CommonPaddingProps(Component):
Args: Args:
*children: The children of the component. *children: The children of the component.
p: Padding: "0" - "9" p: Padding global: "0" - "9"
px: Padding horizontal: "0" - "9" px: Padding horizontal: "0" - "9"
py: Padding vertical: "0" - "9" py: Padding vertical: "0" - "9"
pt: Padding top: "0" - "9" pt: Padding top: "0" - "9"

View File

@ -416,7 +416,7 @@ class Bar(Cartesian):
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]]] # 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"]

View File

@ -136,7 +136,7 @@ class Radar(Recharts):
# Fill color. Default: rx.color("accent", 3) # Fill color. Default: rx.color("accent", 3)
fill: Var[str] = LiteralVar.create(Color("accent", 3)) fill: Var[str] = LiteralVar.create(Color("accent", 3))
# opacity. Default: 0.6 # The opacity to fill the chart. Default: 0.6
fill_opacity: Var[float] = LiteralVar.create(0.6) fill_opacity: Var[float] = LiteralVar.create(0.6)
# The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect" # The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect"

View File

@ -204,7 +204,7 @@ class Radar(Recharts):
dot: If false set, dots will not be drawn. Default: True dot: If false set, dots will not be drawn. Default: True
stroke: Stoke color. Default: rx.color("accent", 9) stroke: Stoke color. Default: rx.color("accent", 9)
fill: Fill color. Default: rx.color("accent", 3) fill: Fill color. Default: rx.color("accent", 3)
fill_opacity: opacity. Default: 0.6 fill_opacity: The opacity to fill the chart. Default: 0.6
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect" legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect"
label: If false set, labels will not be drawn. Default: True label: If false set, labels will not be drawn. Default: True
is_animation_active: If set false, animation of polygon will be disabled. Default: True in CSR, and False in SSR is_animation_active: If set false, animation of polygon will be disabled. Default: True in CSR, and False in SSR

View File

@ -98,7 +98,7 @@ class ToastProps(PropsBase, NoExtrasAllowedProps):
# TODO: fix serialization of icons for toast? (might not be possible yet) # TODO: fix serialization of icons for toast? (might not be possible yet)
# Icon displayed in front of toast's text, aligned vertically. # Icon displayed in front of toast's text, aligned vertically.
# icon: Optional[Icon] = None # icon: Optional[Icon] = None # noqa: ERA001
# TODO: fix implementation for action / cancel buttons # TODO: fix implementation for action / cancel buttons
# Renders a primary button, clicking it will close the toast. # Renders a primary button, clicking it will close the toast.
@ -364,9 +364,7 @@ class Toaster(Component):
return super().create(*children, **props) return super().create(*children, **props)
# TODO: figure out why loading toast stay open forever # TODO: figure out why loading toast stay open forever when using level="loading" in toast()
# def toast_loading(message: str, **kwargs):
# return _toast(message, level="loading", **kwargs)
class ToastNamespace(ComponentNamespace): class ToastNamespace(ComponentNamespace):
@ -379,7 +377,6 @@ class ToastNamespace(ComponentNamespace):
error = staticmethod(Toaster.toast_error) error = staticmethod(Toaster.toast_error)
success = staticmethod(Toaster.toast_success) success = staticmethod(Toaster.toast_success)
dismiss = staticmethod(Toaster.toast_dismiss) dismiss = staticmethod(Toaster.toast_dismiss)
# loading = staticmethod(toast_loading)
__call__ = staticmethod(Toaster.send_toast) __call__ = staticmethod(Toaster.send_toast)

View File

@ -137,31 +137,31 @@ class Toaster(Component):
"""Create a toaster component. """Create a toaster component.
Args: Args:
*children: The children of the toaster. *children: The children of the toaster.
theme: the theme of the toast theme: the theme of the toast
rich_colors: whether to show rich colors rich_colors: whether to show rich colors
expand: whether to expand the toast expand: whether to expand the toast
visible_toasts: the number of toasts that are currently visible visible_toasts: the number of toasts that are currently visible
position: the position of the toast position: the position of the toast
close_button: whether to show the close button close_button: whether to show the close button
offset: offset of the toast offset: offset of the toast
dir: directionality of the toast (default: ltr) dir: directionality of the toast (default: ltr)
hotkey: Keyboard shortcut that will move focus to the toaster area. hotkey: Keyboard shortcut that will move focus to the toaster area.
invert: Dark toasts in light mode and vice versa. invert: Dark toasts in light mode and vice versa.
toast_options: These will act as default options for all toasts. See toast() for all available options. toast_options: These will act as default options for all toasts. See toast() for all available options.
gap: Gap between toasts when expanded gap: Gap between toasts when expanded
loading_icon: Changes the default loading icon loading_icon: Changes the default loading icon
pause_when_page_is_hidden: Pauses toast timers when the page is hidden, e.g., when the tab is backgrounded, the browser is minimized, or the OS is locked. pause_when_page_is_hidden: Pauses toast timers when the page is hidden, e.g., when the tab is backgrounded, the browser is minimized, or the OS is locked.
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.
class_name: The class name for the component. class_name: The class name for the component.
autofocus: Whether the component should take the focus once the page is loaded autofocus: Whether the component should take the focus once the page is loaded
custom_attrs: custom attribute custom_attrs: custom attribute
**props: The properties of the toaster. **props: The properties of the toaster.
Returns: Returns:
The toaster component. The toaster component.
""" """
... ...
@ -181,15 +181,15 @@ class ToastNamespace(ComponentNamespace):
"""Send a toast message. """Send a toast message.
Args: Args:
message: The message to display. message: The message to display.
level: The level of the toast. level: The level of the toast.
**props: The options for the toast. **props: The options for the toast.
Raises: Raises:
ValueError: If the Toaster component is not created. ValueError: If the Toaster component is not created.
Returns: Returns:
The toast event. The toast event.
""" """
... ...

View File

@ -116,7 +116,7 @@ class Editor(NoSSRComponent):
# Please refer to the library docs for this. # Please refer to the library docs for this.
# options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" | # options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" |
# "ru" | "zh_cn" | "ro" | "pl" | "ckb" | "lv" | "se" | "ua" | "he" | "it" # "ru" | "zh_cn" | "ro" | "pl" | "ckb" | "lv" | "se" | "ua" | "he" | "it"
# default : "en" # default: "en".
lang: Var[ lang: Var[
Union[ Union[
Literal[ Literal[
@ -172,7 +172,7 @@ class Editor(NoSSRComponent):
set_options: Var[Dict] set_options: Var[Dict]
# Whether all SunEditor plugins should be loaded. # Whether all SunEditor plugins should be loaded.
# default: True # default: True.
set_all_plugins: Var[bool] set_all_plugins: Var[bool]
# Set the content of the editor. # Set the content of the editor.
@ -191,19 +191,19 @@ class Editor(NoSSRComponent):
set_default_style: Var[str] set_default_style: Var[str]
# Disable the editor # Disable the editor
# default: False # default: False.
disable: Var[bool] disable: Var[bool]
# Hide the editor # Hide the editor
# default: False # default: False.
hide: Var[bool] hide: Var[bool]
# Hide the editor toolbar # Hide the editor toolbar
# default: False # default: False.
hide_toolbar: Var[bool] hide_toolbar: Var[bool]
# Disable the editor toolbar # Disable the editor toolbar
# default: False # default: False.
disable_toolbar: Var[bool] disable_toolbar: Var[bool]
# Fired when the editor content changes. # Fired when the editor content changes.

View File

@ -172,7 +172,7 @@ class Editor(NoSSRComponent):
Args: Args:
set_options(Optional[EditorOptions]): Configuration object to further configure the instance. set_options(Optional[EditorOptions]): Configuration object to further configure the instance.
lang: Language of the editor. Alternatively to a string, a dict of your language can be passed to this prop. Please refer to the library docs for this. options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" | "ru" | "zh_cn" | "ro" | "pl" | "ckb" | "lv" | "se" | "ua" | "he" | "it" default : "en" lang: Language of the editor. Alternatively to a string, a dict of your language can be passed to this prop. Please refer to the library docs for this. options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" | "ru" | "zh_cn" | "ro" | "pl" | "ckb" | "lv" | "se" | "ua" | "he" | "it" default: "en".
name: This is used to set the HTML form name of the editor. This means on HTML form submission, it will be submitted together with contents of the editor by the name provided. name: This is used to set the HTML form name of the editor. This means on HTML form submission, it will be submitted together with contents of the editor by the name provided.
default_value: Sets the default value of the editor. This is useful if you don't want the on_change method to be called on render. If you want the on_change method to be called on render please use the set_contents prop default_value: Sets the default value of the editor. This is useful if you don't want the on_change method to be called on render. If you want the on_change method to be called on render please use the set_contents prop
width: Sets the width of the editor. px and percentage values are accepted, eg width="100%" or width="500px" default: 100% width: Sets the width of the editor. px and percentage values are accepted, eg width="100%" or width="500px" default: 100%
@ -180,14 +180,14 @@ class Editor(NoSSRComponent):
placeholder: Sets the placeholder of the editor. placeholder: Sets the placeholder of the editor.
auto_focus: Should the editor receive focus when initialized? auto_focus: Should the editor receive focus when initialized?
set_options: Pass an EditorOptions instance to modify the behaviour of Editor even more. set_options: Pass an EditorOptions instance to modify the behaviour of Editor even more.
set_all_plugins: Whether all SunEditor plugins should be loaded. default: True set_all_plugins: Whether all SunEditor plugins should be loaded. default: True.
set_contents: Set the content of the editor. Note: To set the initial contents of the editor without calling the on_change event, please use the default_value prop. set_contents is used to set the contents of the editor programmatically. You must be aware that, when the set_contents's prop changes, the on_change event is triggered. set_contents: Set the content of the editor. Note: To set the initial contents of the editor without calling the on_change event, please use the default_value prop. set_contents is used to set the contents of the editor programmatically. You must be aware that, when the set_contents's prop changes, the on_change event is triggered.
append_contents: Append editor content append_contents: Append editor content
set_default_style: Sets the default style of the editor's edit area set_default_style: Sets the default style of the editor's edit area
disable: Disable the editor default: False disable: Disable the editor default: False.
hide: Hide the editor default: False hide: Hide the editor default: False.
hide_toolbar: Hide the editor toolbar default: False hide_toolbar: Hide the editor toolbar default: False.
disable_toolbar: Disable the editor toolbar default: False disable_toolbar: Disable the editor toolbar default: False.
on_change: Fired when the editor content changes. on_change: Fired when the editor content changes.
on_input: Fired when the something is inputted in the editor. on_input: Fired when the something is inputted in the editor.
on_blur: Fired when the editor loses focus. on_blur: Fired when the editor loses focus.

View File

@ -1222,7 +1222,7 @@ def call_event_handler(
except TypeError: except TypeError:
# TODO: In 0.7.0, remove this block and raise the exception # TODO: In 0.7.0, remove this block and raise the exception
# raise TypeError( # raise TypeError(
# f"Could not compare types {args_types_without_vars[i]} and {type_hints_of_provided_callback[arg]} for argument {arg} of {event_handler.fn.__qualname__} provided for {key}." # f"Could not compare types {args_types_without_vars[i]} and {type_hints_of_provided_callback[arg]} for argument {arg} of {event_handler.fn.__qualname__} provided for {key}." # noqa: ERA001
# ) from e # ) from e
console.warn( console.warn(
f"Could not compare types {args_types_without_vars[i]} and {type_hints_of_provided_callback[arg]} for argument {arg} of {event_callback.fn.__qualname__} provided for {key}." f"Could not compare types {args_types_without_vars[i]} and {type_hints_of_provided_callback[arg]} for argument {arg} of {event_callback.fn.__qualname__} provided for {key}."

View File

@ -32,13 +32,8 @@ class Sidebar(Box, MemoizationLeaf):
Returns: Returns:
The sidebar component. The sidebar component.
"""
# props.setdefault("border_right", f"1px solid {color('accent', 12)}")
# props.setdefault("background_color", color("accent", 1))
# props.setdefault("width", "20vw")
# props.setdefault("height", "100vh")
# props.setdefault("position", "fixed")
"""
return super().create( return super().create(
Box.create(*children, **props), # sidebar for content Box.create(*children, **props), # sidebar for content
Box.create(width=props.get("width")), # spacer for layout Box.create(width=props.get("width")), # spacer for layout

View File

@ -138,9 +138,6 @@ def convert_item(
if isinstance(style_item, Var): if isinstance(style_item, Var):
return style_item, style_item._get_all_var_data() return style_item, style_item._get_all_var_data()
# if isinstance(style_item, str) and REFLEX_VAR_OPENING_TAG not in style_item:
# return style_item, None
# Otherwise, convert to Var to collapse VarData encoded in f-string. # Otherwise, convert to Var to collapse VarData encoded in f-string.
new_var = LiteralVar.create(style_item) new_var = LiteralVar.create(style_item)
var_data = new_var._get_all_var_data() if new_var is not None else None var_data = new_var._get_all_var_data() if new_var is not None else None

View File

@ -206,7 +206,7 @@ class AppHarness:
The full state name The full state name
""" """
# NOTE: using State.get_name() somehow causes trouble here # NOTE: using State.get_name() somehow causes trouble here
# path = [State.get_name()] + [self.get_state_name(p) for p in path] # path = [State.get_name()] + [self.get_state_name(p) for p in path] # noqa: ERA001
path = ["reflex___state____state"] + [self.get_state_name(p) for p in path] path = ["reflex___state____state"] + [self.get_state_name(p) for p in path]
return ".".join(path) return ".".join(path)

View File

@ -712,7 +712,6 @@ def format_array_ref(refs: str, idx: Var | None) -> str:
""" """
clean_ref = re.sub(r"[^\w]+", "_", refs) clean_ref = re.sub(r"[^\w]+", "_", refs)
if idx is not None: if idx is not None:
# idx._var_is_local = True
return f"refs_{clean_ref}[{str(idx)}]" return f"refs_{clean_ref}[{str(idx)}]"
return f"refs_{clean_ref}" return f"refs_{clean_ref}"

View File

@ -196,12 +196,7 @@ def _get_type_hint(value, type_hint_globals, is_optional=True) -> str:
elif isinstance(value, str): elif isinstance(value, str):
ev = eval(value, type_hint_globals) ev = eval(value, type_hint_globals)
if rx_types.is_optional(ev): if rx_types.is_optional(ev):
# hints = {
# _get_type_hint(arg, type_hint_globals, is_optional=False)
# for arg in ev.__args__
# }
return _get_type_hint(ev, type_hint_globals, is_optional=False) return _get_type_hint(ev, type_hint_globals, is_optional=False)
# return f"Optional[{', '.join(hints)}]"
if rx_types.is_union(ev): if rx_types.is_union(ev):
res = [ res = [

View File

@ -97,7 +97,6 @@ StateIterVar = Union[list, set, tuple]
if TYPE_CHECKING: if TYPE_CHECKING:
from reflex.vars.base import Var from reflex.vars.base import Var
# ArgsSpec = Callable[[Var], list[Var]]
ArgsSpec = ( ArgsSpec = (
Callable[[], Sequence[Var]] Callable[[], Sequence[Var]]
| Callable[[Var], Sequence[Var]] | Callable[[Var], Sequence[Var]]

View File

@ -106,7 +106,6 @@ def ComputedVars():
), ),
) )
# raise Exception(State.count3._deps(objclass=State))
app = rx.App() app = rx.App()
app.add_page(index) app.add_page(index)

View File

@ -183,6 +183,6 @@ async def test_fully_controlled_input(fully_controlled_input: AppHarness):
clear_button.click() clear_button.click()
assert AppHarness._poll_for(lambda: on_change_input.get_attribute("value") == "") assert AppHarness._poll_for(lambda: on_change_input.get_attribute("value") == "")
# potential bug: clearing the on_change field doesn't itself trigger on_change # potential bug: clearing the on_change field doesn't itself trigger on_change
# assert backend_state.text == "" # assert backend_state.text == "" #noqa: ERA001
# assert debounce_input.get_attribute("value") == "" # assert debounce_input.get_attribute("value") == "" #noqa: ERA001
# assert value_input.get_attribute("value") == "" # assert value_input.get_attribute("value") == "" #noqa: ERA001

View File

@ -13,9 +13,6 @@ STATE_VAR = Var(_js_expr="default_state.name")
("{}", '{"{}"}'), ("{}", '{"{}"}'),
(None, '{""}'), (None, '{""}'),
(STATE_VAR, "{default_state.name}"), (STATE_VAR, "{default_state.name}"),
# This behavior is now unsupported.
# ("${default_state.name}", "${default_state.name}"),
# ("{state.name}", "{state.name}"),
], ],
) )
def test_fstrings(contents, expected): def test_fstrings(contents, expected):

View File

@ -42,7 +42,7 @@ def test_set_src_str():
"`pic2.jpeg`", "`pic2.jpeg`",
) )
# For plain rx.el.img, an explicit var is not created, so the quoting happens later # For plain rx.el.img, an explicit var is not created, so the quoting happens later
# assert str(image.src) == "pic2.jpeg" # type: ignore # assert str(image.src) == "pic2.jpeg" # type: ignore #noqa: ERA001
def test_set_src_img(pil_image: Img): def test_set_src_img(pil_image: Img):

View File

@ -917,17 +917,17 @@ def test_invalid_event_handler_args(component2, test_state):
# # Event Handler types must match # # Event Handler types must match
# with pytest.raises(EventHandlerArgTypeMismatch): # with pytest.raises(EventHandlerArgTypeMismatch):
# component2.create( # component2.create(
# on_user_visited_count_changed=test_state.do_something_with_bool # on_user_visited_count_changed=test_state.do_something_with_bool #noqa: ERA001
# ) # ) #noqa: ERA001
# with pytest.raises(EventHandlerArgTypeMismatch): # with pytest.raises(EventHandlerArgTypeMismatch):
# component2.create(on_user_list_changed=test_state.do_something_with_int) # component2.create(on_user_list_changed=test_state.do_something_with_int) #noqa: ERA001
# with pytest.raises(EventHandlerArgTypeMismatch): # with pytest.raises(EventHandlerArgTypeMismatch):
# component2.create(on_user_list_changed=test_state.do_something_with_list_int) # component2.create(on_user_list_changed=test_state.do_something_with_list_int) #noqa: ERA001
# component2.create(on_open=test_state.do_something_with_int) # component2.create(on_open=test_state.do_something_with_int) #noqa: ERA001
# component2.create(on_open=test_state.do_something_with_bool) # component2.create(on_open=test_state.do_something_with_bool) #noqa: ERA001
# component2.create(on_user_visited_count_changed=test_state.do_something_with_int) # component2.create(on_user_visited_count_changed=test_state.do_something_with_int) #noqa: ERA001
# component2.create(on_user_list_changed=test_state.do_something_with_list_str) # component2.create(on_user_list_changed=test_state.do_something_with_list_str) #noqa: ERA001
# lambda cannot return weird values. # lambda cannot return weird values.
with pytest.raises(ValueError): with pytest.raises(ValueError):
@ -1436,8 +1436,6 @@ def test_get_vars(component, exp_vars):
comp_vars, comp_vars,
sorted(exp_vars, key=lambda v: v._js_expr), sorted(exp_vars, key=lambda v: v._js_expr),
): ):
# print(str(comp_var), str(exp_var))
# print(comp_var._get_all_var_data(), exp_var._get_all_var_data())
assert comp_var.equals(exp_var) assert comp_var.equals(exp_var)

View File

@ -899,8 +899,6 @@ class DynamicState(BaseState):
loaded: int = 0 loaded: int = 0
counter: int = 0 counter: int = 0
# side_effect_counter: int = 0
def on_load(self): def on_load(self):
"""Event handler for page on_load, should trigger for all navigation events.""" """Event handler for page on_load, should trigger for all navigation events."""
self.loaded = self.loaded + 1 self.loaded = self.loaded + 1
@ -917,7 +915,6 @@ class DynamicState(BaseState):
Returns: Returns:
same as self.dynamic same as self.dynamic
""" """
# self.side_effect_counter = self.side_effect_counter + 1
return self.dynamic return self.dynamic
on_load_internal = OnLoadInternalState.on_load_internal.fn on_load_internal = OnLoadInternalState.on_load_internal.fn
@ -1059,7 +1056,6 @@ async def test_dynamic_route_var_route_change_completed_on_load(
arg_name: exp_val, arg_name: exp_val,
f"comp_{arg_name}": exp_val, f"comp_{arg_name}": exp_val,
constants.CompileVars.IS_HYDRATED: False, constants.CompileVars.IS_HYDRATED: False,
# "side_effect_counter": exp_index,
"router": exp_router, "router": exp_router,
} }
}, },
@ -1155,8 +1151,6 @@ async def test_dynamic_route_var_route_change_completed_on_load(
state = await app.state_manager.get_state(substate_token) state = await app.state_manager.get_state(substate_token)
assert state.loaded == len(exp_vals) assert state.loaded == len(exp_vals)
assert state.counter == len(exp_vals) assert state.counter == len(exp_vals)
# print(f"Expected {exp_vals} rendering side effects, got {state.side_effect_counter}")
# assert state.side_effect_counter == len(exp_vals)
if isinstance(app.state_manager, StateManagerRedis): if isinstance(app.state_manager, StateManagerRedis):
await app.state_manager.close() await app.state_manager.close()

View File

@ -209,10 +209,6 @@ def test_event_redirect(input, output):
assert isinstance(spec, EventSpec) assert isinstance(spec, EventSpec)
assert spec.handler.fn.__qualname__ == "_redirect" assert spec.handler.fn.__qualname__ == "_redirect"
# this asserts need comment about what it's testing (they fail with Var as input)
# assert spec.args[0][0].equals(Var(_js_expr="path"))
# assert spec.args[0][1].equals(Var(_js_expr="/path"))
assert format.format_event(spec) == output assert format.format_event(spec) == output

View File

@ -127,8 +127,8 @@ def test_automigration(
assert result[0].b == 4.2 assert result[0].b == 4.2
# No-op # No-op
# assert Model.migrate(autogenerate=True) # assert Model.migrate(autogenerate=True) #noqa: ERA001
# assert len(list(versions.glob("*.py"))) == 4 # assert len(list(versions.glob("*.py"))) == 4 #noqa: ERA001
# drop table (AlembicSecond) # drop table (AlembicSecond)
model_registry.get_metadata().clear() model_registry.get_metadata().clear()

View File

@ -787,7 +787,6 @@ async def test_process_event_simple(test_state):
assert test_state.num1 == 69 assert test_state.num1 == 69
# The delta should contain the changes, including computed vars. # The delta should contain the changes, including computed vars.
# assert update.delta == {"test_state": {"num1": 69, "sum": 72.14}}
assert update.delta == { assert update.delta == {
TestState.get_full_name(): {"num1": 69, "sum": 72.14, "upper": ""}, TestState.get_full_name(): {"num1": 69, "sum": 72.14, "upper": ""},
GrandchildState3.get_full_name(): {"computed": ""}, GrandchildState3.get_full_name(): {"computed": ""},
@ -3485,10 +3484,10 @@ def test_mutable_models():
state.dirty_vars.clear() state.dirty_vars.clear()
# Not yet supported ENG-4083 # Not yet supported ENG-4083
# assert isinstance(state.dc, MutableProxy) # assert isinstance(state.dc, MutableProxy) #noqa: ERA001
# state.dc.foo = "baz" # state.dc.foo = "baz" #noqa: ERA001
# assert state.dirty_vars == {"dc"} # assert state.dirty_vars == {"dc"} #noqa: ERA001
# state.dirty_vars.clear() # state.dirty_vars.clear() #noqa: ERA001
def test_get_value(): def test_get_value():

View File

@ -34,12 +34,6 @@ def test_disable():
@pytest.mark.parametrize("event", ["init", "reinit", "run-dev", "run-prod", "export"]) @pytest.mark.parametrize("event", ["init", "reinit", "run-dev", "run-prod", "export"])
def test_send(mocker, event): def test_send(mocker, event):
httpx_post_mock = mocker.patch("httpx.post") httpx_post_mock = mocker.patch("httpx.post")
# mocker.patch(
# "builtins.open",
# mocker.mock_open(
# read_data='{"project_hash": "78285505863498957834586115958872998605"}'
# ),
# )
# Mock the read_text method of Path # Mock the read_text method of Path
pathlib_path_read_text_mock = mocker.patch( pathlib_path_read_text_mock = mocker.patch(

View File

@ -1495,8 +1495,6 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s
) )
eval(f"operand1_var {operator} operand2_var") eval(f"operand1_var {operator} operand2_var")
eval(f"operand2_var {operator} operand1_var") eval(f"operand2_var {operator} operand1_var")
# operand1_var.operation(op=operator, other=operand2_var)
# operand1_var.operation(op=operator, other=operand2_var, flip=True)
@pytest.mark.parametrize( @pytest.mark.parametrize(
@ -1773,11 +1771,9 @@ def test_invalid_var_operations(operand1_var: Var, operand2_var, operators: List
print(f"testing {operator} on {str(operand1_var)} and {str(operand2_var)}") print(f"testing {operator} on {str(operand1_var)} and {str(operand2_var)}")
with pytest.raises(TypeError): with pytest.raises(TypeError):
print(eval(f"operand1_var {operator} operand2_var")) print(eval(f"operand1_var {operator} operand2_var"))
# operand1_var.operation(op=operator, other=operand2_var)
with pytest.raises(TypeError): with pytest.raises(TypeError):
print(eval(f"operand2_var {operator} operand1_var")) print(eval(f"operand2_var {operator} operand1_var"))
# operand1_var.operation(op=operator, other=operand2_var, flip=True)
@pytest.mark.parametrize( @pytest.mark.parametrize(