bump ruff version to 0.9.3

This commit is contained in:
Lendemor 2025-01-28 17:19:02 +01:00
parent 9e36efbd21
commit e7f5f9268f
12 changed files with 17 additions and 18 deletions

View File

@ -3,7 +3,7 @@ fail_fast: true
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.8.2
rev: v0.9.3
hooks:
- id: ruff-format
args: [reflex, tests]

View File

@ -61,7 +61,7 @@ dill = ">=0.3.8"
toml = ">=0.10.2,<1.0"
pytest-asyncio = ">=0.24.0"
pytest-cov = ">=4.0.0,<7.0"
ruff = "0.8.2"
ruff = "0.9.3"
pandas = ">=2.1.1,<3.0"
pillow = ">=10.0.0,<12.0"
plotly = ">=5.13.0,<6.0"
@ -86,7 +86,7 @@ target-version = "py310"
output-format = "concise"
lint.isort.split-on-trailing-comma = false
lint.select = ["B", "C4", "D", "E", "ERA", "F", "FURB", "I", "N", "PERF", "PTH", "RUF", "SIM", "T", "TRY", "W"]
lint.ignore = ["B008", "D205", "E501", "F403", "SIM115", "RUF006", "RUF012", "TRY0"]
lint.ignore = ["B008", "D205", "E501", "F403", "SIM115", "RUF006", "RUF008", "RUF012", "TRY0"]
lint.pydocstyle.convention = "google"
[tool.ruff.lint.per-file-ignores]

View File

@ -1280,7 +1280,7 @@ class App(MiddlewareMixin, LifespanMixin):
):
raise ValueError(
f"Provided custom {handler_domain} exception handler `{_fn_name}` has the wrong argument order."
f"Expected `{required_arg}` as the {required_arg_index+1} argument but got `{list(arg_annotations.keys())[required_arg_index]}`"
f"Expected `{required_arg}` as the {required_arg_index + 1} argument but got `{list(arg_annotations.keys())[required_arg_index]}`"
)
if not issubclass(arg_annotations[required_arg], Exception):

View File

@ -625,8 +625,7 @@ class Component(BaseComponent, ABC):
if props is None:
# Add component props to the tag.
props = {
attr[:-1] if attr.endswith("_") else attr: getattr(self, attr)
for attr in self.get_props()
attr.removesuffix("_"): getattr(self, attr) for attr in self.get_props()
}
# Add ref to element if `id` is not None.

View File

@ -345,7 +345,7 @@ class DataEditor(NoSSRComponent):
data_callback = f"getData_{editor_id}"
self.get_cell_content = Var(_js_expr=data_callback) # type: ignore
code = [f"function {data_callback}([col, row])" "{"]
code = [f"function {data_callback}([col, row]){{"]
columns_path = str(self.columns)
data_path = str(self.data)

View File

@ -772,7 +772,7 @@ def _validate_project_info():
pyproject_toml = _get_package_config()
project = pyproject_toml["project"]
console.print(
f'Double check the information before publishing: {project["name"]} version {project["version"]}'
f"Double check the information before publishing: {project['name']} version {project['version']}"
)
console.print("Update or enter to keep the current information.")
@ -784,7 +784,7 @@ def _validate_project_info():
author["name"] = console.ask("Author Name", default=author.get("name", ""))
author["email"] = console.ask("Author Email", default=author.get("email", ""))
console.print(f'Current keywords are: {project.get("keywords") or []}')
console.print(f"Current keywords are: {project.get('keywords') or []}")
keyword_action = console.ask(
"Keep, replace or append?", choices=["k", "r", "a"], default="k"
)

View File

@ -332,7 +332,7 @@ class EventSpec(EventActionsMixin):
arg = None
try:
for arg in args:
values.append(LiteralVar.create(value=arg)) # noqa: PERF401
values.append(LiteralVar.create(value=arg)) # noqa: PERF401, RUF100
except TypeError as e:
raise EventHandlerTypeError(
f"Arguments to event handlers must be Vars or JSON-serializable. Got {arg} of type {type(arg)}."

View File

@ -1851,7 +1851,7 @@ def initialize_main_module_index_from_generation(app_name: str, generation_hash:
[
resp.text,
"",
"" "def index() -> rx.Component:",
"def index() -> rx.Component:",
f" return {render_func_name}()",
"",
"",

View File

@ -444,7 +444,7 @@ class Var(Generic[VAR_TYPE]):
_default_var_type: ClassVar[GenericType] = default_type
ToVarOperation.__name__ = f'To{cls.__name__.removesuffix("Var")}Operation'
ToVarOperation.__name__ = f"To{cls.__name__.removesuffix('Var')}Operation"
_var_subclasses.append(VarSubclassEntry(cls, ToVarOperation, python_types))

View File

@ -185,7 +185,7 @@ def date_compare_operation(
The result of the operation.
"""
return var_operation_return(
f"({lhs} { '<' if strict else '<='} {rhs})",
f"({lhs} {'<' if strict else '<='} {rhs})",
bool,
)

View File

@ -89,9 +89,9 @@ async def test_connection_banner(connection_banner: AppHarness):
driver = connection_banner.frontend()
ss = SessionStorage(driver)
assert connection_banner._poll_for(
lambda: ss.get("token") is not None
), "token not found"
assert connection_banner._poll_for(lambda: ss.get("token") is not None), (
"token not found"
)
assert connection_banner._poll_for(lambda: not has_error_modal(driver))

View File

@ -55,13 +55,13 @@ def create_color_var(color):
Color,
),
(
create_color_var(f'{rx.color(ColorState.color, f"{ColorState.shade}")}'), # type: ignore
create_color_var(f"{rx.color(ColorState.color, f'{ColorState.shade}')}"), # type: ignore
f'("var(--"+{color_state_name!s}.color+"-"+{color_state_name!s}.shade+")")',
str,
),
(
create_color_var(
f'{rx.color(f"{ColorState.color}", f"{ColorState.shade}")}' # type: ignore
f"{rx.color(f'{ColorState.color}', f'{ColorState.shade}')}" # type: ignore
),
f'("var(--"+{color_state_name!s}.color+"-"+{color_state_name!s}.shade+")")',
str,