diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aad4a8fb..42959986 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ default_language_version: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.14 + rev: v0.2.1 hooks: - id: ruff args: @@ -55,7 +55,7 @@ repos: exclude_types: - python - repo: https://github.com/adrienverge/yamllint.git - rev: v1.33.0 + rev: v1.35.0 hooks: - id: yamllint - repo: local diff --git a/deebot_client/command.py b/deebot_client/command.py index f4aa8a8b..b5f73320 100644 --- a/deebot_client/command.py +++ b/deebot_client/command.py @@ -76,6 +76,7 @@ async def execute( ------- bot_reached (bool): True if the command was targeting the bot, and it responded in time. False otherwise. This value is not indicating if the command was executed successfully. + """ try: result = await self._execute(authenticator, device_info, event_bus) @@ -220,7 +221,7 @@ def _handle_response( result = self.handle(event_bus, data) return CommandResult(result.state, result.args) - if errno := response.get("errno", None): + if errno := response.get("errno"): match errno: case 4200: # bot offline diff --git a/deebot_client/commands/json/charge_state.py b/deebot_client/commands/json/charge_state.py index 3d62369b..3c81fae9 100644 --- a/deebot_client/commands/json/charge_state.py +++ b/deebot_client/commands/json/charge_state.py @@ -38,7 +38,7 @@ def _handle_body(cls, event_bus: EventBus, body: dict[str, Any]) -> HandlingResu return super()._handle_body(event_bus, body) status: State | None = None - if body.get("msg", None) == "fail": + if body.get("msg") == "fail": if body["code"] == "30007": # Already charging status = State.DOCKED elif body["code"] in ("3", "5"): diff --git a/deebot_client/commands/json/volume.py b/deebot_client/commands/json/volume.py index 71ce14f1..36ad1d99 100644 --- a/deebot_client/commands/json/volume.py +++ b/deebot_client/commands/json/volume.py @@ -27,9 +27,7 @@ def _handle_body_data_dict( :return: A message response """ - event_bus.notify( - VolumeEvent(volume=data["volume"], maximum=data.get("total", None)) - ) + event_bus.notify(VolumeEvent(volume=data["volume"], maximum=data.get("total"))) return HandlingResult.success() diff --git a/deebot_client/commands/json/water_info.py b/deebot_client/commands/json/water_info.py index f4c13bdf..1892d667 100644 --- a/deebot_client/commands/json/water_info.py +++ b/deebot_client/commands/json/water_info.py @@ -27,7 +27,7 @@ def _handle_body_data_dict( :return: A message response """ - mop_attached = data.get("enable", None) + mop_attached = data.get("enable") if mop_attached is not None: mop_attached = bool(mop_attached) diff --git a/pyproject.toml b/pyproject.toml index c56466b6..f5809673 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ safe = true -[tool.ruff] +[tool.ruff.lint] select = [ "ALL", ] @@ -78,11 +78,11 @@ ignore = [ ] -[tool.ruff.flake8-pytest-style] +[tool.ruff.lint.flake8-pytest-style] fixture-parentheses = false -[tool.ruff.isort] +[tool.ruff.lint.isort] combine-as-imports = true force-sort-within-sections = true known-first-party = [ @@ -91,7 +91,7 @@ known-first-party = [ required-imports = ["from __future__ import annotations"] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "tests/**" = [ "D100", # Missing docstring in public module "D103", # Missing docstring in public function @@ -111,10 +111,10 @@ required-imports = ["from __future__ import annotations"] "svg.Path".msg = "Use map.Path instead" -[tool.ruff.mccabe] +[tool.ruff.lint.mccabe] max-complexity = 12 -[tool.ruff.pylint] +[tool.ruff.lint.pylint] max-args = 7 diff --git a/tests/fixtures/base.py b/tests/fixtures/base.py index 52b02aa1..c1951117 100644 --- a/tests/fixtures/base.py +++ b/tests/fixtures/base.py @@ -31,8 +31,8 @@ class ContainerConfiguration: image: str version: str = "latest" port: None | int = None - env: dict[str, Any] = field(default_factory=lambda: {}) - options: dict[str, Any] = field(default_factory=lambda: {}) + env: dict[str, Any] = field(default_factory=dict) + options: dict[str, Any] = field(default_factory=dict) max_wait_started: int = 30