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
@@ -754,7 +755,7 @@ def time_stats(self, **kwargs: Any) -> Dict[str, Any]:
754755 path = f"{ self .manager .path } /{ self .encoded_id } /time_stats"
755756 result = self .manager .gitlab .http_get (path , ** kwargs )
756757 if TYPE_CHECKING :
757- assert not isinstance (result , requests . Response )
758+ assert isinstance (result , dict )
758759 return result
759760
760761 @cli .register_custom_action (("ProjectIssue" , "ProjectMergeRequest" ), ("duration" ,))
@@ -774,7 +775,7 @@ def time_estimate(self, duration: str, **kwargs: Any) -> Dict[str, Any]:
774775 data = {"duration" : duration }
775776 result = self .manager .gitlab .http_post (path , post_data = data , ** kwargs )
776777 if TYPE_CHECKING :
777- assert not isinstance (result , requests . Response )
778+ assert isinstance (result , dict )
778779 return result
779780
780781 @cli .register_custom_action (("ProjectIssue" , "ProjectMergeRequest" ))
@@ -792,7 +793,7 @@ def reset_time_estimate(self, **kwargs: Any) -> Dict[str, Any]:
792793 path = f"{ self .manager .path } /{ self .encoded_id } /reset_time_estimate"
793794 result = self .manager .gitlab .http_post (path , ** kwargs )
794795 if TYPE_CHECKING :
795- assert not isinstance (result , requests . Response )
796+ assert isinstance (result , dict )
796797 return result
797798
798799 @cli .register_custom_action (("ProjectIssue" , "ProjectMergeRequest" ), ("duration" ,))
@@ -812,7 +813,7 @@ def add_spent_time(self, duration: str, **kwargs: Any) -> Dict[str, Any]:
812813 data = {"duration" : duration }
813814 result = self .manager .gitlab .http_post (path , post_data = data , ** kwargs )
814815 if TYPE_CHECKING :
815- assert not isinstance (result , requests . Response )
816+ assert isinstance (result , dict )
816817 return result
817818
818819 @cli .register_custom_action (("ProjectIssue" , "ProjectMergeRequest" ))
@@ -830,7 +831,7 @@ def reset_spent_time(self, **kwargs: Any) -> Dict[str, Any]:
830831 path = f"{ self .manager .path } /{ self .encoded_id } /reset_spent_time"
831832 result = self .manager .gitlab .http_post (path , ** kwargs )
832833 if TYPE_CHECKING :
833- assert not isinstance (result , requests . Response )
834+ assert isinstance (result , dict )
834835 return result
835836
836837
@@ -864,7 +865,7 @@ def participants(self, **kwargs: Any) -> Dict[str, Any]:
864865 path = f"{ self .manager .path } /{ self .encoded_id } /participants"
865866 result = self .manager .gitlab .http_get (path , ** kwargs )
866867 if TYPE_CHECKING :
867- assert not isinstance (result , requests . Response )
868+ assert isinstance (result , dict )
868869 return result
869870
870871
@@ -892,7 +893,7 @@ def render(self, link_url: str, image_url: str, **kwargs: Any) -> Dict[str, Any]
892893 data = {"link_url" : link_url , "image_url" : image_url }
893894 result = self .gitlab .http_get (path , data , ** kwargs )
894895 if TYPE_CHECKING :
895- assert not isinstance (result , requests . Response )
896+ assert isinstance (result , dict )
896897 return result
897898
898899
@@ -907,7 +908,7 @@ class PromoteMixin(_RestObjectBase):
907908
908909 def _get_update_method (
909910 self ,
910- ) -> Callable [..., Union [ Dict [ str , Any ], requests . Response ] ]:
911+ ) -> Callable [..., gl_client . HttpResponseType ]:
911912 """Return the HTTP method to use.
912913
913914 Returns:
@@ -939,5 +940,5 @@ def promote(self, **kwargs: Any) -> Dict[str, Any]:
939940 http_method = self ._get_update_method ()
940941 result = http_method (path , ** kwargs )
941942 if TYPE_CHECKING :
942- assert not isinstance (result , requests . Response )
943+ assert isinstance (result , dict )
943944 return result
0 commit comments