1
+ from typing import Any ,cast ,Dict ,List ,Optional ,Union
2
+
1
3
from gitlab import cli
2
4
from gitlab .base import RESTManager ,RESTObject
3
5
from gitlab .mixins import (
@@ -253,7 +255,9 @@ class ProjectServiceManager(GetMixin, UpdateMixin, DeleteMixin, ListMixin, RESTM
253
255
"youtrack" : (("issues_url" ,"project_url" ), ("description" ,"push_events" )),
254
256
}
255
257
256
- def get (self ,id ,** kwargs ):
258
+ def get (
259
+ self ,id :Union [str ,int ],lazy :bool = False ,** kwargs :Any
260
+ )-> ProjectService :
257
261
"""Retrieve a single object.
258
262
259
263
Args:
@@ -270,11 +274,16 @@ def get(self, id, **kwargs):
270
274
GitlabAuthenticationError: If authentication is not correct
271
275
GitlabGetError: If the server cannot perform the request
272
276
"""
273
- obj = super (ProjectServiceManager ,self ).get (id ,** kwargs )
277
+ obj = cast ( ProjectService , super (ProjectServiceManager ,self ).get (id ,** kwargs ) )
274
278
obj .id = id
275
279
return obj
276
280
277
- def update (self ,id = None ,new_data = None ,** kwargs ):
281
+ def update (
282
+ self ,
283
+ id :Optional [Union [str ,int ]]= None ,
284
+ new_data :Optional [Dict [str ,Any ]]= None ,
285
+ ** kwargs :Any
286
+ )-> Dict [str ,Any ]:
278
287
"""Update an object on the server.
279
288
280
289
Args:
@@ -290,11 +299,12 @@ def update(self, id=None, new_data=None, **kwargs):
290
299
GitlabUpdateError: If the server cannot perform the request
291
300
"""
292
301
new_data = new_data or {}
293
- super (ProjectServiceManager ,self ).update (id ,new_data ,** kwargs )
302
+ result = super (ProjectServiceManager ,self ).update (id ,new_data ,** kwargs )
294
303
self .id = id
304
+ return result
295
305
296
306
@cli .register_custom_action ("ProjectServiceManager" )
297
- def available (self ,** kwargs ) :
307
+ def available (self ,** kwargs : Any ) -> List [ str ] :
298
308
"""List the services known by python-gitlab.
299
309
300
310
Returns: