Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jun 4, 2019. It is now read-only.
/github3.pyPublic archive
forked fromdegustaf/github3.py

Commit1b7ea5a

Browse files
committed
Update Branch.protect such that its arguments are optional.
1 parent4bd0237 commit1b7ea5a

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

‎github3/repos/branch.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,24 @@ def _update_attributes(self, branch):
3232
def_repr(self):
3333
return'<Repository Branch [{0}]>'.format(self.name)
3434

35-
defprotect(self,enforcement,status_checks):
35+
defprotect(self,enforcement=None,status_checks=None):
3636
"""Enable force push protection and configure status check enforcement.
3737
3838
See: http://git.io/v4Gvu
3939
40-
:param str enforcement: (required), Specifies the enforcement level of
40+
:param str enforcement: (optional), Specifies the enforcement level of
4141
the status checks. Must be one of 'off', 'non_admins', or
42-
'everyone'.
43-
:param list status_checks: (required), An iterable of strings naming
44-
status checks that must pass before merging.
42+
'everyone'. Use `None` or omit to use the already associated value.
43+
:param list status_checks: (optional), An list of strings naming
44+
status checks that must pass before merging. Use `None` or omit to
45+
use the already associated value.
4546
"""
47+
previous_values=self.protection['required_status_checks']
48+
ifenforcementisNone:
49+
enforcement=previous_values['enforcement_level']
50+
ifstatus_checksisNone:
51+
status_checks=previous_values['contexts']
52+
4653
edit= {'protection': {'enabled':True,'required_status_checks': {
4754
'enforcement_level':enforcement,'contexts':status_checks}}}
4855
json=self._json(self._patch(self.links['self'],data=dumps(edit),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp