Skip to content

Commit

Permalink
chore: add overload hints
Browse files Browse the repository at this point in the history
  • Loading branch information
Olegt0rr committed Sep 18, 2023
1 parent 9e6dc7d commit c067717
Showing 1 changed file with 147 additions and 1 deletion.
148 changes: 147 additions & 1 deletion yatracker/tracker/categories/issues.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Any, TypeVar
from typing import Any, TypeVar, overload

from yatracker.tracker.base import BaseTracker
from yatracker.types import (
Expand All @@ -16,6 +16,23 @@


class Issues(BaseTracker):
@overload
async def get_issue(
self,
issue_id: str,
expand: str | None = None,
) -> FullIssue:
...

@overload
async def get_issue(
self,
issue_id: str,
expand: str | None = None,
_type: type[IssueT_co] = ...,
) -> IssueT_co:
...

async def get_issue(
self,
issue_id: str,
Expand All @@ -40,6 +57,25 @@ async def get_issue(
)
return self._decode(_type, data)

@overload
async def edit_issue(
self,
issue_id: str,
version: str | int | None = None,
**kwargs,
) -> FullIssue:
...

@overload
async def edit_issue(
self,
issue_id: str,
version: str | int | None = None,
_type: type[IssueT_co] = ...,
**kwargs,
) -> IssueT_co:
...

async def edit_issue(
self,
issue_id: str,
Expand All @@ -63,6 +99,45 @@ async def edit_issue(
)
return self._decode(_type, data)

@overload
async def create_issue(
self,
summary: str,
queue: str | int | dict,
*,
parent: Issue | str | None = None,
description: str | None = None,
sprint: dict[str, str] | None = None,
type_: IssueType | None = None,
priority: int | str | Priority | None = None,
followers: list[str] | None = None,
assignee: list[str] | None = None,
unique: str | None = None,
attachment_ids: list[str] | None = None,
_type: type[IssueT_co] = ...,
**kwargs,
) -> IssueT_co:
...

@overload
async def create_issue(
self,
summary: str,
queue: str | int | dict,
*,
parent: Issue | str | None = None,
description: str | None = None,
sprint: dict[str, str] | None = None,
type_: IssueType | None = None,
priority: int | str | Priority | None = None,
followers: list[str] | None = None,
assignee: list[str] | None = None,
unique: str | None = None,
attachment_ids: list[str] | None = None,
**kwargs,
) -> FullIssue:
...

# ruff: noqa: ARG002 PLR0913
async def create_issue(
self,
Expand Down Expand Up @@ -94,6 +169,37 @@ async def create_issue(
)
return self._decode(_type, data)

@overload
async def move_issue(
self,
issue_id: str,
queue_key: str,
*,
notify: bool = True,
notify_author: bool = False,
move_all_fields: bool = False,
initial_status: bool = False,
expand: str | None = None,
_type: type[IssueT_co] = ...,
**kwargs,
) -> IssueT_co:
...

@overload
async def move_issue(
self,
issue_id: str,
queue_key: str,
*,
notify: bool = True,
notify_author: bool = False,
move_all_fields: bool = False,
initial_status: bool = False,
expand: str | None = None,
**kwargs,
) -> FullIssue:
...

async def move_issue(
self,
issue_id: str,
Expand Down Expand Up @@ -183,6 +289,31 @@ async def count_issues(
)
return self._decode(int, data)

@overload
async def find_issues(
self,
filter_: dict[str, str] | None = None,
query: str | None = None,
order: str | None = None,
expand: str | None = None,
keys: str | None = None,
queue: str | None = None,
) -> list[FullIssue]:
...

@overload
async def find_issues(
self,
filter_: dict[str, str] | None = None,
query: str | None = None,
order: str | None = None,
expand: str | None = None,
keys: str | None = None,
queue: str | None = None,
_type: type[IssueT_co] = ...,
) -> list[IssueT_co]:
...

async def find_issues(
self,
filter_: dict[str, str] | None = None,
Expand Down Expand Up @@ -215,6 +346,21 @@ async def find_issues(
)
return self._decode(list[_type], data) # type: ignore[valid-type]

@overload
async def get_issue_links(
self,
issue_id: str,
) -> list[FullIssue]:
...

@overload
async def get_issue_links(
self,
issue_id: str,
_type: type[IssueT_co | FullIssue] = ...,
) -> list[IssueT_co]:
...

async def get_issue_links(
self,
issue_id: str,
Expand Down

0 comments on commit c067717

Please sign in to comment.