Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit13243b7

Browse files
chore: add type-hints to gitlab/v4/objects/geo_nodes.py
1 parentd4adf8d commit13243b7

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

‎gitlab/v4/objects/geo_nodes.py‎

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
fromtypingimportAny,cast,Dict,List,TYPE_CHECKING,Union
2+
13
fromgitlabimportcli
24
fromgitlabimportexceptionsasexc
35
fromgitlab.baseimportRequiredOptional,RESTManager,RESTObject
@@ -18,7 +20,7 @@
1820
classGeoNode(SaveMixin,ObjectDeleteMixin,RESTObject):
1921
@cli.register_custom_action("GeoNode")
2022
@exc.on_http_error(exc.GitlabRepairError)
21-
defrepair(self,**kwargs):
23+
defrepair(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+
ifTYPE_CHECKING:
36+
assertisinstance(server_data,dict)
3337
self._update_attrs(server_data)
3438

3539
@cli.register_custom_action("GeoNode")
3640
@exc.on_http_error(exc.GitlabGetError)
37-
defstatus(self,**kwargs):
41+
defstatus(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-
returnself.manager.gitlab.http_get(path,**kwargs)
55+
result=self.manager.gitlab.http_get(path,**kwargs)
56+
ifTYPE_CHECKING:
57+
assertisinstance(result,dict)
58+
returnresult
5259

5360

5461
classGeoNodeManager(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+
defget(self,id:Union[str,int],lazy:bool=False,**kwargs:Any)->GeoNode:
69+
returncast(GeoNode,super().get(id=id,lazy=lazy,**kwargs))
70+
6171
@cli.register_custom_action("GeoNodeManager")
6272
@exc.on_http_error(exc.GitlabGetError)
63-
defstatus(self,**kwargs):
73+
defstatus(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-
returnself.gitlab.http_list("/geo_nodes/status",**kwargs)
86+
result=self.gitlab.http_list("/geo_nodes/status",**kwargs)
87+
ifTYPE_CHECKING:
88+
assertisinstance(result,list)
89+
returnresult
7790

7891
@cli.register_custom_action("GeoNodeManager")
7992
@exc.on_http_error(exc.GitlabGetError)
80-
defcurrent_failures(self,**kwargs):
93+
defcurrent_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-
returnself.gitlab.http_list("/geo_nodes/current/failures",**kwargs)
106+
result=self.gitlab.http_list("/geo_nodes/current/failures",**kwargs)
107+
ifTYPE_CHECKING:
108+
assertisinstance(result,list)
109+
returnresult

‎pyproject.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ module = [
1313
"docs.*",
1414
"docs.ext.*",
1515
"gitlab.v4.objects.files",
16-
"gitlab.v4.objects.geo_nodes",
1716
"gitlab.v4.objects.issues",
1817
"gitlab.v4.objects.jobs",
1918
"gitlab.v4.objects.labels",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp