1+ from typing import Any , cast , Dict , List , TYPE_CHECKING , Union
2+
13from gitlab import cli
24from gitlab import exceptions as exc
35from gitlab .base import RequiredOptional , RESTManager , RESTObject
1820class GeoNode (SaveMixin , ObjectDeleteMixin , RESTObject ):
1921 @cli .register_custom_action ("GeoNode" )
2022 @exc .on_http_error (exc .GitlabRepairError )
21- def repair (self , ** kwargs ) :
23+ def repair (self , ** kwargs : Any ) -> None :
2224 """Repair the OAuth authentication of the geo node.
2325
2426 Args:
@@ -30,11 +32,13 @@ def repair(self, **kwargs):
3032 """
3133 path = f"/geo_nodes/{ self .get_id ()} /repair"
3234 server_data = self .manager .gitlab .http_post (path , ** kwargs )
35+ if TYPE_CHECKING :
36+ assert isinstance (server_data , dict )
3337 self ._update_attrs (server_data )
3438
3539 @cli .register_custom_action ("GeoNode" )
3640 @exc .on_http_error (exc .GitlabGetError )
37- def status (self , ** kwargs ) :
41+ def status (self , ** kwargs : Any ) -> Dict [ str , Any ] :
3842 """Get the status of the geo node.
3943
4044 Args:
@@ -48,7 +52,10 @@ def status(self, **kwargs):
4852 dict: The status of the geo node
4953 """
5054 path = f"/geo_nodes/{ self .get_id ()} /status"
51- return self .manager .gitlab .http_get (path , ** kwargs )
55+ result = self .manager .gitlab .http_get (path , ** kwargs )
56+ if TYPE_CHECKING :
57+ assert isinstance (result , dict )
58+ return result
5259
5360
5461class GeoNodeManager (RetrieveMixin , UpdateMixin , DeleteMixin , RESTManager ):
@@ -58,9 +65,12 @@ class GeoNodeManager(RetrieveMixin, UpdateMixin, DeleteMixin, RESTManager):
5865 optional = ("enabled" , "url" , "files_max_capacity" , "repos_max_capacity" ),
5966 )
6067
68+ def get (self , id : Union [str , int ], lazy : bool = False , ** kwargs : Any ) -> GeoNode :
69+ return cast (GeoNode , super ().get (id = id , lazy = lazy , ** kwargs ))
70+
6171 @cli .register_custom_action ("GeoNodeManager" )
6272 @exc .on_http_error (exc .GitlabGetError )
63- def status (self , ** kwargs ) :
73+ def status (self , ** kwargs : Any ) -> List [ Dict [ str , Any ]] :
6474 """Get the status of all the geo nodes.
6575
6676 Args:
@@ -73,11 +83,14 @@ def status(self, **kwargs):
7383 Returns:
7484 list: The status of all the geo nodes
7585 """
76- return self .gitlab .http_list ("/geo_nodes/status" , ** kwargs )
86+ result = self .gitlab .http_list ("/geo_nodes/status" , ** kwargs )
87+ if TYPE_CHECKING :
88+ assert isinstance (result , list )
89+ return result
7790
7891 @cli .register_custom_action ("GeoNodeManager" )
7992 @exc .on_http_error (exc .GitlabGetError )
80- def current_failures (self , ** kwargs ) :
93+ def current_failures (self , ** kwargs : Any ) -> List [ Dict [ str , Any ]] :
8194 """Get the list of failures on the current geo node.
8295
8396 Args:
@@ -90,4 +103,7 @@ def current_failures(self, **kwargs):
90103 Returns:
91104 list: The list of failures
92105 """
93- return self .gitlab .http_list ("/geo_nodes/current/failures" , ** kwargs )
106+ result = self .gitlab .http_list ("/geo_nodes/current/failures" , ** kwargs )
107+ if TYPE_CHECKING :
108+ assert isinstance (result , list )
109+ return result
0 commit comments