- Notifications
You must be signed in to change notification settings - Fork675
feat: emit a warning when using alist() method returns max#1875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
bc9471a to0cbddceComparecodecov-commenter commentedFeb 3, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
@@ Coverage Diff @@## main #1875 +/- ##======================================= Coverage 92.56% 92.57% ======================================= Files 78 78 Lines 4910 4930 +20 =======================================+ Hits 4545 4564 +19- Misses 365 366 +1
Flags with carried forward coverage won't be shown.Click here to find out more.
|
d6ef9fe to9d1e6e8Compare92da850 toc790f8cCompareJohnVillalovos commentedFeb 4, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Example program using this: Run of program: |
0223989 to63a6f1eCompareec10a57 to9aa7a66Comparefb933c5 to1fc8aa8CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
1fc8aa8 to9d7de47Compare3bd6d8d to439e50bCompare439e50b to0969cd8Comparef99cf74 toac15b21Comparenejch commentedApr 2, 2022
Finally had a look around and here's some more valid use cases where we don't want to emit warnings on this - essentially whenever any kind of list filter is applied, I'd say. In those cases users mostly only care about the first item.
|
Uh oh!
There was an error while loading.Please reload this page.
JohnVillalovos commentedApr 11, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Answering without doing a lot of research on these:
Warning will not be issued unless for some reason 20 items are returned by the
Warning will not be issued unless for some reason 20 items are returned by the
Yes a warning has a good chance of being produced for this one. I have submitted a PR that adds a |
ac15b21 to9117111CompareA common cause of issues filed and questions raised is that a userwill call a `list()` method and only get 20 items. As this is thedefault maximum of items that will be returned from a `list()` method.To help with this we now emit a warning when the result from a`list()` method is greater-than or equal to 20 (or the specified`per_page` value) and the user is not using either `all=True`,`all=False`, `as_list=False`, or `page=X`.
9117111 to1339d64Compare
nejch left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for this@JohnVillalovos! Took a while as I am really uneasy about eagerly sending warnings but this will definitely reduce the issues filed.
JohnVillalovos commentedApr 13, 2022
Thanks@nejch ! I'm interested to see feedback on it once it starts getting used by people. I know when I tried it on my code I found spots where I was like "whoops!". |
Uh oh!
There was an error while loading.Please reload this page.
A common cause of issues filed and questions raised is that a user
will call a
list()method and only get 20 items. As this is thedefault maximum of items that will be returned from a
list()method.To help with this we now emit a warning when the result from a
list()method is greater-than or equal to 20 (or the specifiedper_pagevalue) and the user is not using eitherall=True,all=False,as_list=False, orpage=X.