diff options
author | John L. Villalovos <john@sodarock.com> | 2021-11-21 14:28:07 -0800 |
---|---|---|
committer | John L. Villalovos <john@sodarock.com> | 2021-11-21 22:37:56 -0800 |
commit | 8da0b758c589f608a6ae4eeb74b3f306609ba36d (patch) | |
tree | 000490448600400d97def53cd6dbb0167f61a157 | |
parent | 00d7b202efb3a2234cf6c5ce09a48397a40b8388 (diff) | |
download | gitlab-8da0b758c589f608a6ae4eeb74b3f306609ba36d.tar.gz |
chore: add type-hints to gitlab/v4/objects/services.py
-rw-r--r-- | gitlab/v4/objects/services.py | 20 | ||||
-rw-r--r-- | pyproject.toml | 1 |
2 files changed, 15 insertions, 6 deletions
diff --git a/gitlab/v4/objects/services.py b/gitlab/v4/objects/services.py index 3d7d377..a62fdf0 100644 --- a/gitlab/v4/objects/services.py +++ b/gitlab/v4/objects/services.py @@ -1,3 +1,5 @@ +from typing import Any, cast, Dict, List, Optional, Union + from gitlab import cli from gitlab.base import RESTManager, RESTObject from gitlab.mixins import ( @@ -253,7 +255,9 @@ class ProjectServiceManager(GetMixin, UpdateMixin, DeleteMixin, ListMixin, RESTM "youtrack": (("issues_url", "project_url"), ("description", "push_events")), } - def get(self, id, **kwargs): + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> ProjectService: """Retrieve a single object. Args: @@ -270,11 +274,16 @@ class ProjectServiceManager(GetMixin, UpdateMixin, DeleteMixin, ListMixin, RESTM GitlabAuthenticationError: If authentication is not correct GitlabGetError: If the server cannot perform the request """ - obj = super(ProjectServiceManager, self).get(id, **kwargs) + obj = cast(ProjectService, super(ProjectServiceManager, self).get(id, **kwargs)) obj.id = id return obj - def update(self, id=None, new_data=None, **kwargs): + def update( + self, + id: Optional[Union[str, int]] = None, + new_data: Optional[Dict[str, Any]] = None, + **kwargs: Any + ) -> Dict[str, Any]: """Update an object on the server. Args: @@ -290,11 +299,12 @@ class ProjectServiceManager(GetMixin, UpdateMixin, DeleteMixin, ListMixin, RESTM GitlabUpdateError: If the server cannot perform the request """ new_data = new_data or {} - super(ProjectServiceManager, self).update(id, new_data, **kwargs) + result = super(ProjectServiceManager, self).update(id, new_data, **kwargs) self.id = id + return result @cli.register_custom_action("ProjectServiceManager") - def available(self, **kwargs): + def available(self, **kwargs: Any) -> List[str]: """List the services known by python-gitlab. Returns: diff --git a/pyproject.toml b/pyproject.toml index 7fde0e2..d9cff74 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,6 @@ module = [ "docs.ext.*", "gitlab.v4.objects.files", "gitlab.v4.objects.labels", - "gitlab.v4.objects.services", "gitlab.v4.objects.sidekiq", "tests.functional.*", "tests.functional.api.*", |