diff options
author | John L. Villalovos <john@sodarock.com> | 2021-11-06 21:33:07 -0700 |
---|---|---|
committer | John L. Villalovos <john@sodarock.com> | 2021-11-08 07:21:17 -0800 |
commit | 7828ba2fd13c833c118a673bac09b215587ba33b (patch) | |
tree | 71312fe159fcc62ace0aeb24be94072ee4cf33cf /gitlab/v4/objects/settings.py | |
parent | 9a2f54cf044929dfc3fd89714ce657fa839e35d0 (diff) | |
download | gitlab-jlvillal/mypy_small_files_1.tar.gz |
chore: enforce type-hints on most files in gitlab/v4/objects/jlvillal/mypy_small_files_1
* Add type-hints to some of the files in gitlab/v4/objects/
* Fix issues detected when adding type-hints
* Changed mypy exclusion to explicitly list the 13 files that have
not yet had type-hints added.
Diffstat (limited to 'gitlab/v4/objects/settings.py')
-rw-r--r-- | gitlab/v4/objects/settings.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gitlab/v4/objects/settings.py b/gitlab/v4/objects/settings.py index 1c8be25..2e8ac79 100644 --- a/gitlab/v4/objects/settings.py +++ b/gitlab/v4/objects/settings.py @@ -1,3 +1,5 @@ +from typing import Any, cast, Dict, Optional, Union + from gitlab import exceptions as exc from gitlab import types from gitlab.base import RequiredOptional, RESTManager, RESTObject @@ -87,7 +89,12 @@ class ApplicationSettingsManager(GetWithoutIdMixin, UpdateMixin, RESTManager): } @exc.on_http_error(exc.GitlabUpdateError) - def update(self, id=None, new_data=None, **kwargs): + def update( + self, + id: Optional[Union[str, int]] = None, + new_data: Dict[str, Any] = None, + **kwargs: Any + ) -> Dict[str, Any]: """Update an object on the server. Args: @@ -106,4 +113,9 @@ class ApplicationSettingsManager(GetWithoutIdMixin, UpdateMixin, RESTManager): data = new_data.copy() if "domain_whitelist" in data and data["domain_whitelist"] is None: data.pop("domain_whitelist") - super(ApplicationSettingsManager, self).update(id, data, **kwargs) + return super(ApplicationSettingsManager, self).update(id, data, **kwargs) + + def get( + self, id: Optional[Union[int, str]] = None, **kwargs: Any + ) -> Optional[ApplicationSettings]: + return cast(ApplicationSettings, super().get(id=id, **kwargs)) |