| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
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.
|
Sorry, something went wrong.
|
Example program using this: $ cat show-it.py
#!/usr/bin/python3 -ttu
import gitlab
gl = gitlab.Gitlab(url="https://gitlab.com")
project = gl.projects.get("gitlab-org/gitlab")
mrs = project.mergerequests.list(state="opened")
Run of program: $ ./show-it.py ..././show-it.py:7: UserWarning: Calling a `list()` method without specifying `all=True` or `as_list=False` will return a maximum of 20 items. Your query returned 20 of 1286 items. See https://python-gitlab.readthedocs.io/en/v3.1.1/api-usage.html#pagination for more details. If this was done intentionally, then this warning can be supressed by adding the argument `page=1` or `get_all=False` to the `list()` call. mrs = project.mergerequests.list(state="opened") |
Sorry, something went wrong.
|
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.
|
Sorry, something went wrong.
|
Answering without doing a lot of research on these:
Warning will not be issued unless for some reason 20 items are returned by the list() call. In that case it is likely highlighting a real error. I have submitted a PR that adds a all=True for this.
Warning will not be issued unless for some reason 20 items are returned by the list() call. In that case it is likely highlighting a real error. I have submitted a PR that adds a all=True for this.
Yes a warning has a good chance of being produced for this one. I have submitted a PR that adds a all=False for this. |
Sorry, something went wrong.
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 the default 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`.
There was a problem hiding this comment.
Thanks for this @JohnVillalovos! Took a while as I am really uneasy about eagerly sending warnings but this will definitely reduce the issues filed.
Sorry, something went wrong.
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!". |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
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 the
default 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.