Skip to content

Commit 9fab5b6

Browse files
committed
Replace Black with Ruff for linting and formatting
1 parent 46a9fd0 commit 9fab5b6

File tree

4 files changed

+34
-8
lines changed

4 files changed

+34
-8
lines changed

pyproject.toml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ dependencies = [
2424

2525
[project.optional-dependencies]
2626
dev = [
27-
"black==22.3.0",
28-
"isort==5.10.1",
27+
"ruff==0.11.13",
2928
]
3029

3130
[project.urls]
@@ -41,3 +40,31 @@ include = [
4140
"/pyuptimekuma",
4241
]
4342

43+
[tool.ruff]
44+
target-version = "py312"
45+
line-length = 88
46+
47+
[tool.ruff.lint]
48+
preview = true
49+
ignore = ["TRY003", "N818"]
50+
51+
52+
[tool.ruff.lint.isort]
53+
force-sort-within-sections = true
54+
known-first-party = ["pyuptimekuma"]
55+
combine-as-imports = true
56+
split-on-trailing-comma = false
57+
58+
[tool.ruff.lint.pydocstyle]
59+
convention = "numpy"
60+
61+
[tool.ruff.format]
62+
preview = true
63+
quote-style = "double"
64+
indent-style = "space"
65+
66+
[tool.ruff.lint.mccabe]
67+
max-complexity = 25
68+
69+
70+

pyuptimekuma/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from .models import MonitorType, UptimeKumaApiResponse, UptimeKumaMonitor
88
from .uptimekuma import UptimeKuma
99

10-
__version__ = '0.0.0'
10+
__version__ = "0.0.0"
1111

1212
__all__ = [
1313
"MonitorType",
@@ -17,4 +17,4 @@
1717
"UptimeKumaConnectionException",
1818
"UptimeKumaException",
1919
"UptimeKumaMonitor",
20-
]
20+
]

pyuptimekuma/decorator.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Decorator for Uptime Kuma"""
22
from __future__ import annotations
33

4-
import asyncio
54
from typing import TYPE_CHECKING
65

76
import aiohttp
@@ -45,7 +44,7 @@ async def wrapper(*args, **kwargs):
4544
f"Request exception for '{url}' with - {exception}"
4645
) from exception
4746

48-
except asyncio.TimeoutError:
47+
except TimeoutError:
4948
raise exceptions.UptimeKumaConnectionException(
5049
f"Request timeout for '{url}'"
5150
) from None
@@ -63,7 +62,6 @@ async def wrapper(*args, **kwargs):
6362

6463
LOGGER.debug("Requesting %s returned %s", url, result)
6564

66-
# print(result)
6765
response = UptimeKumaApiResponse.from_prometheus(
6866
{"monitors": result, "_api_path": api_path, "_method": method}
6967
)

pyuptimekuma/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class MonitorType(StrEnum):
2222
SQL = "sqlserver"
2323
JSON_QUERY = "json-query"
2424
GROUP = "group"
25-
DOCKER ="docker"
25+
DOCKER = "docker"
2626
GRPC_KEYWORD = "grpc-keyword"
2727
REAL_BROWSER = "real-browser"
2828
GAMEDIG = "gamedig"
@@ -34,6 +34,7 @@ class MonitorType(StrEnum):
3434
REDIS = "redis"
3535
TAILSCALE_PING = "tailscale-ping"
3636

37+
3738
class UptimeKumaBaseModel:
3839
"""UptimeKumaBaseModel."""
3940

0 commit comments

Comments
 (0)