| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0b17a2d commit 9b6d89e
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -843,7 +843,6 @@ def http_list( | |||
| 843 | 843 | path: str, | |
| 844 | 844 | query_data: Optional[Dict[str, Any]] = None, | |
| 845 | 845 | *, | |
| 846 | - as_list: Optional[bool] = None, # Deprecated in favor of `iterator` | ||
| 847 | 846 | iterator: Optional[bool] = None, | |
| 848 | 847 | **kwargs: Any, | |
| 849 | 848 | ) -> Union["GitlabList", List[Dict[str, Any]]]: | |
@@ -870,23 +869,6 @@ def http_list( | |||
| 870 | 869 | """ | |
| 871 | 870 | query_data = query_data or {} | |
| 872 | 871 | ||
| 873 | - # Don't allow both `as_list` and `iterator` to be set. | ||
| 874 | - if as_list is not None and iterator is not None: | ||
| 875 | - raise ValueError( | ||
| 876 | - "Only one of `as_list` or `iterator` can be used. " | ||
| 877 | - "Use `iterator` instead of `as_list`. `as_list` is deprecated." | ||
| 878 | - ) | ||
| 879 | - | ||
| 880 | - if as_list is not None: | ||
| 881 | - iterator = not as_list | ||
| 882 | - utils.warn( | ||
| 883 | - message=( | ||
| 884 | - f"`as_list={as_list}` is deprecated and will be removed in a " | ||
| 885 | - f"future version. Use `iterator={iterator}` instead." | ||
| 886 | - ), | ||
| 887 | - category=DeprecationWarning, | ||
| 888 | - ) | ||
| 889 | - | ||
| 890 | 872 | # Provide a `get_all`` param to avoid clashes with `all` API attributes. | |
| 891 | 873 | get_all = kwargs.pop("get_all", None) | |
| 892 | 874 | ||
@@ -900,8 +882,6 @@ def http_list( | |||
| 900 | 882 | ||
| 901 | 883 | if iterator and page is not None: | |
| 902 | 884 | arg_used_message = f"iterator={iterator}" | |
| 903 | - if as_list is not None: | ||
| 904 | - arg_used_message = f"as_list={as_list}" | ||
| 905 | 885 | utils.warn( | |
| 906 | 886 | message=( | |
| 907 | 887 | f"`{arg_used_message}` and `page={page}` were both specified. " | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -282,17 +282,3 @@ def test_list_iterator_true_nowarning(gl, recwarn): | |||
| 282 | 282 | items = gl.gitlabciymls.list(iterator=True) | |
| 283 | 283 | assert not recwarn | |
| 284 | 284 | assert len(list(items)) > 20 | |
| 285 | - | ||
| 286 | - | ||
| 287 | - def test_list_as_list_false_warnings(gl): | ||
| 288 | - """Using `as_list=False` will disable the UserWarning but cause a | ||
| 289 | - DeprecationWarning""" | ||
| 290 | - with pytest.warns(DeprecationWarning) as record: | ||
| 291 | - items = gl.gitlabciymls.list(as_list=False) | ||
| 292 | - assert len(record) == 1 | ||
| 293 | - assert len(list(items)) > 20 | ||
| 294 | - | ||
| 295 | - | ||
| 296 | - def test_list_with_as_list_and_iterator_raises(gl): | ||
| 297 | - with pytest.raises(ValueError, match="`as_list` or `iterator`"): | ||
| 298 | - gl.gitlabciymls.list(as_list=False, iterator=True) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -556,14 +556,6 @@ def test_list_request_page_and_iterator(gl): | |||
| 556 | 556 | assert len(result) == 20 | |
| 557 | 557 | assert len(responses.calls) == 1 | |
| 558 | 558 | ||
| 559 | - with pytest.warns( | ||
| 560 | - UserWarning, match="`as_list=False` and `page=1` were both specified" | ||
| 561 | - ): | ||
| 562 | - result = gl.http_list("/projects", as_list=False, page=1) | ||
| 563 | - assert isinstance(result, list) | ||
| 564 | - assert len(result) == 20 | ||
| 565 | - assert len(responses.calls) == 2 | ||
| 566 | - | ||
| 567 | 559 | ||
| 568 | 560 | large_list_response = { | |
| 569 | 561 | "method": responses.GET, | |
@@ -596,24 +588,6 @@ def test_list_request_page_and_iterator(gl): | |||
| 596 | 588 | } | |
| 597 | 589 | ||
| 598 | 590 | ||
| 599 | - @responses.activate | ||
| 600 | - def test_as_list_deprecation_warning(gl): | ||
| 601 | - responses.add(**large_list_response) | ||
| 602 | - | ||
| 603 | - with warnings.catch_warnings(record=True) as caught_warnings: | ||
| 604 | - result = gl.http_list("/projects", as_list=False) | ||
| 605 | - assert len(caught_warnings) == 1 | ||
| 606 | - warning = caught_warnings[0] | ||
| 607 | - assert isinstance(warning.message, DeprecationWarning) | ||
| 608 | - message = str(warning.message) | ||
| 609 | - assert "`as_list=False` is deprecated" in message | ||
| 610 | - assert "Use `iterator=True` instead" in message | ||
| 611 | - assert __file__ == warning.filename | ||
| 612 | - assert not isinstance(result, list) | ||
| 613 | - assert len(list(result)) == 20 | ||
| 614 | - assert len(responses.calls) == 1 | ||
| 615 | - | ||
| 616 | - | ||
| 617 | 591 | @responses.activate | |
| 618 | 592 | def test_list_request_pagination_warning(gl): | |
| 619 | 593 | responses.add(**large_list_response) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments