Minor typing fixes

This commit is contained in:
Adam Goldsmith 2024-04-06 12:40:57 -04:00
parent 8d048bab85
commit 57cd22eb95

View File

@ -8,7 +8,7 @@ import logging
import re
import sys
from urllib.parse import urljoin
from typing import Optional
from typing import Any
from pathlib import Path
import requests
@ -71,15 +71,15 @@ class Entities(nagiosplugin.Resource):
device_class: str
numeric: bool
filters: list[AttributeFilter]
attribute: Optional[str]
attribute: str | None
friendly_name: bool
ignore_missing: bool
include: list[str]
exclude: list[str]
min: Optional[float] = None
max: Optional[float] = None
min: float | None = None
max: float | None = None
def hass_get(self, endpoint: str) -> requests.Response:
def hass_get(self, endpoint: str) -> Any:
headers = {
"Authorization": "Bearer " + self.token,
"Content-Type": "application/json",
@ -151,9 +151,9 @@ class RegexContext(nagiosplugin.Context):
def __init__(
self,
name: str,
ok: str = None,
warning: str = None,
critical: str = None,
ok: str | None = None,
warning: str | None = None,
critical: str | None = None,
fmt_metric=None,
result_cls=nagiosplugin.Result,
):
@ -207,7 +207,7 @@ class Icinga2ConfAction(argparse.Action):
self,
param_prefix: str,
parser: argparse.ArgumentParser,
order: Optional[int] = None,
order: int | None = None,
):
for action in parser._actions:
if action.dest in [self.dest, "help", "version"] or isinstance(