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

Commit1898e00

Browse files
committed
Merge remote-tracking branch 'github/pr/48' into develop
2 parents45d15b8 +94f044a commit1898e00

File tree

1 file changed

+44
-24
lines changed

1 file changed

+44
-24
lines changed

‎github3/repos.py

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -670,35 +670,55 @@ def download(self, id_num):
670670
@requires_auth
671671
defedit(self,
672672
name,
673-
description='',
674-
homepage='',
675-
private=False,
676-
has_issues=True,
677-
has_wiki=True,
678-
has_downloads=True,
679-
default_branch=''):
673+
description=None,
674+
homepage=None,
675+
private=None,
676+
has_issues=None,
677+
has_wiki=None,
678+
has_downloads=None,
679+
default_branch=None):
680680
"""Edit this repository.
681681
682682
:param str name: (required), name of the repository
683-
:param str description: (optional)
684-
:param str homepage: (optional)
685-
:param bool private: (optional), If ``True``, create a
686-
private repository. API default: ``False``
687-
:param bool has_issues: (optional), If ``True``, enable
688-
issues for this repository. API default: ``True``
689-
:param bool has_wiki: (optional), If ``True``, enable the
690-
wiki for this repository. API default: ``True``
691-
:param bool has_downloads: (optional), If ``True``, enable
692-
downloads for this repository. API default: ``True``
693-
:param str default_branch: (optional), Update the default branch for
694-
this repository
683+
:param str description: (optional), If not ``None``, change the
684+
description for this repository. API default: ``None`` - leave
685+
value unchanged.
686+
:param str homepage: (optional), If not ``None``, change the homepage
687+
for this repository. API default: ``None`` - leave value unchanged.
688+
:param bool private: (optional), If ``True``, make the repository
689+
private. If ``False``, make the repository public. API default:
690+
``None`` - leave value unchanged.
691+
:param bool has_issues: (optional), If ``True``, enable issues for
692+
this repository. If ``False``, disable issues for this repository.
693+
API default: ``None`` - leave value unchanged.
694+
:param bool has_wiki: (optional), If ``True``, enable the wiki for
695+
this repository. If ``False``, disable the wiki for this
696+
repository. API default: ``None`` - leave value unchanged.
697+
:param bool has_downloads: (optional), If ``True``, enable downloads
698+
for this repository. If ``False``, disable downloads for this
699+
repository. API default: ``None`` - leave value unchanged.
700+
:param str default_branch: (optional), If not ``None``, change the
701+
default branch for this repository. API default: ``None`` - leave
702+
value unchanged.
695703
:returns: bool -- True if successful, False otherwise
696704
"""
697-
data=dumps({'name':name,'description':description,
698-
'homepage':homepage,'private':private,
699-
'has_issues':has_issues,'has_wiki':has_wiki,
700-
'has_downloads':has_downloads,
701-
'default_branch':default_branch})
705+
edit= {'name':name}
706+
ifdescriptionisnotNone:
707+
edit['description']=description
708+
ifhomepageisnotNone:
709+
edit['homepage']=homepage
710+
ifprivateisnotNone:
711+
edit['private']=private
712+
ifhas_issuesisnotNone:
713+
edit['has_issues']=has_issues
714+
ifhas_wikiisnotNone:
715+
edit['has_wiki']=has_wiki
716+
ifhas_downloadsisnotNone:
717+
edit['has_downloads']=has_downloads
718+
ifdefault_branchisnotNone:
719+
edit['default_branch']=default_branch
720+
721+
data=dumps(edit)
702722
json=self._json(self._patch(self._api,data=data),200)
703723
ifjson:
704724
self._update_(json)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp