diff --git a/pyproject.toml b/pyproject.toml index 65e0ab9..d92cf92 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,8 +24,7 @@ dependencies = [ [project.optional-dependencies] dev = [ - "black==22.3.0", - "isort==5.10.1", + "ruff==0.11.13", ] [project.urls] @@ -41,3 +40,31 @@ include = [ "/pyuptimekuma", ] +[tool.ruff] +target-version = "py312" +line-length = 88 + +[tool.ruff.lint] +preview = true +ignore = ["TRY003", "N818"] + + +[tool.ruff.lint.isort] +force-sort-within-sections = true +known-first-party = ["pyuptimekuma"] +combine-as-imports = true +split-on-trailing-comma = false + +[tool.ruff.lint.pydocstyle] +convention = "numpy" + +[tool.ruff.format] +preview = true +quote-style = "double" +indent-style = "space" + +[tool.ruff.lint.mccabe] +max-complexity = 25 + + + diff --git a/pyuptimekuma/__init__.py b/pyuptimekuma/__init__.py index 5a548b7..b3e1f91 100644 --- a/pyuptimekuma/__init__.py +++ b/pyuptimekuma/__init__.py @@ -7,7 +7,7 @@ from .models import MonitorType, UptimeKumaApiResponse, UptimeKumaMonitor from .uptimekuma import UptimeKuma -__version__ = '0.0.0' +__version__ = "0.0.0" __all__ = [ "MonitorType", @@ -17,4 +17,4 @@ "UptimeKumaConnectionException", "UptimeKumaException", "UptimeKumaMonitor", -] \ No newline at end of file +] diff --git a/pyuptimekuma/decorator.py b/pyuptimekuma/decorator.py index a14b7e4..3b9ff59 100644 --- a/pyuptimekuma/decorator.py +++ b/pyuptimekuma/decorator.py @@ -1,7 +1,6 @@ """Decorator for Uptime Kuma""" from __future__ import annotations -import asyncio from typing import TYPE_CHECKING import aiohttp @@ -45,7 +44,7 @@ async def wrapper(*args, **kwargs): f"Request exception for '{url}' with - {exception}" ) from exception - except asyncio.TimeoutError: + except TimeoutError: raise exceptions.UptimeKumaConnectionException( f"Request timeout for '{url}'" ) from None @@ -63,7 +62,6 @@ async def wrapper(*args, **kwargs): LOGGER.debug("Requesting %s returned %s", url, result) - # print(result) response = UptimeKumaApiResponse.from_prometheus( {"monitors": result, "_api_path": api_path, "_method": method} ) diff --git a/pyuptimekuma/models.py b/pyuptimekuma/models.py index 0e656e3..75673a9 100644 --- a/pyuptimekuma/models.py +++ b/pyuptimekuma/models.py @@ -22,7 +22,7 @@ class MonitorType(StrEnum): SQL = "sqlserver" JSON_QUERY = "json-query" GROUP = "group" - DOCKER ="docker" + DOCKER = "docker" GRPC_KEYWORD = "grpc-keyword" REAL_BROWSER = "real-browser" GAMEDIG = "gamedig" @@ -34,6 +34,7 @@ class MonitorType(StrEnum): REDIS = "redis" TAILSCALE_PING = "tailscale-ping" + class UptimeKumaBaseModel: """UptimeKumaBaseModel."""