Commit Graph
170 Commits
Author SHA1 Message Date
Jirka Borovec 13e178a3ab Set line length to 120 characters (#2599) 2023-07-13 17:37:20 +02:00
Trim21andEnrico Minack 61f9ae6c4b Merge some simple classes' type stubs back to source (#2576)
Co-authored-by: Enrico Minack <github@enrico.minack.dev>
2023-07-08 12:14:34 +02:00
Trim21 f087cad3cb Add message property to GithubException (#2591) 2023-07-08 11:51:19 +02:00
Trim21andEnrico Minack e306a3209b Merge Issue.pyi back to source (#2568)
Co-authored-by: Enrico Minack <github@enrico.minack.dev>
2023-07-07 11:43:29 +02:00
Trim21andEnrico Minack c5682489d9 Merge Branch type stubs back to source (#2571)
Introduces new helper methods `is_defined`, `is_undefined`, `is_optional`, `is_optional_list` that is going to simplify input assertions in all our methods.

Co-authored-by: Enrico Minack <github@enrico.minack.dev>
2023-07-04 09:42:53 +02:00
Enrico Minack bc68626941 Publish version 2.0.0 (#2583) 2023-07-04 07:59:53 +02:00
Enrico MinackandJohn T. Wodder II 0177f7c513 Make datetime objects timezone-aware (#2565)
Comparing timestamps returned by the API with naive datetime objects (without timezone information) will raise an error. Add `tzinfo=datetime.timezone.utc` to your datetime instance.

Co-authored-by: John T. Wodder II <git@varonathe.org>
2023-06-28 21:47:48 +02:00
Jonathan GregandEnrico Minack 517ad33654 Add Webhook Deliveries (#2508)
Co-authored-by: Enrico Minack <github@enrico.minack.dev>
2023-06-20 08:49:02 +02:00
b6258f4be9 merge GithubObject.pyi/Requester.pyi stubs back to source (#2463)
Co-authored-by: Enrico Minack <github@enrico.minack.dev>
Co-authored-by: Jonathan Leitschuh <jonathan.leitschuh@gmail.com>
2023-06-16 11:57:35 -04:00
Jonathan Leitschuh daf62bd461 Add support for new RepositoryAdvisories API 🎉 (#2483) 2023-06-09 13:42:18 -04:00
Steve Kowalik 4faff23ce9 Implement hash for CompletableGithubObject (#1922)
Since CompletableGithubObject already uses its URL attribute to
implement equality, extend it to also use that attribute for hashing.

Fixes #1826
2021-04-26 14:24:00 +10:00
Steve Kowalik ddd437a7cd Export headers in GithubException (#1887)
Since the headers that led to an exception are also useful, firstly pass
them into the constructor, and then export them in a property. Test one
specific use case to make sure of coverage.

Fixes #1814
2021-03-23 13:47:05 +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 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 989b635e33 Allow GithubObject.update() to be passed headers (#1300)
SourceImport.update() is really GithubObject.update(), which just calls
GET on the object's URL. Refetching a source import requires an
additional header, so change GithubObject.update() to pass any it is
given, and add a test for SourceImport.update()

Fixes #1297
2019-11-26 14:29:24 +11:00
Adam Baratz ac68274200 Expand Topic class and add test coverage (#1252)
* Expand Topic class and add test coverage

* Add test coverage for Topic properties

* Fix misspelling in comment
2019-11-04 15:06:52 +11:00
Steve Kowalik f91cbac2e3 Add an IncompletableObject exception (#1227)
If a returned object from GitHub does not include an URL, that object
can not be completed, and used to fail with an obscure traceback saying
NoneType has no method startswith. Check for this, and raise
IncompletableObject instead.
2019-09-23 16:40:06 +10:00
Steve Kowalik a0f01cf9cf Remove more Python version specific code (#1193)
Remove a bunch of other call sites that behaved differently between
Python 2 and 3, massively cleaning up a few messy methods.
2019-08-28 15:24:54 +10:00
Steve Kowalik cca8e3a5b4 Remove some uses of atLeastPython3 (#1191)
There are a number of call sites that would behave differently depending
on Python 2 or 3. A fair amount of them are left over from Python 3.2 or
Python 2.6 were the current versions, and it was much harder to write
compatible code for both versions. Happily, that is now in the past, so
refactor some of them out.
2019-08-05 16:14:39 +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 828b53b756 Silence more flake8 errors (#1160)
Make more whitespace changes to silence flake8 errors under the github
directory only.
2019-07-02 17:55:04 +08:00
Shubham Singh b4d895eddd Adding migration api wrapper (#899)
Closes #818
2018-12-21 12:01:01 +08:00
h.shi 1fa25670f7 Add highlight search to search_code function (#925)
*  add highlight search to search_code function

*  add highlighting search code tests
2018-10-10 16:38:47 +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
Sam Corbett 8ab9082cff Encode GithubObject repr values in utf-8 when using Python2 2016-11-30 10:15:51 +00:00
Jakub Wilk 10a28e0654 Fix typo in a constant 2016-10-16 22:28:45 +02:00
Jannis Gebauer 78374b9d5e sort params and make them work on py3 2016-09-08 10:46:06 +02:00
Jannis Gebauer 8571d87c77 adds a nicer __repr__ 2016-09-08 10:25:48 +02:00
Peter Buckley cb0cf0a680 update doc url everywhere (#420) 2016-07-12 16:38:02 -04:00
Andrew Scheller 959bc27f2d documentation typos 2014-05-27 09:44:35 +01: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
Vincent Jacques c6671c6466 Finish .../stats/... (#203) 2013-11-17 10:16:59 -08:00
Vincent Jacques d626f21484 Implement equality comparison of CompletableGithubObject (#201) 2013-11-10 16:28:52 -08:00
Vincent Jacques 5692c1ebb2 Acknowledge lack of test coverage in the old Download API 2013-11-10 15:57:08 -08:00
Vincent Jacques 072bf24277 Raise exception only when user *accesses* an attribute with a bad value (#195) 2013-09-12 11:45:29 +02:00
Vincent Jacques 2ee7aff8e6 Factorize 2013-09-12 10:16:57 +02:00
Vincent Jacques 597e123029 Factorize the creation of attributes (preparation for #195) 2013-09-12 09:27:25 +02:00
Vincent Jacques 4a5009741a Use ValuedAttribute and NotSet.value (preparation for #195) 2013-09-12 00:40:27 +02:00
Vincent Jacques f2feb81dae Add default parameters to greatly reduce code redoundancy 2013-09-06 11:01:32 +02:00
Vincent Jacques 3fe9edf087 Implement object persistence
This follows my proposal for #193.
Largely inspired by AKFish's work.
2013-09-04 23:28:44 +02:00
Vincent Jacques 020a3c9917 Move method update to CompletableGithubObject 2013-08-23 18:45:16 +02:00
Vincent Jacques e084b51381 #193: Fix test coverage 2013-08-23 14:51:34 +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 03d7fb012e #193: Add remarks 2013-08-23 11:15:17 +02:00
Vincent Jacques bae0a37d18 #193: Don't use a try-except for a usual execution flow in GithubObject.update
(and factorize assignment of headers in _storeAndUseAttributes,
as done for rawData)
2013-08-23 11:10:35 +02:00
Vincent Jacques fb7325884e Fix remarks on #189 to #193 2013-08-23 09:32:47 +02:00