Skip to content

Commit

Permalink
Bump ruff to 0.6.0 (#486)
Browse files Browse the repository at this point in the history
* Bump Ruff to v0.6.0

* axis/__main__.py:74:13: ASYNC110 Use `anyio.Event` instead of awaiting `anyio.sleep` in a `while` loop
   |
72 |       try:
73 |           if events:
74 |               while True:
   |  _____________^
75 | |                 await asyncio.sleep(1)
   | |______________________________________^ ASYNC110
76 |
77 |       except asyncio.CancelledError:
   |

* axis/models/ptz_cgi.py:272:13: PLR1730 [*] Replace `if` statement with `z = max(z, 1)`
    |
270 |           if self.area_zoom:
271 |               x, y, z = self.area_zoom
272 |               if z < 1:
    |  _____________^
273 | |                 z = 1
    | |_____________________^ PLR1730
274 |               data["areazoom"] = f"{x},{y},{z}"
275 |           if self.center or self.area_zoom:
    |
    = help: Replace with `z = max(z, 1)`
  • Loading branch information
Kane610 authored Aug 16, 2024
1 parent 9a2fb46 commit f91cf18
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.2
rev: v0.6.0
hooks:
- id: ruff
args:
Expand Down
4 changes: 2 additions & 2 deletions axis/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ async def main(

try:
if events:
while True:
await asyncio.sleep(1)
done = asyncio.Event()
await done.wait()

except asyncio.CancelledError:
device.stream.stop()
Expand Down
3 changes: 1 addition & 2 deletions axis/models/ptz_cgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ def data(self) -> dict[str, str] | None:
data["center"] = f"{x},{y}"
if self.area_zoom:
x, y, z = self.area_zoom
if z < 1:
z = 1
z = max(z, 1)
data["areazoom"] = f"{x},{y},{z}"
if self.center or self.area_zoom:
if self.image_width:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ requirements_test = [
"pytest-asyncio==0.23.8",
"pytest-cov==5.0.0",
"respx==0.21.1",
"ruff==0.5.7",
"ruff==0.6.0",
"types-orjson==3.6.2",
"types-xmltodict==v0.13.0.3",
]
Expand Down

0 comments on commit f91cf18

Please sign in to comment.