From 57cd22eb9564da47ed0ba5f66bb12fcc099c9b2e Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Sat, 6 Apr 2024 12:40:57 -0400 Subject: [PATCH] Minor typing fixes --- check_home_assistant_state.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/check_home_assistant_state.py b/check_home_assistant_state.py index 766b8b1..37a0b46 100755 --- a/check_home_assistant_state.py +++ b/check_home_assistant_state.py @@ -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(