@@ -145,7 +145,7 @@ def __init__(
145
145
def __enter__ (self ) -> "Gitlab" :
146
146
return self
147
147
148
- def __exit__ (self , * args ) -> None :
148
+ def __exit__ (self , * args : Any ) -> None :
149
149
self .session .close ()
150
150
151
151
def __getstate__ (self ) -> Dict [str , Any ]:
@@ -180,7 +180,9 @@ def api_version(self) -> str:
180
180
return self ._api_version
181
181
182
182
@classmethod
183
- def from_config (cls , gitlab_id = None , config_files = None ) -> "Gitlab" :
183
+ def from_config (
184
+ cls , gitlab_id : Optional [str ] = None , config_files : Optional [List [str ]] = None
185
+ ) -> "Gitlab" :
184
186
"""Create a Gitlab connection from configuration files.
185
187
186
188
Args:
@@ -247,7 +249,7 @@ def version(self) -> Tuple[str, str]:
247
249
return cast (str , self ._server_version ), cast (str , self ._server_revision )
248
250
249
251
@gitlab .exceptions .on_http_error (gitlab .exceptions .GitlabVerifyError )
250
- def lint (self , content : str , ** kwargs ) -> Tuple [bool , List [str ]]:
252
+ def lint (self , content : str , ** kwargs : Any ) -> Tuple [bool , List [str ]]:
251
253
"""Validate a gitlab CI configuration.
252
254
253
255
Args:
@@ -269,7 +271,7 @@ def lint(self, content: str, **kwargs) -> Tuple[bool, List[str]]:
269
271
270
272
@gitlab .exceptions .on_http_error (gitlab .exceptions .GitlabMarkdownError )
271
273
def markdown (
272
- self , text : str , gfm : bool = False , project : Optional [str ] = None , ** kwargs
274
+ self , text : str , gfm : bool = False , project : Optional [str ] = None , ** kwargs : Any
273
275
) -> str :
274
276
"""Render an arbitrary Markdown document.
275
277
@@ -296,7 +298,7 @@ def markdown(
296
298
return data ["html" ]
297
299
298
300
@gitlab .exceptions .on_http_error (gitlab .exceptions .GitlabLicenseError )
299
- def get_license (self , ** kwargs ) -> Dict [str , Any ]:
301
+ def get_license (self , ** kwargs : Any ) -> Dict [str , Any ]:
300
302
"""Retrieve information about the current license.
301
303
302
304
Args:
@@ -315,7 +317,7 @@ def get_license(self, **kwargs) -> Dict[str, Any]:
315
317
return {}
316
318
317
319
@gitlab .exceptions .on_http_error (gitlab .exceptions .GitlabLicenseError )
318
- def set_license (self , license : str , ** kwargs ) -> Dict [str , Any ]:
320
+ def set_license (self , license : str , ** kwargs : Any ) -> Dict [str , Any ]:
319
321
"""Add a new license.
320
322
321
323
Args:
@@ -446,7 +448,7 @@ def http_request(
446
448
post_data : Optional [Dict [str , Any ]] = None ,
447
449
streamed : bool = False ,
448
450
files : Optional [Dict [str , Any ]] = None ,
449
- ** kwargs ,
451
+ ** kwargs : Any ,
450
452
) -> requests .Response :
451
453
"""Make an HTTP request to the Gitlab server.
452
454
@@ -577,7 +579,7 @@ def http_get(
577
579
query_data : Optional [Dict [str , Any ]] = None ,
578
580
streamed : bool = False ,
579
581
raw : bool = False ,
580
- ** kwargs ,
582
+ ** kwargs : Any ,
581
583
) -> Union [Dict [str , Any ], requests .Response ]:
582
584
"""Make a GET request to the Gitlab server.
583
585
@@ -621,9 +623,9 @@ def http_list(
621
623
self ,
622
624
path : str ,
623
625
query_data : Optional [Dict [str , Any ]] = None ,
624
- as_list = None ,
625
- ** kwargs ,
626
- ):
626
+ as_list : Optional [ bool ] = None ,
627
+ ** kwargs : Any ,
628
+ ) -> Union [ "GitlabList" , List [ Dict [ str , Any ]]] :
627
629
"""Make a GET request to the Gitlab server for list-oriented queries.
628
630
629
631
Args:
@@ -670,7 +672,7 @@ def http_post(
670
672
query_data : Optional [Dict [str , Any ]] = None ,
671
673
post_data : Optional [Dict [str , Any ]] = None ,
672
674
files : Optional [Dict [str , Any ]] = None ,
673
- ** kwargs ,
675
+ ** kwargs : Any ,
674
676
) -> Union [Dict [str , Any ], requests .Response ]:
675
677
"""Make a POST request to the Gitlab server.
676
678
@@ -717,7 +719,7 @@ def http_put(
717
719
query_data : Optional [Dict [str , Any ]] = None ,
718
720
post_data : Optional [Dict [str , Any ]] = None ,
719
721
files : Optional [Dict [str , Any ]] = None ,
720
- ** kwargs ,
722
+ ** kwargs : Any ,
721
723
) -> Union [Dict [str , Any ], requests .Response ]:
722
724
"""Make a PUT request to the Gitlab server.
723
725
@@ -755,7 +757,7 @@ def http_put(
755
757
error_message = "Failed to parse the server message"
756
758
) from e
757
759
758
- def http_delete (self , path : str , ** kwargs ) -> requests .Response :
760
+ def http_delete (self , path : str , ** kwargs : Any ) -> requests .Response :
759
761
"""Make a PUT request to the Gitlab server.
760
762
761
763
Args:
@@ -772,7 +774,9 @@ def http_delete(self, path: str, **kwargs) -> requests.Response:
772
774
return self .http_request ("delete" , path , ** kwargs )
773
775
774
776
@gitlab .exceptions .on_http_error (gitlab .exceptions .GitlabSearchError )
775
- def search (self , scope : str , search : str , ** kwargs ) -> requests .Response :
777
+ def search (
778
+ self , scope : str , search : str , ** kwargs : Any
779
+ ) -> Union ["GitlabList" , List [Dict [str , Any ]]]:
776
780
"""Search GitLab resources matching the provided string.'
777
781
778
782
Args:
@@ -804,7 +808,7 @@ def __init__(
804
808
url : str ,
805
809
query_data : Dict [str , Any ],
806
810
get_next : bool = True ,
807
- ** kwargs ,
811
+ ** kwargs : Any ,
808
812
) -> None :
809
813
self ._gl = gl
810
814
@@ -815,7 +819,7 @@ def __init__(
815
819
self ._get_next = get_next
816
820
817
821
def _query (
818
- self , url : str , query_data : Optional [Dict [str , Any ]] = None , ** kwargs
822
+ self , url : str , query_data : Optional [Dict [str , Any ]] = None , ** kwargs : Any
819
823
) -> None :
820
824
query_data = query_data or {}
821
825
result = self ._gl .http_request ("get" , url , query_data = query_data , ** kwargs )
@@ -840,7 +844,7 @@ def _query(
840
844
self ._total : Optional [Union [str , int ]] = result .headers .get ("X-Total" )
841
845
842
846
try :
843
- self ._data = result .json ()
847
+ self ._data : List [ Dict [ str , Any ]] = result .json ()
844
848
except Exception as e :
845
849
raise gitlab .exceptions .GitlabParsingError (
846
850
error_message = "Failed to parse the server message"
@@ -896,10 +900,10 @@ def __len__(self) -> int:
896
900
return 0
897
901
return int (self ._total )
898
902
899
- def __next__ (self ):
903
+ def __next__ (self ) -> Dict [ str , Any ] :
900
904
return self .next ()
901
905
902
- def next (self ) -> "Gitlab" :
906
+ def next (self ) -> Dict [ str , Any ] :
903
907
try :
904
908
item = self ._data [self ._current ]
905
909
self ._current += 1
0 commit comments