| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ebd5795 commit 212ddfc
10 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -613,9 +613,10 @@ class DownloadMixin(_RestObjectBase): | |||
| 613 | 613 | def download( | |
| 614 | 614 | self, | |
| 615 | 615 | streamed: bool = False, | |
| 616 | - iterator: bool = False, | ||
| 617 | 616 | action: Optional[Callable] = None, | |
| 618 | 617 | chunk_size: int = 1024, | |
| 618 | + *, | ||
| 619 | + iterator: bool = False, | ||
| 619 | 620 | **kwargs: Any, | |
| 620 | 621 | ) -> Optional[Union[bytes, Iterator[Any]]]: | |
| 621 | 622 | """Download the archive of a resource export. | |
@@ -644,7 +645,9 @@ def download( | |||
| 644 | 645 | ) | |
| 645 | 646 | if TYPE_CHECKING: | |
| 646 | 647 | assert isinstance(result, requests.Response) | |
| 647 | - return utils.response_content(result, streamed, iterator, action, chunk_size) | ||
| 648 | + return utils.response_content( | ||
| 649 | + result, streamed, action, chunk_size, iterator=iterator | ||
| 650 | + ) | ||
| 648 | 651 | ||
| 649 | 652 | ||
| 650 | 653 | class SubscribableMixin(_RestObjectBase): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,9 +34,10 @@ def __call__(self, chunk: Any) -> None: | |||
| 34 | 34 | def response_content( | |
| 35 | 35 | response: requests.Response, | |
| 36 | 36 | streamed: bool, | |
| 37 | - iterator: bool, | ||
| 38 | 37 | action: Optional[Callable], | |
| 39 | 38 | chunk_size: int, | |
| 39 | + *, | ||
| 40 | + iterator: bool, | ||
| 40 | 41 | ) -> Optional[Union[bytes, Iterator[Any]]]: | |
| 41 | 42 | if iterator: | |
| 42 | 43 | return response.iter_content(chunk_size=chunk_size) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -75,9 +75,10 @@ def download( | |||
| 75 | 75 | ref_name: str, | |
| 76 | 76 | job: str, | |
| 77 | 77 | streamed: bool = False, | |
| 78 | - iterator: bool = False, | ||
| 79 | 78 | action: Optional[Callable] = None, | |
| 80 | 79 | chunk_size: int = 1024, | |
| 80 | + *, | ||
| 81 | + iterator: bool = False, | ||
| 81 | 82 | **kwargs: Any, | |
| 82 | 83 | ) -> Optional[Union[bytes, Iterator[Any]]]: | |
| 83 | 84 | """Get the job artifacts archive from a specific tag or branch. | |
@@ -110,7 +111,9 @@ def download( | |||
| 110 | 111 | ) | |
| 111 | 112 | if TYPE_CHECKING: | |
| 112 | 113 | assert isinstance(result, requests.Response) | |
| 113 | - return utils.response_content(result, streamed, iterator, action, chunk_size) | ||
| 114 | + return utils.response_content( | ||
| 115 | + result, streamed, action, chunk_size, iterator=iterator | ||
| 116 | + ) | ||
| 114 | 117 | ||
| 115 | 118 | @cli.register_custom_action( | |
| 116 | 119 | "ProjectArtifactManager", ("ref_name", "artifact_path", "job") | |
@@ -122,9 +125,10 @@ def raw( | |||
| 122 | 125 | artifact_path: str, | |
| 123 | 126 | job: str, | |
| 124 | 127 | streamed: bool = False, | |
| 125 | - iterator: bool = False, | ||
| 126 | 128 | action: Optional[Callable] = None, | |
| 127 | 129 | chunk_size: int = 1024, | |
| 130 | + *, | ||
| 131 | + iterator: bool = False, | ||
| 128 | 132 | **kwargs: Any, | |
| 129 | 133 | ) -> Optional[Union[bytes, Iterator[Any]]]: | |
| 130 | 134 | """Download a single artifact file from a specific tag or branch from | |
@@ -158,4 +162,6 @@ def raw( | |||
| 158 | 162 | ) | |
| 159 | 163 | if TYPE_CHECKING: | |
| 160 | 164 | assert isinstance(result, requests.Response) | |
| 161 | - return utils.response_content(result, streamed, iterator, action, chunk_size) | ||
| 165 | + return utils.response_content( | ||
| 166 | + result, streamed, action, chunk_size, iterator=iterator | ||
| 167 | + ) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -230,9 +230,10 @@ def raw( | |||
| 230 | 230 | file_path: str, | |
| 231 | 231 | ref: str, | |
| 232 | 232 | streamed: bool = False, | |
| 233 | - iterator: bool = False, | ||
| 234 | 233 | action: Optional[Callable[..., Any]] = None, | |
| 235 | 234 | chunk_size: int = 1024, | |
| 235 | + *, | ||
| 236 | + iterator: bool = False, | ||
| 236 | 237 | **kwargs: Any, | |
| 237 | 238 | ) -> Optional[Union[bytes, Iterator[Any]]]: | |
| 238 | 239 | """Return the content of a file for a commit. | |
@@ -265,7 +266,9 @@ def raw( | |||
| 265 | 266 | ) | |
| 266 | 267 | if TYPE_CHECKING: | |
| 267 | 268 | assert isinstance(result, requests.Response) | |
| 268 | - return utils.response_content(result, streamed, iterator, action, chunk_size) | ||
| 269 | + return utils.response_content( | ||
| 270 | + result, streamed, action, chunk_size, iterator=iterator | ||
| 271 | + ) | ||
| 269 | 272 | ||
| 270 | 273 | @cli.register_custom_action("ProjectFileManager", ("file_path", "ref")) | |
| 271 | 274 | @exc.on_http_error(exc.GitlabListError) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -116,9 +116,10 @@ def delete_artifacts(self, **kwargs: Any) -> None: | |||
| 116 | 116 | def artifacts( | |
| 117 | 117 | self, | |
| 118 | 118 | streamed: bool = False, | |
| 119 | - iterator: bool = False, | ||
| 120 | 119 | action: Optional[Callable[..., Any]] = None, | |
| 121 | 120 | chunk_size: int = 1024, | |
| 121 | + *, | ||
| 122 | + iterator: bool = False, | ||
| 122 | 123 | **kwargs: Any, | |
| 123 | 124 | ) -> Optional[Union[bytes, Iterator[Any]]]: | |
| 124 | 125 | """Get the job artifacts. | |
@@ -147,17 +148,20 @@ def artifacts( | |||
| 147 | 148 | ) | |
| 148 | 149 | if TYPE_CHECKING: | |
| 149 | 150 | assert isinstance(result, requests.Response) | |
| 150 | - return utils.response_content(result, streamed, iterator, action, chunk_size) | ||
| 151 | + return utils.response_content( | ||
| 152 | + result, streamed, action, chunk_size, iterator=iterator | ||
| 153 | + ) | ||
| 151 | 154 | ||
| 152 | 155 | @cli.register_custom_action("ProjectJob") | |
| 153 | 156 | @exc.on_http_error(exc.GitlabGetError) | |
| 154 | 157 | def artifact( | |
| 155 | 158 | self, | |
| 156 | 159 | path: str, | |
| 157 | 160 | streamed: bool = False, | |
| 158 | - iterator: bool = False, | ||
| 159 | 161 | action: Optional[Callable[..., Any]] = None, | |
| 160 | 162 | chunk_size: int = 1024, | |
| 163 | + *, | ||
| 164 | + iterator: bool = False, | ||
| 161 | 165 | **kwargs: Any, | |
| 162 | 166 | ) -> Optional[Union[bytes, Iterator[Any]]]: | |
| 163 | 167 | """Get a single artifact file from within the job's artifacts archive. | |
@@ -187,16 +191,19 @@ def artifact( | |||
| 187 | 191 | ) | |
| 188 | 192 | if TYPE_CHECKING: | |
| 189 | 193 | assert isinstance(result, requests.Response) | |
| 190 | - return utils.response_content(result, streamed, iterator, action, chunk_size) | ||
| 194 | + return utils.response_content( | ||
| 195 | + result, streamed, action, chunk_size, iterator=iterator | ||
| 196 | + ) | ||
| 191 | 197 | ||
| 192 | 198 | @cli.register_custom_action("ProjectJob") | |
| 193 | 199 | @exc.on_http_error(exc.GitlabGetError) | |
| 194 | 200 | def trace( | |
| 195 | 201 | self, | |
| 196 | 202 | streamed: bool = False, | |
| 197 | - iterator: bool = False, | ||
| 198 | 203 | action: Optional[Callable[..., Any]] = None, | |
| 199 | 204 | chunk_size: int = 1024, | |
| 205 | + *, | ||
| 206 | + iterator: bool = False, | ||
| 200 | 207 | **kwargs: Any, | |
| 201 | 208 | ) -> Dict[str, Any]: | |
| 202 | 209 | """Get the job trace. | |
@@ -226,7 +233,7 @@ def trace( | |||
| 226 | 233 | if TYPE_CHECKING: | |
| 227 | 234 | assert isinstance(result, requests.Response) | |
| 228 | 235 | return_value = utils.response_content( | |
| 229 | - result, streamed, iterator, action, chunk_size | ||
| 236 | + result, streamed, action, chunk_size, iterator=iterator | ||
| 230 | 237 | ) | |
| 231 | 238 | if TYPE_CHECKING: | |
| 232 | 239 | assert isinstance(return_value, dict) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -103,9 +103,10 @@ def download( | |||
| 103 | 103 | package_version: str, | |
| 104 | 104 | file_name: str, | |
| 105 | 105 | streamed: bool = False, | |
| 106 | - iterator: bool = False, | ||
| 107 | 106 | action: Optional[Callable] = None, | |
| 108 | 107 | chunk_size: int = 1024, | |
| 108 | + *, | ||
| 109 | + iterator: bool = False, | ||
| 109 | 110 | **kwargs: Any, | |
| 110 | 111 | ) -> Optional[Union[bytes, Iterator[Any]]]: | |
| 111 | 112 | """Download a generic package. | |
@@ -135,7 +136,9 @@ def download( | |||
| 135 | 136 | result = self.gitlab.http_get(path, streamed=streamed, raw=True, **kwargs) | |
| 136 | 137 | if TYPE_CHECKING: | |
| 137 | 138 | assert isinstance(result, requests.Response) | |
| 138 | - return utils.response_content(result, streamed, iterator, action, chunk_size) | ||
| 139 | + return utils.response_content( | ||
| 140 | + result, streamed, action, chunk_size, iterator=iterator | ||
| 141 | + ) | ||
| 139 | 142 | ||
| 140 | 143 | ||
| 141 | 144 | class GroupPackage(RESTObject): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -476,9 +476,10 @@ def snapshot( | |||
| 476 | 476 | self, | |
| 477 | 477 | wiki: bool = False, | |
| 478 | 478 | streamed: bool = False, | |
| 479 | - iterator: bool = False, | ||
| 480 | 479 | action: Optional[Callable] = None, | |
| 481 | 480 | chunk_size: int = 1024, | |
| 481 | + *, | ||
| 482 | + iterator: bool = False, | ||
| 482 | 483 | **kwargs: Any, | |
| 483 | 484 | ) -> Optional[Union[bytes, Iterator[Any]]]: | |
| 484 | 485 | """Return a snapshot of the repository. | |
@@ -508,7 +509,9 @@ def snapshot( | |||
| 508 | 509 | ) | |
| 509 | 510 | if TYPE_CHECKING: | |
| 510 | 511 | assert isinstance(result, requests.Response) | |
| 511 | - return utils.response_content(result, streamed, iterator, action, chunk_size) | ||
| 512 | + return utils.response_content( | ||
| 513 | + result, streamed, action, chunk_size, iterator=iterator | ||
| 514 | + ) | ||
| 512 | 515 | ||
| 513 | 516 | @cli.register_custom_action("Project", ("scope", "search")) | |
| 514 | 517 | @exc.on_http_error(exc.GitlabSearchError) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -107,9 +107,10 @@ def repository_raw_blob( | |||
| 107 | 107 | self, | |
| 108 | 108 | sha: str, | |
| 109 | 109 | streamed: bool = False, | |
| 110 | - iterator: bool = False, | ||
| 111 | 110 | action: Optional[Callable[..., Any]] = None, | |
| 112 | 111 | chunk_size: int = 1024, | |
| 112 | + *, | ||
| 113 | + iterator: bool = False, | ||
| 113 | 114 | **kwargs: Any, | |
| 114 | 115 | ) -> Optional[Union[bytes, Iterator[Any]]]: | |
| 115 | 116 | """Return the raw file contents for a blob. | |
@@ -139,7 +140,9 @@ def repository_raw_blob( | |||
| 139 | 140 | ) | |
| 140 | 141 | if TYPE_CHECKING: | |
| 141 | 142 | assert isinstance(result, requests.Response) | |
| 142 | - return utils.response_content(result, streamed, iterator, action, chunk_size) | ||
| 143 | + return utils.response_content( | ||
| 144 | + result, streamed, action, chunk_size, iterator=iterator | ||
| 145 | + ) | ||
| 143 | 146 | ||
| 144 | 147 | @cli.register_custom_action("Project", ("from_", "to")) | |
| 145 | 148 | @exc.on_http_error(exc.GitlabGetError) | |
@@ -195,10 +198,11 @@ def repository_archive( | |||
| 195 | 198 | self, | |
| 196 | 199 | sha: str = None, | |
| 197 | 200 | streamed: bool = False, | |
| 198 | - iterator: bool = False, | ||
| 199 | 201 | action: Optional[Callable[..., Any]] = None, | |
| 200 | 202 | chunk_size: int = 1024, | |
| 201 | 203 | format: Optional[str] = None, | |
| 204 | + *, | ||
| 205 | + iterator: bool = False, | ||
| 202 | 206 | **kwargs: Any, | |
| 203 | 207 | ) -> Optional[Union[bytes, Iterator[Any]]]: | |
| 204 | 208 | """Return an archive of the repository. | |
@@ -234,7 +238,9 @@ def repository_archive( | |||
| 234 | 238 | ) | |
| 235 | 239 | if TYPE_CHECKING: | |
| 236 | 240 | assert isinstance(result, requests.Response) | |
| 237 | - return utils.response_content(result, streamed, iterator, action, chunk_size) | ||
| 241 | + return utils.response_content( | ||
| 242 | + result, streamed, action, chunk_size, iterator=iterator | ||
| 243 | + ) | ||
| 238 | 244 | ||
| 239 | 245 | @cli.register_custom_action("Project") | |
| 240 | 246 | @exc.on_http_error(exc.GitlabDeleteError) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,9 +29,10 @@ class Snippet(UserAgentDetailMixin, SaveMixin, ObjectDeleteMixin, RESTObject): | |||
| 29 | 29 | def content( | |
| 30 | 30 | self, | |
| 31 | 31 | streamed: bool = False, | |
| 32 | - iterator: bool = False, | ||
| 33 | 32 | action: Optional[Callable[..., Any]] = None, | |
| 34 | 33 | chunk_size: int = 1024, | |
| 34 | + *, | ||
| 35 | + iterator: bool = False, | ||
| 35 | 36 | **kwargs: Any, | |
| 36 | 37 | ) -> Optional[Union[bytes, Iterator[Any]]]: | |
| 37 | 38 | """Return the content of a snippet. | |
@@ -60,7 +61,9 @@ def content( | |||
| 60 | 61 | ) | |
| 61 | 62 | if TYPE_CHECKING: | |
| 62 | 63 | assert isinstance(result, requests.Response) | |
| 63 | - return utils.response_content(result, streamed, iterator, action, chunk_size) | ||
| 64 | + return utils.response_content( | ||
| 65 | + result, streamed, action, chunk_size, iterator=iterator | ||
| 66 | + ) | ||
| 64 | 67 | ||
| 65 | 68 | ||
| 66 | 69 | class SnippetManager(CRUDMixin, RESTManager): | |
@@ -106,9 +109,10 @@ class ProjectSnippet(UserAgentDetailMixin, SaveMixin, ObjectDeleteMixin, RESTObj | |||
| 106 | 109 | def content( | |
| 107 | 110 | self, | |
| 108 | 111 | streamed: bool = False, | |
| 109 | - iterator: bool = False, | ||
| 110 | 112 | action: Optional[Callable[..., Any]] = None, | |
| 111 | 113 | chunk_size: int = 1024, | |
| 114 | + *, | ||
| 115 | + iterator: bool = False, | ||
| 112 | 116 | **kwargs: Any, | |
| 113 | 117 | ) -> Optional[Union[bytes, Iterator[Any]]]: | |
| 114 | 118 | """Return the content of a snippet. | |
@@ -137,7 +141,9 @@ def content( | |||
| 137 | 141 | ) | |
| 138 | 142 | if TYPE_CHECKING: | |
| 139 | 143 | assert isinstance(result, requests.Response) | |
| 140 | - return utils.response_content(result, streamed, iterator, action, chunk_size) | ||
| 144 | + return utils.response_content( | ||
| 145 | + result, streamed, action, chunk_size, iterator=iterator | ||
| 146 | + ) | ||
| 141 | 147 | ||
| 142 | 148 | ||
| 143 | 149 | class ProjectSnippetManager(CRUDMixin, RESTManager): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,7 +37,7 @@ def test_response_content(capsys): | |||
| 37 | 37 | ||
| 38 | 38 | resp = requests.get("https://example.com", stream=True) | |
| 39 | 39 | utils.response_content( | |
| 40 | - resp, streamed=True, iterator=False, action=None, chunk_size=1024 | ||
| 40 | + resp, streamed=True, action=None, chunk_size=1024, iterator=False | ||
| 41 | 41 | ) | |
| 42 | 42 | ||
| 43 | 43 | captured = capsys.readouterr() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments