Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing return type hint for resources.py #1906

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
38 changes: 19 additions & 19 deletions jira/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def __getstate__(self) -> dict[str, Any]:
"""Pickling the resource."""
return vars(self)

def __setstate__(self, raw_pickled: dict[str, Any]):
def __setstate__(self, raw_pickled: dict[str, Any]) -> None:
"""Unpickling of the resource."""
# https://stackoverflow.com/a/50888571/7724187
vars(self).update(raw_pickled)
Expand Down Expand Up @@ -246,7 +246,7 @@ def find(
self,
id: tuple[str, ...] | int | str,
params: dict[str, str] | None = None,
):
) -> None:
"""Finds a resource based on the input parameters.

Args:
Expand All @@ -267,7 +267,7 @@ def _find_by_url(
self,
url: str,
params: dict[str, str] | None = None,
):
) -> None:
"""Finds a resource on the specified url.

The resource is loaded with the JSON data returned by doing a
Expand Down Expand Up @@ -299,7 +299,7 @@ def update(
jira: JIRA | None = None,
notify: bool = True,
**kwargs: Any,
):
) -> None:
"""Update this resource on the server.

Keyword arguments are marshalled into a dict before being sent. If this resource doesn't support ``PUT``, a :py:exc:`.JIRAError`
Expand Down Expand Up @@ -437,7 +437,7 @@ def _load(
headers=CaseInsensitiveDict(),
params: dict[str, str] | None = None,
path: str | None = None,
):
) -> None:
"""Load a resource.

Args:
Expand All @@ -459,7 +459,7 @@ def _load(
j = j[path]
self._parse_raw(j)

def _parse_raw(self, raw: dict[str, Any]):
def _parse_raw(self, raw: dict[str, Any]) -> None:
"""Parse a raw dictionary to create a resource.

Args:
Expand Down Expand Up @@ -492,7 +492,7 @@ def __init__(
self._parse_raw(raw)
self.raw: dict[str, Any] = cast(dict[str, Any], self.raw)

def get(self):
def get(self) -> bytes | None:
"""Return the file content as a string."""
r = self._session.get(self.content, headers={"Accept": "*/*"})
return r.content
Expand All @@ -517,7 +517,7 @@ def __init__(
self._parse_raw(raw)
self.raw: dict[str, Any] = cast(dict[str, Any], self.raw)

def delete(self, moveIssuesTo: str | None = None): # type: ignore[override]
def delete(self, moveIssuesTo: str | None = None) -> None: # type: ignore[override]
"""Delete this component from the server.

Args:
Expand Down Expand Up @@ -754,7 +754,7 @@ class _Worklog:
def __init__(self) -> None:
self.worklogs: list[Worklog] = []

def __init__(self):
def __init__(self) -> None:
self.assignee: UnknownResource | None = None
self.attachment: list[Attachment] = []
self.comment = self._Comment()
Expand Down Expand Up @@ -801,7 +801,7 @@ def update( # type: ignore[override] # incompatible supertype ignored
jira: JIRA | None = None,
notify: bool = True,
**fieldargs,
):
) -> None:
"""Update this issue on the server.

Each keyword argument (other than the predefined ones) is treated as a field name and the argument's value is treated as
Expand Down Expand Up @@ -872,7 +872,7 @@ def get_field(self, field_name: str) -> Any:
else:
return getattr(self.fields, field_name)

def add_field_value(self, field: str, value: str):
def add_field_value(self, field: str, value: str) -> None:
"""Add a value to a field that supports multiple values, without resetting the existing values.

This should work with: labels, multiple checkbox lists, multiple select
Expand All @@ -883,15 +883,15 @@ def add_field_value(self, field: str, value: str):
"""
super().update(fields={"update": {field: [{"add": value}]}})

def delete(self, deleteSubtasks=False):
def delete(self, deleteSubtasks=False) -> None:
"""Delete this issue from the server.

Args:
deleteSubtasks (bool): True to also delete subtasks. If any are present the Issue won't be deleted (Default: ``True``)
"""
super().delete(params={"deleteSubtasks": deleteSubtasks})

def permalink(self):
def permalink(self) -> str:
"""Get the URL of the issue, the browsable one not the REST one.

Returns:
Expand Down Expand Up @@ -926,7 +926,7 @@ def update( # type: ignore[override]
visibility: dict[str, str] | None = None,
is_internal: bool = False,
notify: bool = True,
):
) -> None:
"""Update a comment.

Keyword arguments are marshalled into a dict before being sent.
Expand Down Expand Up @@ -991,7 +991,7 @@ def update( # type: ignore[override]
globalId=None,
application=None,
relationship=None,
):
) -> None:
"""Update a RemoteLink. 'object' is required.

For definitions of the allowable fields for 'object' and the keyword arguments 'globalId', 'application' and 'relationship',
Expand Down Expand Up @@ -1149,7 +1149,7 @@ def __init__(

def delete( # type: ignore[override]
self, adjustEstimate: str | None = None, newEstimate=None, increaseBy=None
):
) -> None:
"""Delete this worklog entry from its associated issue.

Args:
Expand Down Expand Up @@ -1188,7 +1188,7 @@ def _find_by_url(
self,
url: str,
params: dict[str, str] | None = None,
):
) -> None:
super()._find_by_url(url, params)
# An IssueProperty never returns "self" identifier, set it
self.self = url
Expand Down Expand Up @@ -1287,7 +1287,7 @@ def update( # type: ignore[override]
self,
users: str | list | tuple | None = None,
groups: str | list | tuple | None = None,
):
) -> None:
"""Add the specified users or groups to this project role. One of ``users`` or ``groups`` must be specified.

Args:
Expand All @@ -1313,7 +1313,7 @@ def add_user(
self,
users: str | list | tuple | None = None,
groups: str | list | tuple | None = None,
):
) -> None:
"""Add the specified users or groups to this project role. One of ``users`` or ``groups`` must be specified.

Args:
Expand Down
Loading