From de0450b1300fb3b669e20607ad6068e34538de00 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 28 Jun 2023 08:19:11 +0200 Subject: [PATCH] fix linting --- prometheuspvesd/config.py | 5 +++-- prometheuspvesd/discovery.py | 2 +- prometheuspvesd/utils.py | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/prometheuspvesd/config.py b/prometheuspvesd/config.py index d6b5084..3556393 100644 --- a/prometheuspvesd/config.py +++ b/prometheuspvesd/config.py @@ -3,6 +3,7 @@ import os from pathlib import Path, PurePath +from typing import ClassVar import anyconfig import environs @@ -20,7 +21,7 @@ cache_dir = AppDirs("prometheus-pve-sd").user_cache_dir default_output_file = os.path.join(cache_dir, "pve.json") -class Config(): +class Config: """ Create an object with all necessary settings. @@ -30,7 +31,7 @@ class Config(): - provides cli parameters """ - SETTINGS = { + SETTINGS: ClassVar[dict[dict]] = { "metrics.enabled": { "default": True, "env": "METRICS_ENABLED", diff --git a/prometheuspvesd/discovery.py b/prometheuspvesd/discovery.py index b835b48..bf1f192 100644 --- a/prometheuspvesd/discovery.py +++ b/prometheuspvesd/discovery.py @@ -20,7 +20,7 @@ PROPAGATION_TIME = Summary( HOST_GAUGE = Gauge("pve_sd_hosts", "Number of hosts discovered by PVE SD") -class Discovery(): +class Discovery: """Prometheus PVE Service Discovery.""" def __init__(self): diff --git a/prometheuspvesd/utils.py b/prometheuspvesd/utils.py index 79fa804..a444a83 100644 --- a/prometheuspvesd/utils.py +++ b/prometheuspvesd/utils.py @@ -2,6 +2,7 @@ """Global utility methods and classes.""" from distutils.util import strtobool +from typing import ClassVar def to_bool(string): @@ -11,7 +12,7 @@ def to_bool(string): class Singleton(type): """Meta singleton class.""" - _instances = {} + _instances: ClassVar[dict] = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: