diff options
author | Nejc Habjan <hab.nejc@gmail.com> | 2021-11-16 23:09:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 23:09:08 +0100 |
commit | 0951989cc4eaabc2e2bd82adeb38936d145ddec2 (patch) | |
tree | 32cc9473ec28cc3d10be3baff28a74e8a17ac718 /gitlab/v4/objects/users.py | |
parent | a553ee76affc6e1030ab0464a8bb998168239f4a (diff) | |
parent | 46773a82565cef231dc3391c12f296ac307cb95c (diff) | |
download | gitlab-0951989cc4eaabc2e2bd82adeb38936d145ddec2.tar.gz |
Merge pull request #1681 from python-gitlab/jlvillal/mypy_ensure_type_hints
Ensure get() methods have correct type-hints
Diffstat (limited to 'gitlab/v4/objects/users.py')
-rw-r--r-- | gitlab/v4/objects/users.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gitlab/v4/objects/users.py b/gitlab/v4/objects/users.py index ac75284..8649cba 100644 --- a/gitlab/v4/objects/users.py +++ b/gitlab/v4/objects/users.py @@ -74,6 +74,11 @@ class CurrentUserEmailManager(RetrieveMixin, CreateMixin, DeleteMixin, RESTManag _obj_cls = CurrentUserEmail _create_attrs = RequiredOptional(required=("email",)) + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> CurrentUserEmail: + return cast(CurrentUserEmail, super().get(id=id, lazy=lazy, **kwargs)) + class CurrentUserGPGKey(ObjectDeleteMixin, RESTObject): pass @@ -84,6 +89,11 @@ class CurrentUserGPGKeyManager(RetrieveMixin, CreateMixin, DeleteMixin, RESTMana _obj_cls = CurrentUserGPGKey _create_attrs = RequiredOptional(required=("key",)) + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> CurrentUserGPGKey: + return cast(CurrentUserGPGKey, super().get(id=id, lazy=lazy, **kwargs)) + class CurrentUserKey(ObjectDeleteMixin, RESTObject): _short_print_attr = "title" @@ -94,6 +104,11 @@ class CurrentUserKeyManager(RetrieveMixin, CreateMixin, DeleteMixin, RESTManager _obj_cls = CurrentUserKey _create_attrs = RequiredOptional(required=("title", "key")) + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> CurrentUserKey: + return cast(CurrentUserKey, super().get(id=id, lazy=lazy, **kwargs)) + class CurrentUserStatus(SaveMixin, RESTObject): _id_attr = None @@ -357,6 +372,9 @@ class UserEmailManager(RetrieveMixin, CreateMixin, DeleteMixin, RESTManager): _from_parent_attrs = {"user_id": "id"} _create_attrs = RequiredOptional(required=("email",)) + def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> UserEmail: + return cast(UserEmail, super().get(id=id, lazy=lazy, **kwargs)) + class UserActivities(RESTObject): _id_attr = "username" @@ -388,6 +406,9 @@ class UserGPGKeyManager(RetrieveMixin, CreateMixin, DeleteMixin, RESTManager): _from_parent_attrs = {"user_id": "id"} _create_attrs = RequiredOptional(required=("key",)) + def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> UserGPGKey: + return cast(UserGPGKey, super().get(id=id, lazy=lazy, **kwargs)) + class UserKey(ObjectDeleteMixin, RESTObject): pass @@ -424,6 +445,11 @@ class UserImpersonationTokenManager(NoUpdateMixin, RESTManager): ) _list_filters = ("state",) + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> UserImpersonationToken: + return cast(UserImpersonationToken, super().get(id=id, lazy=lazy, **kwargs)) + class UserMembership(RESTObject): _id_attr = "source_id" @@ -435,6 +461,11 @@ class UserMembershipManager(RetrieveMixin, RESTManager): _from_parent_attrs = {"user_id": "id"} _list_filters = ("type",) + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> UserMembership: + return cast(UserMembership, super().get(id=id, lazy=lazy, **kwargs)) + # Having this outside projects avoids circular imports due to ProjectUser class UserProject(RESTObject): |