| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,7 +42,7 @@ Example:: | |||
| 42 | 42 | Not all items are returned from the API | |
| 43 | 43 | """"""""""""""""""""""""""""""""""""""" | |
| 44 | 44 | ||
| 45 | - If you've passed ``all=True`` (or ``--all`` via the CLI) to the API and still cannot see all items returned, | ||
| 45 | + If you've passed ``all=True`` to the API and still cannot see all items returned, | ||
| 46 | 46 | use ``get_all=True`` (or ``--get-all`` via the CLI) instead. See :ref:`pagination` for more details. | |
| 47 | 47 | ||
| 48 | 48 | Common errors | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -255,11 +255,6 @@ a branch or tag:: | |||
| 255 | 255 | ||
| 256 | 256 | project.artifacts.download(ref_name='main', job='build') | |
| 257 | 257 | ||
| 258 | - .. attention:: | ||
| 259 | - | ||
| 260 | - An older method ``project.artifacts()`` is deprecated and will be | ||
| 261 | - removed in a future version. | ||
| 262 | - | ||
| 263 | 258 | .. warning:: | |
| 264 | 259 | ||
| 265 | 260 | Artifacts are entirely stored in memory in this example. | |
@@ -305,11 +300,6 @@ Get a single artifact file by branch and job:: | |||
| 305 | 300 | ||
| 306 | 301 | project.artifacts.raw('branch', 'path/to/file', 'job') | |
| 307 | 302 | ||
| 308 | - .. attention:: | ||
| 309 | - | ||
| 310 | - An older method ``project.artifact()`` is deprecated and will be | ||
| 311 | - removed in a future version. | ||
| 312 | - | ||
| 313 | 303 | Mark a job artifact as kept when expiration is set:: | |
| 314 | 304 | ||
| 315 | 305 | build_or_job.keep_artifacts() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -402,32 +402,6 @@ def version(self) -> Tuple[str, str]: | |||
| 402 | 402 | ||
| 403 | 403 | return cast(str, self._server_version), cast(str, self._server_revision) | |
| 404 | 404 | ||
| 405 | - @gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabVerifyError) | ||
| 406 | - def lint(self, content: str, **kwargs: Any) -> Tuple[bool, List[str]]: | ||
| 407 | - """Validate a gitlab CI configuration. | ||
| 408 | - | ||
| 409 | - Args: | ||
| 410 | - content: The .gitlab-ci.yml content | ||
| 411 | - **kwargs: Extra options to send to the server (e.g. sudo) | ||
| 412 | - | ||
| 413 | - Raises: | ||
| 414 | - GitlabAuthenticationError: If authentication is not correct | ||
| 415 | - GitlabVerifyError: If the validation could not be done | ||
| 416 | - | ||
| 417 | - Returns: | ||
| 418 | - (True, []) if the file is valid, (False, errors(list)) otherwise | ||
| 419 | - """ | ||
| 420 | - utils.warn( | ||
| 421 | - "`lint()` is deprecated and will be removed in a future version.\n" | ||
| 422 | - "Please use `ci_lint.create()` instead.", | ||
| 423 | - category=DeprecationWarning, | ||
| 424 | - ) | ||
| 425 | - post_data = {"content": content} | ||
| 426 | - data = self.http_post("/ci/lint", post_data=post_data, **kwargs) | ||
| 427 | - if TYPE_CHECKING: | ||
| 428 | - assert not isinstance(data, requests.Response) | ||
| 429 | - return (data["status"] == "valid", data["errors"]) | ||
| 430 | - | ||
| 431 | 405 | @gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabMarkdownError) | |
| 432 | 406 | def markdown( | |
| 433 | 407 | self, text: str, gfm: bool = False, project: Optional[str] = None, **kwargs: Any | |
@@ -869,7 +843,6 @@ def http_list( | |||
| 869 | 843 | path: str, | |
| 870 | 844 | query_data: Optional[Dict[str, Any]] = None, | |
| 871 | 845 | *, | |
| 872 | - as_list: Optional[bool] = None, # Deprecated in favor of `iterator` | ||
| 873 | 846 | iterator: Optional[bool] = None, | |
| 874 | 847 | **kwargs: Any, | |
| 875 | 848 | ) -> Union["GitlabList", List[Dict[str, Any]]]: | |
@@ -896,23 +869,6 @@ def http_list( | |||
| 896 | 869 | """ | |
| 897 | 870 | query_data = query_data or {} | |
| 898 | 871 | ||
| 899 | - # Don't allow both `as_list` and `iterator` to be set. | ||
| 900 | - if as_list is not None and iterator is not None: | ||
| 901 | - raise ValueError( | ||
| 902 | - "Only one of `as_list` or `iterator` can be used. " | ||
| 903 | - "Use `iterator` instead of `as_list`. `as_list` is deprecated." | ||
| 904 | - ) | ||
| 905 | - | ||
| 906 | - if as_list is not None: | ||
| 907 | - iterator = not as_list | ||
| 908 | - utils.warn( | ||
| 909 | - message=( | ||
| 910 | - f"`as_list={as_list}` is deprecated and will be removed in a " | ||
| 911 | - f"future version. Use `iterator={iterator}` instead." | ||
| 912 | - ), | ||
| 913 | - category=DeprecationWarning, | ||
| 914 | - ) | ||
| 915 | - | ||
| 916 | 872 | # Provide a `get_all`` param to avoid clashes with `all` API attributes. | |
| 917 | 873 | get_all = kwargs.pop("get_all", None) | |
| 918 | 874 | ||
@@ -926,8 +882,6 @@ def http_list( | |||
| 926 | 882 | ||
| 927 | 883 | if iterator and page is not None: | |
| 928 | 884 | arg_used_message = f"iterator={iterator}" | |
| 929 | - if as_list is not None: | ||
| 930 | - arg_used_message = f"as_list={as_list}" | ||
| 931 | 885 | utils.warn( | |
| 932 | 886 | message=( | |
| 933 | 887 | f"`{arg_used_message}` and `page={page}` were both specified. " | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -236,12 +236,6 @@ def _populate_sub_parser_by_class( | |||
| 236 | 236 | action="store_true", | |
| 237 | 237 | help="Return all items from the server, without pagination.", | |
| 238 | 238 | ) | |
| 239 | - sub_parser_action.add_argument( | ||
| 240 | - "--all", | ||
| 241 | - required=False, | ||
| 242 | - action="store_true", | ||
| 243 | - help="Deprecated. Use --get-all instead.", | ||
| 244 | - ) | ||
| 245 | 239 | ||
| 246 | 240 | if action_name == "delete": | |
| 247 | 241 | if cls._id_attr is not None: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,30 +25,6 @@ class ProjectArtifactManager(RESTManager): | |||
| 25 | 25 | _path = "/projects/{project_id}/jobs/artifacts" | |
| 26 | 26 | _from_parent_attrs = {"project_id": "id"} | |
| 27 | 27 | ||
| 28 | - @cli.register_custom_action( | ||
| 29 | - "Project", ("ref_name", "job"), ("job_token",), custom_action="artifacts" | ||
| 30 | - ) | ||
| 31 | - def __call__( | ||
| 32 | - self, | ||
| 33 | - *args: Any, | ||
| 34 | - **kwargs: Any, | ||
| 35 | - ) -> Optional[bytes]: | ||
| 36 | - utils.warn( | ||
| 37 | - message=( | ||
| 38 | - "The project.artifacts() method is deprecated and will be removed in a " | ||
| 39 | - "future version. Use project.artifacts.download() instead.\n" | ||
| 40 | - ), | ||
| 41 | - category=DeprecationWarning, | ||
| 42 | - ) | ||
| 43 | - data = self.download( | ||
| 44 | - *args, | ||
| 45 | - **kwargs, | ||
| 46 | - ) | ||
| 47 | - if TYPE_CHECKING: | ||
| 48 | - assert data is not None | ||
| 49 | - assert isinstance(data, bytes) | ||
| 50 | - return data | ||
| 51 | - | ||
| 52 | 28 | @exc.on_http_error(exc.GitlabDeleteError) | |
| 53 | 29 | def delete(self, **kwargs: Any) -> None: | |
| 54 | 30 | """Delete the project's artifacts on the server. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -155,6 +155,7 @@ class ProjectCommitManager(RetrieveMixin, CreateMixin, RESTManager): | |||
| 155 | 155 | optional=("author_email", "author_name"), | |
| 156 | 156 | ) | |
| 157 | 157 | _list_filters = ( | |
| 158 | + "all", | ||
| 158 | 159 | "ref_name", | |
| 159 | 160 | "since", | |
| 160 | 161 | "until", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,7 @@ | |||
| 5 | 5 | import gitlab | |
| 6 | 6 | from gitlab import cli | |
| 7 | 7 | from gitlab import exceptions as exc | |
| 8 | - from gitlab import types, utils | ||
| 8 | + from gitlab import types | ||
| 9 | 9 | from gitlab.base import RESTManager, RESTObject | |
| 10 | 10 | from gitlab.mixins import ( | |
| 11 | 11 | CreateMixin, | |
@@ -164,64 +164,6 @@ def search( | |||
| 164 | 164 | path = f"/groups/{self.encoded_id}/search" | |
| 165 | 165 | return self.manager.gitlab.http_list(path, query_data=data, **kwargs) | |
| 166 | 166 | ||
| 167 | - @cli.register_custom_action("Group", ("cn", "group_access", "provider")) | ||
| 168 | - @exc.on_http_error(exc.GitlabCreateError) | ||
| 169 | - def add_ldap_group_link( | ||
| 170 | - self, cn: str, group_access: int, provider: str, **kwargs: Any | ||
| 171 | - ) -> None: | ||
| 172 | - """Add an LDAP group link. | ||
| 173 | - | ||
| 174 | - Args: | ||
| 175 | - cn: CN of the LDAP group | ||
| 176 | - group_access: Minimum access level for members of the LDAP | ||
| 177 | - group | ||
| 178 | - provider: LDAP provider for the LDAP group | ||
| 179 | - **kwargs: Extra options to send to the server (e.g. sudo) | ||
| 180 | - | ||
| 181 | - Raises: | ||
| 182 | - GitlabAuthenticationError: If authentication is not correct | ||
| 183 | - GitlabCreateError: If the server cannot perform the request | ||
| 184 | - """ | ||
| 185 | - utils.warn( | ||
| 186 | - message=( | ||
| 187 | - "The add_ldap_group_link() method is deprecated and will be removed " | ||
| 188 | - "in a future version. Use ldap_group_links.create() instead." | ||
| 189 | - ), | ||
| 190 | - category=DeprecationWarning, | ||
| 191 | - ) | ||
| 192 | - path = f"/groups/{self.encoded_id}/ldap_group_links" | ||
| 193 | - data = {"cn": cn, "group_access": group_access, "provider": provider} | ||
| 194 | - self.manager.gitlab.http_post(path, post_data=data, **kwargs) | ||
| 195 | - | ||
| 196 | - @cli.register_custom_action("Group", ("cn",), ("provider",)) | ||
| 197 | - @exc.on_http_error(exc.GitlabDeleteError) | ||
| 198 | - def delete_ldap_group_link( | ||
| 199 | - self, cn: str, provider: Optional[str] = None, **kwargs: Any | ||
| 200 | - ) -> None: | ||
| 201 | - """Delete an LDAP group link. | ||
| 202 | - | ||
| 203 | - Args: | ||
| 204 | - cn: CN of the LDAP group | ||
| 205 | - provider: LDAP provider for the LDAP group | ||
| 206 | - **kwargs: Extra options to send to the server (e.g. sudo) | ||
| 207 | - | ||
| 208 | - Raises: | ||
| 209 | - GitlabAuthenticationError: If authentication is not correct | ||
| 210 | - GitlabDeleteError: If the server cannot perform the request | ||
| 211 | - """ | ||
| 212 | - utils.warn( | ||
| 213 | - message=( | ||
| 214 | - "The delete_ldap_group_link() method is deprecated and will be " | ||
| 215 | - "removed in a future version. Use ldap_group_links.delete() instead." | ||
| 216 | - ), | ||
| 217 | - category=DeprecationWarning, | ||
| 218 | - ) | ||
| 219 | - path = f"/groups/{self.encoded_id}/ldap_group_links" | ||
| 220 | - if provider is not None: | ||
| 221 | - path += f"/{provider}" | ||
| 222 | - path += f"/{cn}" | ||
| 223 | - self.manager.gitlab.http_delete(path, **kwargs) | ||
| 224 | - | ||
| 225 | 167 | @cli.register_custom_action("Group") | |
| 226 | 168 | @exc.on_http_error(exc.GitlabCreateError) | |
| 227 | 169 | def ldap_sync(self, **kwargs: Any) -> None: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -625,37 +625,6 @@ def transfer(self, to_namespace: Union[int, str], **kwargs: Any) -> None: | |||
| 625 | 625 | path, post_data={"namespace": to_namespace}, **kwargs | |
| 626 | 626 | ) | |
| 627 | 627 | ||
| 628 | - @cli.register_custom_action("Project", ("to_namespace",)) | ||
| 629 | - def transfer_project(self, *args: Any, **kwargs: Any) -> None: | ||
| 630 | - utils.warn( | ||
| 631 | - message=( | ||
| 632 | - "The project.transfer_project() method is deprecated and will be " | ||
| 633 | - "removed in a future version. Use project.transfer() instead." | ||
| 634 | - ), | ||
| 635 | - category=DeprecationWarning, | ||
| 636 | - ) | ||
| 637 | - return self.transfer(*args, **kwargs) | ||
| 638 | - | ||
| 639 | - @cli.register_custom_action("Project", ("ref_name", "artifact_path", "job")) | ||
| 640 | - @exc.on_http_error(exc.GitlabGetError) | ||
| 641 | - def artifact( | ||
| 642 | - self, | ||
| 643 | - *args: Any, | ||
| 644 | - **kwargs: Any, | ||
| 645 | - ) -> Optional[bytes]: | ||
| 646 | - utils.warn( | ||
| 647 | - message=( | ||
| 648 | - "The project.artifact() method is deprecated and will be " | ||
| 649 | - "removed in a future version. Use project.artifacts.raw() instead." | ||
| 650 | - ), | ||
| 651 | - category=DeprecationWarning, | ||
| 652 | - ) | ||
| 653 | - data = self.artifacts.raw(*args, **kwargs) | ||
| 654 | - if TYPE_CHECKING: | ||
| 655 | - assert data is not None | ||
| 656 | - assert isinstance(data, bytes) | ||
| 657 | - return data | ||
| 658 | - | ||
| 659 | 628 | ||
| 660 | 629 | class ProjectManager(CRUDMixin, RESTManager): | |
| 661 | 630 | _path = "/projects" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -50,9 +50,12 @@ class ProjectReleaseLinkManager(CRUDMixin, RESTManager): | |||
| 50 | 50 | _obj_cls = ProjectReleaseLink | |
| 51 | 51 | _from_parent_attrs = {"project_id": "project_id", "tag_name": "tag_name"} | |
| 52 | 52 | _create_attrs = RequiredOptional( | |
| 53 | - required=("name", "url"), optional=("filepath", "link_type") | ||
| 53 | + required=("name", "url"), | ||
| 54 | + optional=("filepath", "direct_asset_path", "link_type"), | ||
| 55 | + ) | ||
| 56 | + _update_attrs = RequiredOptional( | ||
| 57 | + optional=("name", "url", "filepath", "direct_asset_path", "link_type") | ||
| 54 | 58 | ) | |
| 55 | - _update_attrs = RequiredOptional(optional=("name", "url", "filepath", "link_type")) | ||
| 56 | 59 | ||
| 57 | 60 | def get( | |
| 58 | 61 | self, id: Union[str, int], lazy: bool = False, **kwargs: Any | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -66,13 +66,6 @@ def test_markdown_in_project(gl, project): | |||
| 66 | 66 | assert "foo" in html | |
| 67 | 67 | ||
| 68 | 68 | ||
| 69 | - def test_lint(gl): | ||
| 70 | - with pytest.deprecated_call(): | ||
| 71 | - success, errors = gl.lint("Invalid") | ||
| 72 | - assert success is False | ||
| 73 | - assert errors | ||
| 74 | - | ||
| 75 | - | ||
| 76 | 69 | def test_sidekiq_queue_metrics(gl): | |
| 77 | 70 | out = gl.sidekiq.queue_metrics() | |
| 78 | 71 | assert isinstance(out, dict) | |
@@ -289,17 +282,3 @@ def test_list_iterator_true_nowarning(gl, recwarn): | |||
| 289 | 282 | items = gl.gitlabciymls.list(iterator=True) | |
| 290 | 283 | assert not recwarn | |
| 291 | 284 | assert len(list(items)) > 20 | |
| 292 | - | ||
| 293 | - | ||
| 294 | - def test_list_as_list_false_warnings(gl): | ||
| 295 | - """Using `as_list=False` will disable the UserWarning but cause a | ||
| 296 | - DeprecationWarning""" | ||
| 297 | - with pytest.warns(DeprecationWarning) as record: | ||
| 298 | - items = gl.gitlabciymls.list(as_list=False) | ||
| 299 | - assert len(record) == 1 | ||
| 300 | - assert len(list(items)) > 20 | ||
| 301 | - | ||
| 302 | - | ||
| 303 | - def test_list_with_as_list_and_iterator_raises(gl): | ||
| 304 | - with pytest.raises(ValueError, match="`as_list` or `iterator`"): | ||
| 305 | - gl.gitlabciymls.list(as_list=False, iterator=True) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments