diff --git a/pyproject.toml b/pyproject.toml index 619c4ff47..1e3396d9d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,8 +92,9 @@ build-backend = "poetry.core.masonry.api" [tool.ruff] target-version = "py39" +output-format="concise" 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.pydocstyle.convention = "google" diff --git a/reflex/app.py b/reflex/app.py index cdf21aa35..0d01949ed 100644 --- a/reflex/app.py +++ b/reflex/app.py @@ -965,7 +965,6 @@ class App(MiddlewareMixin, LifespanMixin): 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. diff --git a/reflex/components/datadisplay/dataeditor.py b/reflex/components/datadisplay/dataeditor.py index e3f0b7117..3859909f9 100644 --- a/reflex/components/datadisplay/dataeditor.py +++ b/reflex/components/datadisplay/dataeditor.py @@ -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.""" @@ -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] diff --git a/reflex/components/datadisplay/dataeditor.pyi b/reflex/components/datadisplay/dataeditor.pyi index aa4b3b2e8..4b1576bd8 100644 --- a/reflex/components/datadisplay/dataeditor.pyi +++ b/reflex/components/datadisplay/dataeditor.pyi @@ -275,65 +275,65 @@ class DataEditor(NoSSRComponent): """Create the DataEditor component. Args: - *children: The children of the data editor. - rows: Number of rows. - columns: Headers of the columns for the data grid. - data: The data. - get_cell_content: The name of the callback used to find the data to display. - get_cells_for_selection: Allow selection for copying. - on_paste: Allow paste. - draw_focus_ring: Controls the drawing of the focus ring. - fixed_shadow_x: Enables or disables the overlay shadow when scrolling horizontally. - 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. - 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_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. - row_markers: Kind of 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. - smooth_scroll_x: Enable horizontal 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. - column_select: Allow columns selections. ("none", "single", "multi") - prevent_diagonal_scrolling: Prevent diagonal scrolling. - 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. - scroll_offset_x: Initial scroll offset on the horizontal axis. - scroll_offset_y: Initial scroll offset on the vertical axis. - theme: global theme - on_cell_activated: Fired when a cell is activated. - on_cell_clicked: Fired when a cell is clicked. - on_cell_context_menu: Fired when a cell is right-clicked. - on_cell_edited: Fired when a cell is edited. - 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_renamed: Fired when a group header is renamed. - on_header_clicked: Fired when a header is 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_item_hovered: Fired when an item is hovered. - on_delete: Fired when a selection is deleted. - on_finished_editing: Fired when editing is finished. - on_row_appended: Fired when a row is appended. - on_selection_cleared: Fired when the selection is cleared. - on_column_resize: Fired when a column is resized. - style: The style of the component. - key: A unique key for the component. - id: The id for the component. - class_name: The class name for the component. - autofocus: Whether the component should take the focus once the page is loaded - custom_attrs: custom attribute - **props: The props of the data editor. + *children: The children of the data editor. + rows: Number of rows. + columns: Headers of the columns for the data grid. + data: The data. + get_cell_content: The name of the callback used to find the data to display. + get_cells_for_selection: Allow selection for copying. + on_paste: Allow paste. + draw_focus_ring: Controls the drawing of the focus ring. + fixed_shadow_x: Enables or disables the overlay shadow when scrolling horizontally. + 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. + 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) #noqa: ERA001 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. + row_markers: Kind of 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. + smooth_scroll_x: Enable horizontal 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. + column_select: Allow columns selections. ("none", "single", "multi") + prevent_diagonal_scrolling: Prevent diagonal scrolling. + 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. + scroll_offset_x: Initial scroll offset on the horizontal axis. + scroll_offset_y: Initial scroll offset on the vertical axis. + theme: global theme + on_cell_activated: Fired when a cell is activated. + on_cell_clicked: Fired when a cell is clicked. + on_cell_context_menu: Fired when a cell is right-clicked. + on_cell_edited: Fired when a cell is edited. + 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_renamed: Fired when a group header is renamed. + on_header_clicked: Fired when a header is 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_item_hovered: Fired when an item is hovered. + on_delete: Fired when a selection is deleted. + on_finished_editing: Fired when editing is finished. + on_row_appended: Fired when a row is appended. + on_selection_cleared: Fired when the selection is cleared. + on_column_resize: Fired when a column is resized. + style: The style of the component. + key: A unique key for the component. + id: The id for the component. + class_name: The class name for the component. + autofocus: Whether the component should take the focus once the page is loaded + custom_attrs: custom attribute + **props: The props of the data editor. Raises: - ValueError: invalid input. + ValueError: invalid input. Returns: - The DataEditor component.& + The DataEditor component.& """ ... diff --git a/reflex/components/datadisplay/shiki_code_block.py b/reflex/components/datadisplay/shiki_code_block.py index 2b4e1f506..3b6bce8a1 100644 --- a/reflex/components/datadisplay/shiki_code_block.py +++ b/reflex/components/datadisplay/shiki_code_block.py @@ -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 # }, } ) diff --git a/reflex/components/el/elements/forms.py b/reflex/components/el/elements/forms.py index 56dab5c7f..b2b31d4d1 100644 --- a/reflex/components/el/elements/forms.py +++ b/reflex/components/el/elements/forms.py @@ -250,7 +250,6 @@ class Form(BaseHTML): _js_expr=f"getRefValue({str(ref_var)})", _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]: diff --git a/reflex/components/next/image.py b/reflex/components/next/image.py index 237c308ce..2011505d8 100644 --- a/reflex/components/next/image.py +++ b/reflex/components/next/image.py @@ -47,7 +47,7 @@ class Image(NextComponent): placeholder: Var[str] # 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. loading: Var[Literal["lazy", "eager"]] diff --git a/reflex/components/next/image.pyi b/reflex/components/next/image.pyi index 0c1bf01f2..31b853c10 100644 --- a/reflex/components/next/image.pyi +++ b/reflex/components/next/image.pyi @@ -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. 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. - 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". on_load: Fires when the image has loaded. on_error: Fires when the image has an error. diff --git a/reflex/components/radix/primitives/slider.py b/reflex/components/radix/primitives/slider.py index 10a0079a4..90d0920bd 100644 --- a/reflex/components/radix/primitives/slider.py +++ b/reflex/components/radix/primitives/slider.py @@ -188,7 +188,7 @@ class Slider(ComponentNamespace): else: children = [ 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) diff --git a/reflex/components/radix/themes/base.py b/reflex/components/radix/themes/base.py index 65a9ae835..0d3ee097e 100644 --- a/reflex/components/radix/themes/base.py +++ b/reflex/components/radix/themes/base.py @@ -53,7 +53,7 @@ LiteralAccentColor = Literal[ class CommonMarginProps(Component): """Many radix-themes elements accept shorthand margin props.""" - # Margin: "0" - "9" + # Margin global: "0" - "9" m: Var[LiteralSpacing] # Margin horizontal: "0" - "9" @@ -78,7 +78,7 @@ class CommonMarginProps(Component): class CommonPaddingProps(Component): """Many radix-themes elements accept shorthand padding props.""" - # Padding: "0" - "9" + # Padding global: "0" - "9" p: Var[Responsive[LiteralSpacing]] # Padding horizontal: "0" - "9" @@ -142,11 +142,6 @@ class RadixThemesComponent(Component): component.alias = "RadixThemes" + ( 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 @staticmethod diff --git a/reflex/components/radix/themes/base.pyi b/reflex/components/radix/themes/base.pyi index b0a8e2fcb..d40638e3d 100644 --- a/reflex/components/radix/themes/base.pyi +++ b/reflex/components/radix/themes/base.pyi @@ -125,7 +125,7 @@ class CommonMarginProps(Component): Args: *children: The children of the component. - m: Margin: "0" - "9" + m: Margin global: "0" - "9" mx: Margin horizontal: "0" - "9" my: Margin vertical: "0" - "9" mt: Margin top: "0" - "9" @@ -297,7 +297,7 @@ class CommonPaddingProps(Component): Args: *children: The children of the component. - p: Padding: "0" - "9" + p: Padding global: "0" - "9" px: Padding horizontal: "0" - "9" py: Padding vertical: "0" - "9" pt: Padding top: "0" - "9" diff --git a/reflex/components/recharts/cartesian.py b/reflex/components/recharts/cartesian.py index 028bcb4e4..7fc9a27a1 100644 --- a/reflex/components/recharts/cartesian.py +++ b/reflex/components/recharts/cartesian.py @@ -416,7 +416,7 @@ class Bar(Cartesian): 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. - # active_bar: Var[Union[bool, Dict[str, Any]]] + # active_bar: Var[Union[bool, Dict[str, Any]]] #noqa: ERA001 # Valid children components _valid_children: List[str] = ["Cell", "LabelList", "ErrorBar"] diff --git a/reflex/components/recharts/polar.py b/reflex/components/recharts/polar.py index 0aedf4893..dea42af7b 100644 --- a/reflex/components/recharts/polar.py +++ b/reflex/components/recharts/polar.py @@ -136,7 +136,7 @@ class Radar(Recharts): # Fill color. Default: rx.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) # The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect" diff --git a/reflex/components/recharts/polar.pyi b/reflex/components/recharts/polar.pyi index 5ca96acb6..da0602fb0 100644 --- a/reflex/components/recharts/polar.pyi +++ b/reflex/components/recharts/polar.pyi @@ -204,7 +204,7 @@ class Radar(Recharts): dot: If false set, dots will not be drawn. Default: True stroke: Stoke color. Default: rx.color("accent", 9) 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" 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 diff --git a/reflex/components/sonner/toast.py b/reflex/components/sonner/toast.py index 8f5362dba..72f3f0ea9 100644 --- a/reflex/components/sonner/toast.py +++ b/reflex/components/sonner/toast.py @@ -98,7 +98,7 @@ class ToastProps(PropsBase, NoExtrasAllowedProps): # TODO: fix serialization of icons for toast? (might not be possible yet) # 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 # Renders a primary button, clicking it will close the toast. @@ -364,9 +364,7 @@ class Toaster(Component): return super().create(*children, **props) -# TODO: figure out why loading toast stay open forever -# def toast_loading(message: str, **kwargs): -# return _toast(message, level="loading", **kwargs) +# TODO: figure out why loading toast stay open forever when using level="loading" in toast() class ToastNamespace(ComponentNamespace): @@ -379,7 +377,6 @@ class ToastNamespace(ComponentNamespace): error = staticmethod(Toaster.toast_error) success = staticmethod(Toaster.toast_success) dismiss = staticmethod(Toaster.toast_dismiss) - # loading = staticmethod(toast_loading) __call__ = staticmethod(Toaster.send_toast) diff --git a/reflex/components/sonner/toast.pyi b/reflex/components/sonner/toast.pyi index 7fd9fdf54..e962aaca5 100644 --- a/reflex/components/sonner/toast.pyi +++ b/reflex/components/sonner/toast.pyi @@ -137,31 +137,31 @@ class Toaster(Component): """Create a toaster component. Args: - *children: The children of the toaster. - theme: the theme of the toast - rich_colors: whether to show rich colors - expand: whether to expand the toast - visible_toasts: the number of toasts that are currently visible - position: the position of the toast - close_button: whether to show the close button - offset: offset of the toast - dir: directionality of the toast (default: ltr) - hotkey: Keyboard shortcut that will move focus to the toaster area. - 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. - gap: Gap between toasts when expanded - 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. - style: The style of the component. - key: A unique key for the component. - id: The id for the component. - class_name: The class name for the component. - autofocus: Whether the component should take the focus once the page is loaded - custom_attrs: custom attribute - **props: The properties of the toaster. + *children: The children of the toaster. + theme: the theme of the toast + rich_colors: whether to show rich colors + expand: whether to expand the toast + visible_toasts: the number of toasts that are currently visible + position: the position of the toast + close_button: whether to show the close button + offset: offset of the toast + dir: directionality of the toast (default: ltr) + hotkey: Keyboard shortcut that will move focus to the toaster area. + 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. + gap: Gap between toasts when expanded + 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. + style: The style of the component. + key: A unique key for the component. + id: The id for the component. + class_name: The class name for the component. + autofocus: Whether the component should take the focus once the page is loaded + custom_attrs: custom attribute + **props: The properties of the toaster. Returns: - The toaster component. + The toaster component. """ ... @@ -181,15 +181,15 @@ class ToastNamespace(ComponentNamespace): """Send a toast message. Args: - message: The message to display. - level: The level of the toast. - **props: The options for the toast. + message: The message to display. + level: The level of the toast. + **props: The options for the toast. Raises: - ValueError: If the Toaster component is not created. + ValueError: If the Toaster component is not created. Returns: - The toast event. + The toast event. """ ... diff --git a/reflex/components/suneditor/editor.py b/reflex/components/suneditor/editor.py index 16d5689e2..d40f0e9ad 100644 --- a/reflex/components/suneditor/editor.py +++ b/reflex/components/suneditor/editor.py @@ -116,7 +116,7 @@ class Editor(NoSSRComponent): # 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" + # default: "en". lang: Var[ Union[ Literal[ @@ -172,7 +172,7 @@ class Editor(NoSSRComponent): set_options: Var[Dict] # Whether all SunEditor plugins should be loaded. - # default: True + # default: True. set_all_plugins: Var[bool] # Set the content of the editor. @@ -191,19 +191,19 @@ class Editor(NoSSRComponent): set_default_style: Var[str] # Disable the editor - # default: False + # default: False. disable: Var[bool] # Hide the editor - # default: False + # default: False. hide: Var[bool] # Hide the editor toolbar - # default: False + # default: False. hide_toolbar: Var[bool] # Disable the editor toolbar - # default: False + # default: False. disable_toolbar: Var[bool] # Fired when the editor content changes. diff --git a/reflex/components/suneditor/editor.pyi b/reflex/components/suneditor/editor.pyi index 66ab4863e..b52fd43da 100644 --- a/reflex/components/suneditor/editor.pyi +++ b/reflex/components/suneditor/editor.pyi @@ -172,7 +172,7 @@ class Editor(NoSSRComponent): Args: 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. 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% @@ -180,14 +180,14 @@ class Editor(NoSSRComponent): placeholder: Sets the placeholder of the editor. auto_focus: Should the editor receive focus when initialized? 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. append_contents: Append editor content set_default_style: Sets the default style of the editor's edit area - disable: Disable the editor default: False - hide: Hide the editor default: False - hide_toolbar: Hide the editor toolbar default: False - disable_toolbar: Disable the editor toolbar default: False + disable: Disable the editor default: False. + hide: Hide the editor default: False. + hide_toolbar: Hide the editor toolbar default: False. + disable_toolbar: Disable the editor toolbar default: False. on_change: Fired when the editor content changes. on_input: Fired when the something is inputted in the editor. on_blur: Fired when the editor loses focus. diff --git a/reflex/event.py b/reflex/event.py index 624bc1728..bd9a9b48d 100644 --- a/reflex/event.py +++ b/reflex/event.py @@ -1222,7 +1222,7 @@ def call_event_handler( except TypeError: # TODO: In 0.7.0, remove this block and raise the exception # 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 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}." diff --git a/reflex/experimental/layout.py b/reflex/experimental/layout.py index d203ce714..9b46fd67c 100644 --- a/reflex/experimental/layout.py +++ b/reflex/experimental/layout.py @@ -32,13 +32,8 @@ class Sidebar(Box, MemoizationLeaf): Returns: 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( Box.create(*children, **props), # sidebar for content Box.create(width=props.get("width")), # spacer for layout diff --git a/reflex/style.py b/reflex/style.py index f0ee8c6a7..789eb1405 100644 --- a/reflex/style.py +++ b/reflex/style.py @@ -138,9 +138,6 @@ def convert_item( if isinstance(style_item, Var): 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. new_var = LiteralVar.create(style_item) var_data = new_var._get_all_var_data() if new_var is not None else None diff --git a/reflex/testing.py b/reflex/testing.py index 9ddb03504..382b10738 100644 --- a/reflex/testing.py +++ b/reflex/testing.py @@ -206,7 +206,7 @@ class AppHarness: The full state name """ # 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] return ".".join(path) diff --git a/reflex/utils/format.py b/reflex/utils/format.py index 1b3d1740f..49895dd56 100644 --- a/reflex/utils/format.py +++ b/reflex/utils/format.py @@ -712,7 +712,6 @@ def format_array_ref(refs: str, idx: Var | None) -> str: """ clean_ref = re.sub(r"[^\w]+", "_", refs) if idx is not None: - # idx._var_is_local = True return f"refs_{clean_ref}[{str(idx)}]" return f"refs_{clean_ref}" diff --git a/reflex/utils/pyi_generator.py b/reflex/utils/pyi_generator.py index fb0a8f8c5..af7f1eb59 100644 --- a/reflex/utils/pyi_generator.py +++ b/reflex/utils/pyi_generator.py @@ -196,12 +196,7 @@ def _get_type_hint(value, type_hint_globals, is_optional=True) -> str: elif isinstance(value, str): ev = eval(value, type_hint_globals) 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 f"Optional[{', '.join(hints)}]" if rx_types.is_union(ev): res = [ diff --git a/reflex/utils/types.py b/reflex/utils/types.py index 0c39eacc4..d3c237b98 100644 --- a/reflex/utils/types.py +++ b/reflex/utils/types.py @@ -97,7 +97,6 @@ StateIterVar = Union[list, set, tuple] if TYPE_CHECKING: from reflex.vars.base import Var - # ArgsSpec = Callable[[Var], list[Var]] ArgsSpec = ( Callable[[], Sequence[Var]] | Callable[[Var], Sequence[Var]] diff --git a/tests/integration/test_computed_vars.py b/tests/integration/test_computed_vars.py index a41458173..03aaf18b4 100644 --- a/tests/integration/test_computed_vars.py +++ b/tests/integration/test_computed_vars.py @@ -106,7 +106,6 @@ def ComputedVars(): ), ) - # raise Exception(State.count3._deps(objclass=State)) app = rx.App() app.add_page(index) diff --git a/tests/integration/test_input.py b/tests/integration/test_input.py index c718749aa..e9fec7dc1 100644 --- a/tests/integration/test_input.py +++ b/tests/integration/test_input.py @@ -183,6 +183,6 @@ async def test_fully_controlled_input(fully_controlled_input: AppHarness): clear_button.click() assert AppHarness._poll_for(lambda: on_change_input.get_attribute("value") == "") # potential bug: clearing the on_change field doesn't itself trigger on_change - # assert backend_state.text == "" - # assert debounce_input.get_attribute("value") == "" - # assert value_input.get_attribute("value") == "" + # assert backend_state.text == "" #noqa: ERA001 + # assert debounce_input.get_attribute("value") == "" #noqa: ERA001 + # assert value_input.get_attribute("value") == "" #noqa: ERA001 diff --git a/tests/units/components/base/test_bare.py b/tests/units/components/base/test_bare.py index c30ffaf15..178820cff 100644 --- a/tests/units/components/base/test_bare.py +++ b/tests/units/components/base/test_bare.py @@ -13,9 +13,6 @@ STATE_VAR = Var(_js_expr="default_state.name") ("{}", '{"{}"}'), (None, '{""}'), (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): diff --git a/tests/units/components/media/test_image.py b/tests/units/components/media/test_image.py index f8618347c..742bd8c38 100644 --- a/tests/units/components/media/test_image.py +++ b/tests/units/components/media/test_image.py @@ -42,7 +42,7 @@ def test_set_src_str(): "`pic2.jpeg`", ) # 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): diff --git a/tests/units/components/test_component.py b/tests/units/components/test_component.py index a2485d10e..8b02b5d99 100644 --- a/tests/units/components/test_component.py +++ b/tests/units/components/test_component.py @@ -917,17 +917,17 @@ def test_invalid_event_handler_args(component2, test_state): # # Event Handler types must match # with pytest.raises(EventHandlerArgTypeMismatch): # 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): - # 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): - # 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_bool) - # component2.create(on_user_visited_count_changed=test_state.do_something_with_int) - # component2.create(on_user_list_changed=test_state.do_something_with_list_str) + # component2.create(on_open=test_state.do_something_with_int) #noqa: ERA001 + # 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) #noqa: ERA001 + # component2.create(on_user_list_changed=test_state.do_something_with_list_str) #noqa: ERA001 # lambda cannot return weird values. with pytest.raises(ValueError): @@ -1436,8 +1436,6 @@ def test_get_vars(component, exp_vars): comp_vars, 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) diff --git a/tests/units/test_app.py b/tests/units/test_app.py index 216d36f62..3b3e223b1 100644 --- a/tests/units/test_app.py +++ b/tests/units/test_app.py @@ -899,8 +899,6 @@ class DynamicState(BaseState): loaded: int = 0 counter: int = 0 - # side_effect_counter: int = 0 - def on_load(self): """Event handler for page on_load, should trigger for all navigation events.""" self.loaded = self.loaded + 1 @@ -917,7 +915,6 @@ class DynamicState(BaseState): Returns: same as self.dynamic """ - # self.side_effect_counter = self.side_effect_counter + 1 return self.dynamic 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, f"comp_{arg_name}": exp_val, constants.CompileVars.IS_HYDRATED: False, - # "side_effect_counter": exp_index, "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) assert state.loaded == 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): await app.state_manager.close() diff --git a/tests/units/test_event.py b/tests/units/test_event.py index 4399ab2a0..820c947f2 100644 --- a/tests/units/test_event.py +++ b/tests/units/test_event.py @@ -209,10 +209,6 @@ def test_event_redirect(input, output): assert isinstance(spec, EventSpec) 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 diff --git a/tests/units/test_sqlalchemy.py b/tests/units/test_sqlalchemy.py index b18799e0c..23e315785 100644 --- a/tests/units/test_sqlalchemy.py +++ b/tests/units/test_sqlalchemy.py @@ -127,8 +127,8 @@ def test_automigration( assert result[0].b == 4.2 # No-op - # assert Model.migrate(autogenerate=True) - # assert len(list(versions.glob("*.py"))) == 4 + # assert Model.migrate(autogenerate=True) #noqa: ERA001 + # assert len(list(versions.glob("*.py"))) == 4 #noqa: ERA001 # drop table (AlembicSecond) model_registry.get_metadata().clear() diff --git a/tests/units/test_state.py b/tests/units/test_state.py index 8e61b8dae..a3a03d586 100644 --- a/tests/units/test_state.py +++ b/tests/units/test_state.py @@ -787,7 +787,6 @@ async def test_process_event_simple(test_state): assert test_state.num1 == 69 # The delta should contain the changes, including computed vars. - # assert update.delta == {"test_state": {"num1": 69, "sum": 72.14}} assert update.delta == { TestState.get_full_name(): {"num1": 69, "sum": 72.14, "upper": ""}, GrandchildState3.get_full_name(): {"computed": ""}, @@ -3485,10 +3484,10 @@ def test_mutable_models(): state.dirty_vars.clear() # Not yet supported ENG-4083 - # assert isinstance(state.dc, MutableProxy) - # state.dc.foo = "baz" - # assert state.dirty_vars == {"dc"} - # state.dirty_vars.clear() + # assert isinstance(state.dc, MutableProxy) #noqa: ERA001 + # state.dc.foo = "baz" #noqa: ERA001 + # assert state.dirty_vars == {"dc"} #noqa: ERA001 + # state.dirty_vars.clear() #noqa: ERA001 def test_get_value(): diff --git a/tests/units/test_telemetry.py b/tests/units/test_telemetry.py index 25ad91323..d8a77dfd6 100644 --- a/tests/units/test_telemetry.py +++ b/tests/units/test_telemetry.py @@ -34,12 +34,6 @@ def test_disable(): @pytest.mark.parametrize("event", ["init", "reinit", "run-dev", "run-prod", "export"]) def test_send(mocker, event): 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 pathlib_path_read_text_mock = mocker.patch( diff --git a/tests/units/test_var.py b/tests/units/test_var.py index 4940246e7..e1d107021 100644 --- a/tests/units/test_var.py +++ b/tests/units/test_var.py @@ -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"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( @@ -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)}") with pytest.raises(TypeError): print(eval(f"operand1_var {operator} operand2_var")) - # operand1_var.operation(op=operator, other=operand2_var) with pytest.raises(TypeError): print(eval(f"operand2_var {operator} operand1_var")) - # operand1_var.operation(op=operator, other=operand2_var, flip=True) @pytest.mark.parametrize(