9 files changed
@@ -6,7 +6,9 @@ | |||
| 6 | 6 | Dict, | |
| 7 | 7 | Iterator, | |
| 8 | 8 | List, | |
| 9 | + Literal, | ||
| 9 | 10 | Optional, | |
| 11 | + overload, | ||
| 10 | 12 | Tuple, | |
| 11 | 13 | Type, | |
| 12 | 14 | TYPE_CHECKING, | |
@@ -612,6 +614,39 @@ class DownloadMixin(_RestObjectBase): | |||
| 612 | 614 | _updated_attrs: Dict[str, Any] | |
| 613 | 615 | manager: base.RESTManager | |
| 614 | 616 | ||
| 617 | + @overload | ||
| 618 | + def download( | ||
| 619 | + self, | ||
| 620 | + streamed: Literal[False] = False, | ||
| 621 | + action: None = None, | ||
| 622 | + chunk_size: int = 1024, | ||
| 623 | + *, | ||
| 624 | + iterator: Literal[False] = False, | ||
| 625 | + **kwargs: Any, | ||
| 626 | + ) -> bytes: ... | ||
| 627 | + | ||
| 628 | + @overload | ||
| 629 | + def download( | ||
| 630 | + self, | ||
| 631 | + streamed: bool = False, | ||
| 632 | + action: None = None, | ||
| 633 | + chunk_size: int = 1024, | ||
| 634 | + *, | ||
| 635 | + iterator: Literal[True] = True, | ||
| 636 | + **kwargs: Any, | ||
| 637 | + ) -> Iterator[Any]: ... | ||
| 638 | + | ||
| 639 | + @overload | ||
| 640 | + def download( | ||
| 641 | + self, | ||
| 642 | + streamed: Literal[True] = True, | ||
| 643 | + action: Optional[Callable[[bytes], None]] = None, | ||
| 644 | + chunk_size: int = 1024, | ||
| 645 | + *, | ||
| 646 | + iterator: Literal[False] = False, | ||
| 647 | + **kwargs: Any, | ||
| 648 | + ) -> None: ... | ||
| 649 | + | ||
| 615 | 650 | @cli.register_custom_action(cls_names=("GroupExport", "ProjectExport")) | |
| 616 | 651 | @exc.on_http_error(exc.GitlabGetError) | |
| 617 | 652 | def download( | |
@@ -3,7 +3,16 @@ | |||
| 3 | 3 | https://docs.gitlab.com/ee/api/job_artifacts.html | |
| 4 | 4 | """ | |
| 5 | 5 | ||
| 6 | - from typing import Any, Callable, Iterator, Optional, TYPE_CHECKING, Union | ||
| 6 | + from typing import ( | ||
| 7 | + Any, | ||
| 8 | + Callable, | ||
| 9 | + Iterator, | ||
| 10 | + Literal, | ||
| 11 | + Optional, | ||
| 12 | + overload, | ||
| 13 | + TYPE_CHECKING, | ||
| 14 | + Union, | ||
| 15 | + ) | ||
| 7 | 16 | ||
| 8 | 17 | import requests | |
| 9 | 18 | ||
@@ -43,6 +52,45 @@ def delete(self, **kwargs: Any) -> None: | |||
| 43 | 52 | assert path is not None | |
| 44 | 53 | self.gitlab.http_delete(path, **kwargs) | |
| 45 | 54 | ||
| 55 | + @overload | ||
| 56 | + def download( | ||
| 57 | + self, | ||
| 58 | + ref_name: str, | ||
| 59 | + job: str, | ||
| 60 | + streamed: Literal[False] = False, | ||
| 61 | + action: None = None, | ||
| 62 | + chunk_size: int = 1024, | ||
| 63 | + *, | ||
| 64 | + iterator: Literal[False] = False, | ||
| 65 | + **kwargs: Any, | ||
| 66 | + ) -> bytes: ... | ||
| 67 | + | ||
| 68 | + @overload | ||
| 69 | + def download( | ||
| 70 | + self, | ||
| 71 | + ref_name: str, | ||
| 72 | + job: str, | ||
| 73 | + streamed: bool = False, | ||
| 74 | + action: None = None, | ||
| 75 | + chunk_size: int = 1024, | ||
| 76 | + *, | ||
| 77 | + iterator: Literal[True] = True, | ||
| 78 | + **kwargs: Any, | ||
| 79 | + ) -> Iterator[Any]: ... | ||
| 80 | + | ||
| 81 | + @overload | ||
| 82 | + def download( | ||
| 83 | + self, | ||
| 84 | + ref_name: str, | ||
| 85 | + job: str, | ||
| 86 | + streamed: Literal[True] = True, | ||
| 87 | + action: Optional[Callable[[bytes], None]] = None, | ||
| 88 | + chunk_size: int = 1024, | ||
| 89 | + *, | ||
| 90 | + iterator: Literal[False] = False, | ||
| 91 | + **kwargs: Any, | ||
| 92 | + ) -> None: ... | ||
| 93 | + | ||
| 46 | 94 | @cli.register_custom_action( | |
| 47 | 95 | cls_names="ProjectArtifactManager", | |
| 48 | 96 | required=("ref_name", "job"), | |
@@ -94,6 +142,48 @@ def download( | |||
| 94 | 142 | result, streamed, action, chunk_size, iterator=iterator | |
| 95 | 143 | ) | |
| 96 | 144 | ||
| 145 | + @overload | ||
| 146 | + def raw( | ||
| 147 | + self, | ||
| 148 | + ref_name: str, | ||
| 149 | + artifact_path: str, | ||
| 150 | + job: str, | ||
| 151 | + streamed: Literal[False] = False, | ||
| 152 | + action: None = None, | ||
| 153 | + chunk_size: int = 1024, | ||
| 154 | + *, | ||
| 155 | + iterator: Literal[False] = False, | ||
| 156 | + **kwargs: Any, | ||
| 157 | + ) -> bytes: ... | ||
| 158 | + | ||
| 159 | + @overload | ||
| 160 | + def raw( | ||
| 161 | + self, | ||
| 162 | + ref_name: str, | ||
| 163 | + artifact_path: str, | ||
| 164 | + job: str, | ||
| 165 | + streamed: bool = False, | ||
| 166 | + action: None = None, | ||
| 167 | + chunk_size: int = 1024, | ||
| 168 | + *, | ||
| 169 | + iterator: Literal[True] = True, | ||
| 170 | + **kwargs: Any, | ||
| 171 | + ) -> Iterator[Any]: ... | ||
| 172 | + | ||
| 173 | + @overload | ||
| 174 | + def raw( | ||
| 175 | + self, | ||
| 176 | + ref_name: str, | ||
| 177 | + artifact_path: str, | ||
| 178 | + job: str, | ||
| 179 | + streamed: Literal[True] = True, | ||
| 180 | + action: Optional[Callable[[bytes], None]] = None, | ||
| 181 | + chunk_size: int = 1024, | ||
| 182 | + *, | ||
| 183 | + iterator: Literal[False] = False, | ||
| 184 | + **kwargs: Any, | ||
| 185 | + ) -> None: ... | ||
| 186 | + | ||
| 97 | 187 | @cli.register_custom_action( | |
| 98 | 188 | cls_names="ProjectArtifactManager", | |
| 99 | 189 | required=("ref_name", "artifact_path", "job"), | |
@@ -1,4 +1,15 @@ | |||
| 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( | |
@@ -11,7 +11,9 @@ | |||
| 11 | 11 | Callable, | |
| 12 | 12 | cast, | |
| 13 | 13 | Iterator, | |
| 14 | + Literal, | ||
| 14 | 15 | Optional, | |
| 16 | + overload, | ||
| 15 | 17 | TYPE_CHECKING, | |
| 16 | 18 | Union, | |
| 17 | 19 | ) | |
@@ -122,6 +124,48 @@ def upload( | |||
| 122 | 124 | attrs.update(server_data) | |
| 123 | 125 | return self._obj_cls(self, attrs=attrs) | |
| 124 | 126 | ||
| 127 | + @overload | ||
| 128 | + def download( | ||
| 129 | + self, | ||
| 130 | + package_name: str, | ||
| 131 | + package_version: str, | ||
| 132 | + file_name: str, | ||
| 133 | + streamed: Literal[False] = False, | ||
| 134 | + action: None = None, | ||
| 135 | + chunk_size: int = 1024, | ||
| 136 | + *, | ||
| 137 | + iterator: Literal[False] = False, | ||
| 138 | + **kwargs: Any, | ||
| 139 | + ) -> bytes: ... | ||
| 140 | + | ||
| 141 | + @overload | ||
| 142 | + def download( | ||
| 143 | + self, | ||
| 144 | + package_name: str, | ||
| 145 | + package_version: str, | ||
| 146 | + file_name: str, | ||
| 147 | + streamed: bool = False, | ||
| 148 | + action: None = None, | ||
| 149 | + chunk_size: int = 1024, | ||
| 150 | + *, | ||
| 151 | + iterator: Literal[True] = True, | ||
| 152 | + **kwargs: Any, | ||
| 153 | + ) -> Iterator[Any]: ... | ||
| 154 | + | ||
| 155 | + @overload | ||
| 156 | + def download( | ||
| 157 | + self, | ||
| 158 | + package_name: str, | ||
| 159 | + package_version: str, | ||
| 160 | + file_name: str, | ||
| 161 | + streamed: Literal[True] = True, | ||
| 162 | + action: Optional[Callable[[bytes], None]] = None, | ||
| 163 | + chunk_size: int = 1024, | ||
| 164 | + *, | ||
| 165 | + iterator: Literal[False] = False, | ||
| 166 | + **kwargs: Any, | ||
| 167 | + ) -> None: ... | ||
| 168 | + | ||
| 125 | 169 | @cli.register_custom_action( | |
| 126 | 170 | cls_names="GenericPackageManager", | |
| 127 | 171 | required=("package_name", "package_version", "file_name"), | |
0 commit comments