From 09d1ec04e52fc796cc25e1e29e73969c595e951d Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Sat, 19 May 2018 17:43:31 +0200 Subject: Drop GetFromListMixin --- gitlab/mixins.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'gitlab/mixins.py') diff --git a/gitlab/mixins.py b/gitlab/mixins.py index d6304ed..f940d60 100644 --- a/gitlab/mixins.py +++ b/gitlab/mixins.py @@ -15,8 +15,6 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -import warnings - import gitlab from gitlab import base from gitlab import cli @@ -131,41 +129,6 @@ class ListMixin(object): return base.RESTObjectList(self, self._obj_cls, obj) -class GetFromListMixin(ListMixin): - """This mixin is deprecated.""" - - def get(self, id, **kwargs): - """Retrieve a single object. - - This Method is deprecated. - - Args: - id (int or str): ID of the object to retrieve - **kwargs: Extra options to send to the Gitlab server (e.g. sudo) - - Returns: - object: The generated RESTObject - - Raises: - GitlabAuthenticationError: If authentication is not correct - GitlabGetError: If the server cannot perform the request - """ - warnings.warn('The get() method for this object is deprecated ' - 'and will be removed in a future version.', - DeprecationWarning) - try: - gen = self.list() - except exc.GitlabListError: - raise exc.GitlabGetError(response_code=404, - error_message="Not found") - - for obj in gen: - if str(obj.get_id()) == str(id): - return obj - - raise exc.GitlabGetError(response_code=404, error_message="Not found") - - class RetrieveMixin(ListMixin, GetMixin): pass -- cgit v1.2.1