|
1 | | -from typing import Any, Callable, cast, Dict, Iterator, Optional, TYPE_CHECKING, Union |
| 1 | +from typing import ( |
| 2 | + Any, |
| 3 | + Callable, |
| 4 | + cast, |
| 5 | + Dict, |
| 6 | + Iterator, |
| 7 | + Literal, |
| 8 | + Optional, |
| 9 | + overload, |
| 10 | + TYPE_CHECKING, |
| 11 | + Union, |
| 12 | +) |
2 | 13 |
|
3 | 14 | import requests |
4 | 15 |
|
@@ -115,6 +126,39 @@ def delete_artifacts(self, **kwargs: Any) -> None: |
115 | 126 | path = f"{self.manager.path}/{self.encoded_id}/artifacts" |
116 | 127 | self.manager.gitlab.http_delete(path, **kwargs) |
117 | 128 |
|
| 129 | + @overload |
| 130 | + def artifacts( |
| 131 | + self, |
| 132 | + streamed: Literal[False] = False, |
| 133 | + action: None = None, |
| 134 | + chunk_size: int = 1024, |
| 135 | + *, |
| 136 | + iterator: Literal[False] = False, |
| 137 | + **kwargs: Any, |
| 138 | + ) -> bytes: ... |
| 139 | + |
| 140 | + @overload |
| 141 | + def artifacts( |
| 142 | + self, |
| 143 | + streamed: bool = False, |
| 144 | + action: None = None, |
| 145 | + chunk_size: int = 1024, |
| 146 | + *, |
| 147 | + iterator: Literal[True] = True, |
| 148 | + **kwargs: Any, |
| 149 | + ) -> Iterator[Any]: ... |
| 150 | + |
| 151 | + @overload |
| 152 | + def artifacts( |
| 153 | + self, |
| 154 | + streamed: Literal[True] = True, |
| 155 | + action: Optional[Callable[[bytes], None]] = None, |
| 156 | + chunk_size: int = 1024, |
| 157 | + *, |
| 158 | + iterator: Literal[False] = False, |
| 159 | + **kwargs: Any, |
| 160 | + ) -> None: ... |
| 161 | + |
118 | 162 | @cli.register_custom_action(cls_names="ProjectJob") |
119 | 163 | @exc.on_http_error(exc.GitlabGetError) |
120 | 164 | def artifacts( |
@@ -156,6 +200,42 @@ def artifacts( |
156 | 200 | result, streamed, action, chunk_size, iterator=iterator |
157 | 201 | ) |
158 | 202 |
|
| 203 | + @overload |
| 204 | + def artifact( |
| 205 | + self, |
| 206 | + path: str, |
| 207 | + streamed: Literal[False] = False, |
| 208 | + action: None = None, |
| 209 | + chunk_size: int = 1024, |
| 210 | + *, |
| 211 | + iterator: Literal[False] = False, |
| 212 | + **kwargs: Any, |
| 213 | + ) -> bytes: ... |
| 214 | + |
| 215 | + @overload |
| 216 | + def artifact( |
| 217 | + self, |
| 218 | + path: str, |
| 219 | + streamed: bool = False, |
| 220 | + action: None = None, |
| 221 | + chunk_size: int = 1024, |
| 222 | + *, |
| 223 | + iterator: Literal[True] = True, |
| 224 | + **kwargs: Any, |
| 225 | + ) -> Iterator[Any]: ... |
| 226 | + |
| 227 | + @overload |
| 228 | + def artifact( |
| 229 | + self, |
| 230 | + path: str, |
| 231 | + streamed: Literal[True] = True, |
| 232 | + action: Optional[Callable[[bytes], None]] = None, |
| 233 | + chunk_size: int = 1024, |
| 234 | + *, |
| 235 | + iterator: Literal[False] = False, |
| 236 | + **kwargs: Any, |
| 237 | + ) -> None: ... |
| 238 | + |
159 | 239 | @cli.register_custom_action(cls_names="ProjectJob") |
160 | 240 | @exc.on_http_error(exc.GitlabGetError) |
161 | 241 | def artifact( |
@@ -199,6 +279,39 @@ def artifact( |
199 | 279 | result, streamed, action, chunk_size, iterator=iterator |
200 | 280 | ) |
201 | 281 |
|
| 282 | + @overload |
| 283 | + def trace( |
| 284 | + self, |
| 285 | + streamed: Literal[False] = False, |
| 286 | + action: None = None, |
| 287 | + chunk_size: int = 1024, |
| 288 | + *, |
| 289 | + iterator: Literal[False] = False, |
| 290 | + **kwargs: Any, |
| 291 | + ) -> bytes: ... |
| 292 | + |
| 293 | + @overload |
| 294 | + def trace( |
| 295 | + self, |
| 296 | + streamed: bool = False, |
| 297 | + action: None = None, |
| 298 | + chunk_size: int = 1024, |
| 299 | + *, |
| 300 | + iterator: Literal[True] = True, |
| 301 | + **kwargs: Any, |
| 302 | + ) -> Iterator[Any]: ... |
| 303 | + |
| 304 | + @overload |
| 305 | + def trace( |
| 306 | + self, |
| 307 | + streamed: Literal[True] = True, |
| 308 | + action: Optional[Callable[[bytes], None]] = None, |
| 309 | + chunk_size: int = 1024, |
| 310 | + *, |
| 311 | + iterator: Literal[False] = False, |
| 312 | + **kwargs: Any, |
| 313 | + ) -> None: ... |
| 314 | + |
202 | 315 | @cli.register_custom_action(cls_names="ProjectJob") |
203 | 316 | @exc.on_http_error(exc.GitlabGetError) |
204 | 317 | def trace( |
|
0 commit comments