Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b6d89e

Browse files
JohnVillalovosnejch
authored andcommitted
refactor(list):as_list support is removed.
In `list()` calls support for the `as_list` argument has been removed.`as_list` was previously deprecated and now the use of `iterator` willbe required if wanting to have same functionality as using `as_list`BREAKING CHANGE: Support for the deprecated `as_list` argument in`list()` calls has been removed. Use `iterator` instead.
1 parent0b17a2d commit9b6d89e

File tree

3 files changed

+0
-60
lines changed

3 files changed

+0
-60
lines changed

‎gitlab/client.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,6 @@ def http_list(
843843
path:str,
844844
query_data:Optional[Dict[str,Any]]=None,
845845
*,
846-
as_list:Optional[bool]=None,# Deprecated in favor of `iterator`
847846
iterator:Optional[bool]=None,
848847
**kwargs:Any,
849848
)->Union["GitlabList",List[Dict[str,Any]]]:
@@ -870,23 +869,6 @@ def http_list(
870869
"""
871870
query_data=query_dataor {}
872871

873-
# Don't allow both `as_list` and `iterator` to be set.
874-
ifas_listisnotNoneanditeratorisnotNone:
875-
raiseValueError(
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-
ifas_listisnotNone:
881-
iterator=notas_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-
890872
# Provide a `get_all`` param to avoid clashes with `all` API attributes.
891873
get_all=kwargs.pop("get_all",None)
892874

@@ -900,8 +882,6 @@ def http_list(
900882

901883
ifiteratorandpageisnotNone:
902884
arg_used_message=f"iterator={iterator}"
903-
ifas_listisnotNone:
904-
arg_used_message=f"as_list={as_list}"
905885
utils.warn(
906886
message=(
907887
f"`{arg_used_message}` and `page={page}` were both specified. "

‎tests/functional/api/test_gitlab.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -282,17 +282,3 @@ def test_list_iterator_true_nowarning(gl, recwarn):
282282
items=gl.gitlabciymls.list(iterator=True)
283283
assertnotrecwarn
284284
assertlen(list(items))>20
285-
286-
287-
deftest_list_as_list_false_warnings(gl):
288-
"""Using `as_list=False` will disable the UserWarning but cause a
289-
DeprecationWarning"""
290-
withpytest.warns(DeprecationWarning)asrecord:
291-
items=gl.gitlabciymls.list(as_list=False)
292-
assertlen(record)==1
293-
assertlen(list(items))>20
294-
295-
296-
deftest_list_with_as_list_and_iterator_raises(gl):
297-
withpytest.raises(ValueError,match="`as_list` or `iterator`"):
298-
gl.gitlabciymls.list(as_list=False,iterator=True)

‎tests/unit/test_gitlab_http_methods.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -556,14 +556,6 @@ def test_list_request_page_and_iterator(gl):
556556
assertlen(result)==20
557557
assertlen(responses.calls)==1
558558

559-
withpytest.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-
assertisinstance(result,list)
564-
assertlen(result)==20
565-
assertlen(responses.calls)==2
566-
567559

568560
large_list_response= {
569561
"method":responses.GET,
@@ -596,24 +588,6 @@ def test_list_request_page_and_iterator(gl):
596588
}
597589

598590

599-
@responses.activate
600-
deftest_as_list_deprecation_warning(gl):
601-
responses.add(**large_list_response)
602-
603-
withwarnings.catch_warnings(record=True)ascaught_warnings:
604-
result=gl.http_list("/projects",as_list=False)
605-
assertlen(caught_warnings)==1
606-
warning=caught_warnings[0]
607-
assertisinstance(warning.message,DeprecationWarning)
608-
message=str(warning.message)
609-
assert"`as_list=False` is deprecated"inmessage
610-
assert"Use `iterator=True` instead"inmessage
611-
assert__file__==warning.filename
612-
assertnotisinstance(result,list)
613-
assertlen(list(result))==20
614-
assertlen(responses.calls)==1
615-
616-
617591
@responses.activate
618592
deftest_list_request_pagination_warning(gl):
619593
responses.add(**large_list_response)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp