diff --git a/atlassian/jira.py b/atlassian/jira.py index c44239dae..6496ae3c2 100644 --- a/atlassian/jira.py +++ b/atlassian/jira.py @@ -15,7 +15,7 @@ from typing_extensions import Literal # Python <=3.7 from .errors import ApiNotFoundError, ApiPermissionError from .rest_client import AtlassianRestAPI -from .typehints import T_id, T_resp_json +from .typehints import T_id, T_resp_json, copy_type log = logging.getLogger(__name__) @@ -26,6 +26,7 @@ class Jira(AtlassianRestAPI): Reference: https://docs.atlassian.com/software/jira/docs/api/REST/8.5.0/#api/2 """ + @copy_type(AtlassianRestAPI.__init__) def __init__(self, url: str, *args: Any, **kwargs: Any): if "api_version" not in kwargs: kwargs["api_version"] = "2" diff --git a/atlassian/typehints.py b/atlassian/typehints.py index 9fe43495d..423de97cf 100644 --- a/atlassian/typehints.py +++ b/atlassian/typehints.py @@ -1,7 +1,13 @@ -from typing import Union +from typing import Union, TypeVar, Callable, Any from typing_extensions import TypeAlias T_id: TypeAlias = Union[str, int] _Data: TypeAlias = Union[dict, str] T_resp_json: TypeAlias = Union[dict, None] + +_T = TypeVar("T") + +def copy_type(_:_T) -> Callable[[Any], _T]: + """Decorator to inherit typing from parent.""" + return lambda x: x