Skip to content

Commit

Permalink
Update ruff & yamllint (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
edenhaus authored Feb 15, 2024
1 parent 8ac8c7b commit e5521ca
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion deebot_client/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion deebot_client/commands/json/charge_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down
4 changes: 1 addition & 3 deletions deebot_client/commands/json/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down
2 changes: 1 addition & 1 deletion deebot_client/commands/json/water_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ safe = true



[tool.ruff]
[tool.ruff.lint]
select = [
"ALL",
]
Expand Down Expand Up @@ -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 = [
Expand All @@ -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
Expand All @@ -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


Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit e5521ca

Please sign in to comment.