From 3ca4fdf445372ca9d9a5e7887381787fbd441242 Mon Sep 17 00:00:00 2001 From: flashdagger Date: Mon, 1 Apr 2024 10:20:47 +0200 Subject: [PATCH] refactor type annotations Signed-off-by: flashdagger --- zammadoo/client.py | 2 +- zammadoo/resource.py | 6 +++--- zammadoo/users.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/zammadoo/client.py b/zammadoo/client.py index bbc8783..01f422f 100644 --- a/zammadoo/client.py +++ b/zammadoo/client.py @@ -235,7 +235,7 @@ def request( params: Optional["StringKeyMapping"] = None, json: Optional["StringKeyMapping"] = None, **kwargs, - ): + ) -> "JsonType": """ Perform a request on the API URL. diff --git a/zammadoo/resource.py b/zammadoo/resource.py index a8f4435..50bf4d9 100644 --- a/zammadoo/resource.py +++ b/zammadoo/resource.py @@ -2,7 +2,7 @@ # -*- coding: UTF-8 -*- from datetime import datetime -from typing import TYPE_CHECKING, Any, List, Optional, Tuple, Union +from typing import TYPE_CHECKING, Any, List, Optional, Tuple from .resources import ResourcesT, _T_co from .utils import DateTime, FrozenInfo, _AttributeBase @@ -11,7 +11,7 @@ from typing import Literal, overload from .users import User - from .utils import AttributeT, JsonDict, JsonType + from .utils import JsonDict, JsonType class TypedResourceDict(JsonDict): @overload @@ -138,5 +138,5 @@ def delete(self) -> None: class NamedResource(MutableResource): active: bool #: - name: Union[str, "AttributeT[str]"] #: + name: str #: note: Optional[str] #: diff --git a/zammadoo/users.py b/zammadoo/users.py index f32dfab..bc335b3 100644 --- a/zammadoo/users.py +++ b/zammadoo/users.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: UTF-8 -*- -from typing import TYPE_CHECKING, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Dict, List, Optional, Union, cast from .groups import Group from .resource import NamedResource, OptionalUserProperty @@ -39,7 +39,7 @@ class User(NamedResource): login: str #: users login name login_failed: int #: mobile: str #: - name = AttributeT[str]("login") #: alias for :attr:`login` + name = cast(str, AttributeT[str]("login")) #: alias for :attr:`login` out_of_office: bool #: out_of_office_end_at = OptionalDateTime() out_of_office_replacement = OptionalUserProperty()