feat(client): introduce iterator=True and deprecate as_list=False in list()#2032
Merged
feat(client): introduce iterator=True and deprecate as_list=False in list()#2032
iterator=True and deprecate as_list=False in list()#2032Conversation
7825972 to
c678721
Compare
c678721 to
b4ae128
Compare
Codecov Report
@@ Coverage Diff @@
## main #2032 +/- ##
==========================================
- Coverage 92.72% 92.71% -0.02%
==========================================
Files 78 78
Lines 4947 4953 +6
==========================================
+ Hits 4587 4592 +5
- Misses 360 361 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
nejch
requested changes
May 29, 2022
Member
nejch
left a comment
There was a problem hiding this comment.
Looks good @JohnVillalovos just a few minor comments.
Context for future readers:
https://github.com/python-gitlab/python-gitlab/pull/1956/files#r884302316
… in `list()` `as_list=False` is confusing as it doesn't explain what is being returned. Replace it with `iterator=True` which more clearly explains to the user that an iterator/generator will be returned. This maintains backward compatibility with `as_list` but does issue a DeprecationWarning if `as_list` is set.
b4ae128 to
cdc6605
Compare
list() change as_list=False to iterator=Trueiterator=True and deprecate as_list=False in list()
nejch
approved these changes
May 29, 2022
Member
nejch
left a comment
There was a problem hiding this comment.
Thanks @JohnVillalovos, makes sense to me, also makes it consistent with the iterator arg on the upcoming streaming responses PR then.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
as_list=Falseis confusing as it doesn't explain what is beingreturned. Replace it with
iterator=Truewhich more clearly explainsto the user that an iterator/generator will be returned.
This maintains backward compatibility with
as_listbut does issue aDeprecationWarning if
as_listis set.