Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion atlassian/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand All @@ -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"
Expand Down
8 changes: 7 additions & 1 deletion atlassian/typehints.py
Original file line number Diff line number Diff line change
@@ -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