Commit Graph
72 Commits
Author SHA1 Message Date
Trim21andEnrico Minack cb50dec5ba Merge PaginatedList.pyi back to source (#2555)
Co-authored-by: Enrico Minack <github@enrico.minack.dev>
2023-06-20 08:13:20 +02:00
Steve Kowalik 93b92cd2fc Correctly deal when PaginatedList's data is a dict (#2084)
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
2021-10-20 18:49:12 +11:00
Mark Walker ab36b89aa5 Fixed links to github docs. [#2009] 2021-07-31 02:34:34 +01:00
Steve Kowalik babcbcd04f Update most URLs to docs.github.com (#1896)
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.
2021-03-26 20:43:48 +11:00
Steve Kowalik e113e37de1 Add pyupgrade to pre-commit configuration (#1783)
To help us switch to f-strings and other 3.6+ changes, add pyupgrade to
our pre-commit configuration to keep the codebase clean.
2020-12-15 14:07:33 +11:00
Steve Kowalik 69b37b4ab6 PaginatedList's totalCount is 0 if no last page (#1641)
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
2020-08-09 19:05:04 +10:00
Emir HodzicandLiuyang Wan 85e71361fb more flexible header splitting (#1616)
Co-authored-by: Liuyang Wan <tsfdye@gmail.com>
2020-07-21 23:18:58 +08:00
Steve Kowalik 7046259832 Drop documentation for len() of PaginatedList (#1470)
PaginatedList does not support len(), so stop mentioning it in the
docstring.

Fixes #1462
2020-04-18 14:55:07 +10:00
Steve Kowalik dd31a70659 Silence most ResourceWarnings (#1393)
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.
2020-02-12 15:05:32 +11:00
Steve Kowalik b7894ea00c Drop Python 2 support (#1329)
With the Python 2 deadline gone, it's time to move with the times and
switch to Python 3 only.
2020-01-06 18:01:38 +11:00
Wan Liuyang 6ceb9e9a15 Apply black to whole codebase (#1303) 2019-12-10 17:14:33 +08:00
Steve Kowalik 89c967bb77 Cleanup try/except import in PaginatedList (#1228)
Since we're using six.moves to import parse_qs, we don't need to check
for an import exception, we can just import it directly.
2019-09-25 15:22:06 +10:00
Steve Kowalik dc2f2ad8cb Switch to using six (#1189)
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!
2019-08-05 14:06:19 +10:00
Steve Kowalik b8dad9817e Clean up a lot of pyflakes warnings (#1153)
Clean up unused imports or unused variables to mostly silence pyflakes.
We aren't quite yet in a place where we can run it via Travis, but baby
steps.
2019-07-02 18:06:09 +10:00
Steve Kowalik ec17761008 Use total_count from data in PaginatedList (#963)
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
2018-11-23 17:08:09 +08:00
netsgnut 60a684c5eb Added missing params to constructor when reversed (#946)
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.
2018-10-26 15:57:40 +08:00
Wan Liuyang 598bee8193 Fix totalCount for empty response, closes #905 2018-09-18 16:34:38 +08:00
Wan Liuyang 3f0caa4057 Sync copyright header 2018-08-19 10:47:41 +08:00
Wan Liuyang 8a589c9d73 Revert __len__ for PaginatedList to fix the tests, will revisit later 2018-07-10 10:36:30 +08:00
sfdye 8ae2bcb1e6 Implement __len__ for PaginatedList, fixes #579, closes #433 2018-07-08 11:40:17 +08:00
Joel Koglin e6eabe9ad0 Calcuate totalCount without iterating PaginatedList (#820)
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
2018-07-08 10:43:48 +08:00
sfdye 365a0a24d3 Apply fix_headers script to update copyright info 2018-03-17 20:06:16 +08:00
sfdye 58e1ef9ccb Fix copyright formatting 2018-03-13 22:30:47 +08:00
sfdye 020c136a40 Update doc link in copyright text 2018-03-13 22:07:38 +08:00
Wan Liuyang 8daae1375e Update doc link for PyPI 2018-03-02 11:37:27 +08:00
Gilad Shefer 5c9c2f7523 Updated PullRequest reviewer request according to API changes (#690)
https://developer.github.com/changes/2018-01-24-end-thor-preview/
2018-01-26 19:06:09 -08:00
Jannis Gebauer 33334e4345 adding support for the integrations installation endpoint 2017-02-01 10:51:13 +01:00
Peter Buckley cb0cf0a680 update doc url everywhere (#420) 2016-07-12 16:38:02 -04:00
Dan Vanderkam fb6f3cb3a2 Thread headers through PaginatedList 2015-10-14 11:07:13 -04:00
Eliot Walker a03f796f01 Fix paginated list handling of 204s 2015-02-06 13:47:14 -08:00
Vincent Jacques aadc286839 Work-around Issue278 2014-10-07 18:45:30 -07:00
Vincent Jacques abca7a026e pep8
This is strange, maybe Cygwin's version is stricter.
No time to investigate.
2014-05-04 12:54:05 -07:00
Thialfihar 9a51a61e3f Make PaginatedList support the search wrapper JSON
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.
2014-02-08 16:45:59 +01:00
Vincent Jacques f2feb81dae Add default parameters to greatly reduce code redoundancy 2013-09-06 11:01:32 +02:00
Vincent Jacques 64cf539c83 #193: Add a param to Requester.requestXxx for request headers 2013-08-23 11:31:01 +02:00
Vincent Jacques 8a2624e3a1 Merge branch 'topic/RememberHeaders' into develop (#192)
Conflicts:
	github/Issue.py
	github/MainClass.py
	github/PaginatedList.py
	github/Repository.py
	github/Requester.py
2013-08-22 10:30:14 +02:00
Vincent Jacques 5c475c7683 First review of #192 (pep8, headers... nothing important)
./manage.sh check
./manage.sh fix_headers
2013-08-22 10:12:38 +02:00
Vincent Jacques cbeea79a40 Update readme and doc for #184 2013-08-21 13:12:26 +02:00
Vincent Jacques 6a92d3ed63 Make PaginatedList.reversed return a new list (follow-up #184)
This will avoid surprises if both the list and its reversed version
are iterated.
2013-08-21 13:02:21 +02:00
AKFish 912bec79d2 Update copyright information 2013-08-21 17:45:01 +08:00
AKFish 8a301701db Remove helper method in PaginatedList.py 2013-08-21 17:25:29 +08:00
AKFish ed32e78da1 Update Commit.py and GitCommit.py 2013-08-21 15:26:05 +08:00
AKFish 2f31828502 Update RepositoryKey.py 2013-08-21 15:04:34 +08:00
AKFish b12c4b38c5 Update Tag.py 2013-08-21 13:05:41 +08:00
AKFish 0bc138b490 Change NonCompletableGithubObject without breaking build. 2013-08-21 12:32:41 +08:00
davidbrai cb03b9e7d1 bugfix: returning real list instead of generator
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.
2013-08-03 16:49:10 +03:00
davidbrai 271f3f301e bug fix: empty nextUrl if no next/prev
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.
2013-08-02 18:59:11 +03:00
davidbrai da6bd8c827 remove print #oops 2013-08-02 18:28:48 +03:00
davidbrai ef4cf44ebd support reverse iteration in PaginatedList
This uses the 'last' and 'prev' links in the HTTP headers.
The usage is repo.get_issues().reversed
2013-08-02 18:20:39 +03:00
Vincent Jacques 06a3d87098 Change source file header format 2013-07-13 19:03:53 +02:00