When calculating totalCount for a PaginatedList, if a Link header is not
in the returned data, we use len() to calculate the number of items.
PullRequest.get_review_requests() actually returns a dictionary, which
neatly defeats this naive method. Peer inside the dictionary in this
case, and add a test case.
Fixes#2053
Now that GitHub have moved their documentation from
developer.github.com, we should update our links. I have also tried to
update the call strings to their new format, but since it was done via
regex, some of them may not match exactly.
When calculating totalCount for PaginatedList, if the links data does
not contain a last page, we can't know how many elements are contained
in the list. Set it to 0 in that case.
Fixes#1614
A few test classes were failing to call tearDown() of the superclass,
which meant the file descriptors of their replydata files were leaking.
Make sure to call it, and switch every other callsite of superclasses by
name to using argument-less super().
Revert an AllTests change that snuck in during release.
With the Python 2.7 deadline fast approaching, modernize the codebase
making use of the modernize module to switch to using six, as well as
other upcoming features, such as absolute imports . Stop using 2to3
for Travis, yay!
When there is no link header sent, this signifies that this is the only
page of results. If data is empty, or only contains a list of items, we
should count them, but this can be defeated -- if the returned data
contains a total_count key, we should use it. This also uncovered a bug
in the test suite for searching topics.
Closes#960
This PR proposes adding two missing params to constructor in `.reversed`. This preserves the `headers` as well as the `list_item` once cloned.
Fixes#945.
This PR #596 seems stale, so I have opened up this one with the requested changes from @sfdye.
This is the code from @Tommos0's [comment][1] with some modification.
There are 2 tests failing. I think this is due to the change in the query string and the cached test data just needs to be refreshed for those tests.
[1]: https://github.com/PyGithub/PyGithub/pull/596#issuecomment-315013949
For /search resources the resulting JSON contains 'total_count' and
'items'. The latter is the list PaginatedList expects, so just
transparently use that list. Everything else works just like other
lists.
Also change __grow()'s visibility to allow PaginatedList to use it
in order to peek at 'total_count', making it available as a property.
Changed reversed(content) to content[::-1] in order to return
a real list and not a generator.
The code in PaginatedListBase.__grow does an iteration over
newElements when using `+=` and then returns them.
When using a generator, newElements would be empty when they are returned.
Fixes a bug introduced in the previous commits.
Now testing a case where no lastUrl is returned.
Also fixing a regression where nextUrl wasn't erased properly.