3232import requests
3333
3434import gitlab
35+ import gitlab .client as gl_client
3536from gitlab import base , cli
3637from gitlab import exceptions as exc
3738from gitlab import utils
@@ -138,7 +139,7 @@ def get(
138139 return self ._obj_cls (self , {self ._obj_cls ._id_attr : id }, lazy = lazy )
139140 server_data = self .gitlab .http_get (path , ** kwargs )
140141 if TYPE_CHECKING :
141- assert not isinstance (server_data , requests . Response )
142+ assert isinstance (server_data , dict )
142143 return self ._obj_cls (self , server_data , lazy = lazy )
143144
144145
@@ -170,7 +171,7 @@ def get(self, **kwargs: Any) -> base.RESTObject:
170171 assert self .path is not None
171172 server_data = self .gitlab .http_get (self .path , ** kwargs )
172173 if TYPE_CHECKING :
173- assert not isinstance (server_data , requests . Response )
174+ assert isinstance (server_data , dict )
174175 assert self ._obj_cls is not None
175176 return self ._obj_cls (self , server_data )
176177
@@ -204,7 +205,7 @@ def refresh(self, **kwargs: Any) -> None:
204205 path = self .manager .path
205206 server_data = self .manager .gitlab .http_get (path , ** kwargs )
206207 if TYPE_CHECKING :
207- assert not isinstance (server_data , requests . Response )
208+ assert isinstance (server_data , dict )
208209 self ._update_attrs (server_data )
209210
210211
@@ -309,7 +310,7 @@ def create(
309310 path = kwargs .pop ("path" , self .path )
310311 server_data = self .gitlab .http_post (path , post_data = data , files = files , ** kwargs )
311312 if TYPE_CHECKING :
312- assert not isinstance (server_data , requests . Response )
313+ assert isinstance (server_data , dict )
313314 assert self ._obj_cls is not None
314315 return self ._obj_cls (self , server_data )
315316
@@ -326,7 +327,7 @@ class UpdateMixin(_RestManagerBase):
326327
327328 def _get_update_method (
328329 self ,
329- ) -> Callable [..., Union [ Dict [ str , Any ], requests . Response ] ]:
330+ ) -> Callable [..., gl_client . HttpResponseType ]:
330331 """Return the HTTP method to use.
331332
332333 Returns:
@@ -375,7 +376,7 @@ def update(
375376 http_method = self ._get_update_method ()
376377 result = http_method (path , post_data = new_data , files = files , ** kwargs )
377378 if TYPE_CHECKING :
378- assert not isinstance (result , requests . Response )
379+ assert isinstance (result , dict )
379380 return result
380381
381382
@@ -562,7 +563,7 @@ def user_agent_detail(self, **kwargs: Any) -> Dict[str, Any]:
562563 path = f"{ self .manager .path } /{ self .encoded_id } /user_agent_detail"
563564 result = self .manager .gitlab .http_get (path , ** kwargs )
564565 if TYPE_CHECKING :
565- assert not isinstance (result , requests . Response )
566+ assert isinstance (result , dict )
566567 return result
567568
568569
@@ -675,7 +676,7 @@ def subscribe(self, **kwargs: Any) -> None:
675676 path = f"{ self .manager .path } /{ self .encoded_id } /subscribe"
676677 server_data = self .manager .gitlab .http_post (path , ** kwargs )
677678 if TYPE_CHECKING :
678- assert not isinstance (server_data , requests . Response )
679+ assert isinstance (server_data , dict )
679680 self ._update_attrs (server_data )
680681
681682 @cli .register_custom_action (
@@ -695,7 +696,7 @@ def unsubscribe(self, **kwargs: Any) -> None:
695696 path = f"{ self .manager .path } /{ self .encoded_id } /unsubscribe"
696697 server_data = self .manager .gitlab .http_post (path , ** kwargs )
697698 if TYPE_CHECKING :
698- assert not isinstance (server_data , requests . Response )
699+ assert isinstance (server_data , dict )
699700 self ._update_attrs (server_data )
700701
701702
@@ -751,7 +752,7 @@ def time_stats(self, **kwargs: Any) -> Dict[str, Any]:
751752 path = f"{ self .manager .path } /{ self .encoded_id } /time_stats"
752753 result = self .manager .gitlab .http_get (path , ** kwargs )
753754 if TYPE_CHECKING :
754- assert not isinstance (result , requests . Response )
755+ assert isinstance (result , dict )
755756 return result
756757
757758 @cli .register_custom_action (("ProjectIssue" , "ProjectMergeRequest" ), ("duration" ,))
@@ -771,7 +772,7 @@ def time_estimate(self, duration: str, **kwargs: Any) -> Dict[str, Any]:
771772 data = {"duration" : duration }
772773 result = self .manager .gitlab .http_post (path , post_data = data , ** kwargs )
773774 if TYPE_CHECKING :
774- assert not isinstance (result , requests . Response )
775+ assert isinstance (result , dict )
775776 return result
776777
777778 @cli .register_custom_action (("ProjectIssue" , "ProjectMergeRequest" ))
@@ -789,7 +790,7 @@ def reset_time_estimate(self, **kwargs: Any) -> Dict[str, Any]:
789790 path = f"{ self .manager .path } /{ self .encoded_id } /reset_time_estimate"
790791 result = self .manager .gitlab .http_post (path , ** kwargs )
791792 if TYPE_CHECKING :
792- assert not isinstance (result , requests . Response )
793+ assert isinstance (result , dict )
793794 return result
794795
795796 @cli .register_custom_action (("ProjectIssue" , "ProjectMergeRequest" ), ("duration" ,))
@@ -809,7 +810,7 @@ def add_spent_time(self, duration: str, **kwargs: Any) -> Dict[str, Any]:
809810 data = {"duration" : duration }
810811 result = self .manager .gitlab .http_post (path , post_data = data , ** kwargs )
811812 if TYPE_CHECKING :
812- assert not isinstance (result , requests . Response )
813+ assert isinstance (result , dict )
813814 return result
814815
815816 @cli .register_custom_action (("ProjectIssue" , "ProjectMergeRequest" ))
@@ -827,7 +828,7 @@ def reset_spent_time(self, **kwargs: Any) -> Dict[str, Any]:
827828 path = f"{ self .manager .path } /{ self .encoded_id } /reset_spent_time"
828829 result = self .manager .gitlab .http_post (path , ** kwargs )
829830 if TYPE_CHECKING :
830- assert not isinstance (result , requests . Response )
831+ assert isinstance (result , dict )
831832 return result
832833
833834
@@ -861,7 +862,7 @@ def participants(self, **kwargs: Any) -> Dict[str, Any]:
861862 path = f"{ self .manager .path } /{ self .encoded_id } /participants"
862863 result = self .manager .gitlab .http_get (path , ** kwargs )
863864 if TYPE_CHECKING :
864- assert not isinstance (result , requests . Response )
865+ assert isinstance (result , dict )
865866 return result
866867
867868
@@ -889,7 +890,7 @@ def render(self, link_url: str, image_url: str, **kwargs: Any) -> Dict[str, Any]
889890 data = {"link_url" : link_url , "image_url" : image_url }
890891 result = self .gitlab .http_get (path , data , ** kwargs )
891892 if TYPE_CHECKING :
892- assert not isinstance (result , requests . Response )
893+ assert isinstance (result , dict )
893894 return result
894895
895896
@@ -904,7 +905,7 @@ class PromoteMixin(_RestObjectBase):
904905
905906 def _get_update_method (
906907 self ,
907- ) -> Callable [..., Union [ Dict [ str , Any ], requests . Response ] ]:
908+ ) -> Callable [..., gl_client . HttpResponseType ]:
908909 """Return the HTTP method to use.
909910
910911 Returns:
@@ -936,5 +937,5 @@ def promote(self, **kwargs: Any) -> Dict[str, Any]:
936937 http_method = self ._get_update_method ()
937938 result = http_method (path , ** kwargs )
938939 if TYPE_CHECKING :
939- assert not isinstance (result , requests . Response )
940+ assert isinstance (result , dict )
940941 return result
0 commit comments