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