Commit Graph
53 Commits
Author SHA1 Message Date
Paul Luna 8dee53a833 Make Branch.edit_* functions return objects (#2748) 2023-09-07 08:44:01 +02:00
terenho 54f222676e fix required_conversation_resolution assertion (#2715) 2023-08-28 17:46:40 +02:00
Trim21 294c0cc9c5 Enable mypy disallow_untyped_defs (#2609) 2023-07-14 21:47:24 +02:00
Jirka Borovec 13e178a3ab Set line length to 120 characters (#2599) 2023-07-13 17:37:20 +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
Thomas Devoogdt c5542a6ae8 Fix Branch.bypass_pull_request_allowances failing with "nil is not an object" (#2535)
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
2023-06-30 11:58:40 +02:00
Kevin Grandjean f82ad61c37 Fix broken urls in docstrings (#2393) 2023-06-01 10:36:31 +02:00
Juan Manuel "Kang" PérezandJuan Manuel Kang Perez e296dbdbad Add missing attributes to Branch (#2512)
Co-authored-by: Juan Manuel "Kang" Perez <devel@kangmak.es>
2023-05-09 12:06:35 +02: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 290b62726f Switch all string addition to using f-strings (#1774)
Now that we no longer support Python 3.5, stop using string addition
everywhere it makes sense, and move to the best feature 3.6+ gives us,
f-strings!
2021-03-03 14:50:57 +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 07e29fe014 Format with new black (#1679)
Black is very opinionated, but sometimes those opinions change. Run the
new black version across the codebase, and lock down the version used by
pre-commit so we don't get surprised like this again.
2020-09-02 14:59:09 +10:00
Steve Kowalik 61b610926a Remove unneeded duplicate string checks in Branch (#1524)
There were multiple calls checking if an element of a list was a string
or a string -- I suspect this pre-dates use of six in the code base, but
let's clean it up.
2020-05-20 12:37:52 +10: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 540a085001 Fix isort - add known first and third party 2019-12-11 00:54:59 +08:00
Wan Liuyang 6ceb9e9a15 Apply black to whole codebase (#1303) 2019-12-10 17:14:33 +08:00
Steve KowalikandJonas Maurus 3e3d8c54ab Fix Branch's push restriction API (#1290)
The current API for changing user and teams push restrictions is
brittle, and flat out incorrect when it comes to adding members. Break
the API, but replace it with one that is correct.

Co-Authored-By: Jonas Maurus <jonas-github@maurus.net>
2019-11-22 20:49:58 +11: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
Alice GIRARD 8ee75a282b Added support for required signatures on protected branches (#939)
Wraps the parts of the branch protection API that allows the user to require signed commits on a branch.
New methods are :
* Branch.get_required_signatures : returns true if signed commits are required
* Branch.add_required_signatures : adds the requirements for signed commits on a branch
* Branch.remove_required_signatures : removes the requirement for signed commits on a branch

It uses the API provided on this page : https://developer.github.com/v3/repos/branches/

Since this feature is in [preview](https://developer.github.com/changes/2018-02-22-protected-branches-required-signatures/) I pass the 'Accept application/vnd.github.zzzax-preview+json' header to each request.
2018-10-22 14:37:47 +08:00
Steve Kowalik ef16702a0d Add support for required approving review count (#888)
The GitHub API currently has a beta extension to the Branch Protection
API that allows inspection and setting of the number of required
approving reviews required for a PR to be merged. Add support for it.
2018-08-28 13:34:34 +08:00
Steve Kowalik 08fa797f1d Improve Branch Protection function docstrings (#887)
The docstrings for the edit methods for portions of Branch Protection
did not document their arguments and types, add them.
2018-08-28 13:12:33 +08:00
Wan Liuyang 3f0caa4057 Sync copyright header 2018-08-19 10:47:41 +08:00
Steve Kowalik 171cc567ae Update Branch Protection to current GitHub API
The Branch protection API has been radically changed by GitHub, add new
methods to Branch reflecting it. Branch protection methods are now
called on the Branch object itself, rather than awkwardly hanging off
the Repository object and requiring branch names to be passed in.

This adds an over-arching methods to get, edit and remove protection
entirely, as well as fine-grained methods for getting, setting and
dropping certain aspects of branch protection, as well as three new
objects to encompass querying those aspects.

This also destroys Repository.protect_branch(), the endpoint has been
removed. The old-style protection attributes on Branch have also been
removed to force users onto the new API, since they are still sent, but
no longer populated.

Fixes #586
2018-08-15 12:45:47 +10: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 a32a17bf81 Fix broken Github reference link in class docstrings 2018-03-13 15:07:07 +08: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
Kyle Hornberg 737f0c3ebe Add branch protection endpoint 2016-01-07 08:13:20 -06: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 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 5c475c7683 First review of #192 (pep8, headers... nothing important)
./manage.sh check
./manage.sh fix_headers
2013-08-22 10:12:38 +02:00
AKFish 912bec79d2 Update copyright information 2013-08-21 17:45:01 +08:00
AKFish ed32e78da1 Update Commit.py and GitCommit.py 2013-08-21 15:26:05 +08:00
AKFish 6943f6da7f Update Branch.py 2013-08-21 13:10:32 +08:00
AKFish 0bc138b490 Change NonCompletableGithubObject without breaking build. 2013-08-21 12:32:41 +08:00
Vincent Jacques 06a3d87098 Change source file header format 2013-07-13 19:03:53 +02:00
Vincent Jacques d0002b7a3c Fix pep8 and copyrights 2013-06-18 22:35:46 +02:00
martinqt 7a643e9fef Update branch (with anchor) 2013-06-01 13:31:37 +02:00
Vincent Jacques db5560bd65 Add a script to check copyrights with git log. And fix copyrights. 2013-03-29 16:54:15 +01:00
Vincent Jacques fa43e95268 Refactor XxxGithubObject 2013-03-14 12:31:36 +01:00
Vincent Jacques 7a415fda66 Change home page 2013-02-16 21:19:49 +01:00
Vincent Jacques abf0867543 Generate some repetitive doc files 2012-12-29 08:47:23 +01:00
Vincent Jacques 9a03610f7b Use absolute imports. May help with Python 3 2012-11-21 20:13:12 +01:00
Zearin 4c6a70c24a Add encoding comment to source files
This is a minor thing.  It’s a convention, not a rule (obviously)—but it’s also a best practice.

Many text editors look for this kind of comment as the first line—or second line, if there is a shebang (the `#!/usr/bin/env python`, or whatever else)—and make use of this to determine the file’s encoding.
2012-11-01 11:43:56 -04:00
Vincent Jacques 531c3f2d32 Improve comformance to pep8 (+dos2unix)
PyGithub is now a public projects with several public contibutors,
I have to abandon my very personal coding conventions.
2012-09-17 20:37:22 +02:00