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

Commite8ff4f4

Browse files
Merge pull requestsigmavirus24#620 from sigmavirus24/bug/619
Create the StarredRepository object
2 parents338e65d +928dbf8 commite8ff4f4

File tree

5 files changed

+33
-5
lines changed

5 files changed

+33
-5
lines changed

‎docs/repos.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Repository
66
This part of the documentation covers:
77

88
-:class:`Repository <github3.repos.repo.Repository>`
9+
-:class:`StarredRepository <github3.repos.repo.StarredRepository>`
910
-:class:`Asset <github3.repos.release.Asset>`
1011
-:class:`Branch <github3.repos.branch.Branch>`
1112
-:class:`Contents <github3.repos.contents.Contents>`
@@ -45,6 +46,11 @@ Repository Objects
4546

4647
---------
4748

49+
..autoclass::github3.repos.repo.StarredRepository
50+
:inherited-members:
51+
52+
---------
53+
4854
..module::github3.repos.branch
4955

5056
..autoclass::github3.repos.branch.Branch

‎github3/repos/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
"""
99

1010
from .repoimportRepository
11+
from .repoimportStarredRepository
1112

12-
__all__=[Repository]
13+
__all__=('Repository','StarredRepository')

‎github3/repos/repo.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,6 +1984,27 @@ def weekly_commit_count(self):
19841984
returnjson
19851985

19861986

1987+
classStarredRepository(GitHubCore):
1988+
1989+
"""The :class:`~github3.repos.repo.StarredRepository` object.
1990+
1991+
It represents how GitHub sends back a repository a user has starred, e.g.,
1992+
from :meth:`~github3.users.User.starred_repositories`.
1993+
1994+
See also:
1995+
https://developer.github.com/v3/activity/starring/#list-repositories-being-starred
1996+
1997+
"""
1998+
1999+
def_update_attributes(self,starred_repository):
2000+
self.starred_at=self._strptime(starred_repository.get('starred_at'))
2001+
self.repository=Repository(starred_repository.get('repo'),self)
2002+
self.repo=self.repository
2003+
2004+
def_repr(self):
2005+
return'<StarredRepository [{0!r}]>'.format(self.repository)
2006+
2007+
19872008
defrepo_issue_params(milestone=None,
19882009
state=None,
19892010
assignee=None,

‎github3/users.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,14 +360,14 @@ def starred_repositories(self, sort=None, direction=None, number=-1,
360360
'desc'
361361
:param str etag: (optional), ETag from a previous request to the same
362362
endpoint
363-
:returns: generator of :class:`Repository <github3.repos.Repository>`
363+
:returns: generator of :class:`~github3.repos.repo.StarredRepository`
364364
"""
365-
from .reposimportRepository
365+
from .reposimportRepository,StarredRepository
366366

367367
params= {'sort':sort,'direction':direction}
368368
self._remove_none(params)
369369
url=self.starred_urlt.expand(owner=None,repo=None)
370-
returnself._iter(int(number),url,Repository,params,etag,
370+
returnself._iter(int(number),url,StarredRepository,params,etag,
371371
headers=Repository.STAR_HEADERS)
372372

373373
defsubscriptions(self,number=-1,etag=None):

‎tests/integration/test_users.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def test_starred_repositories(self):
140140

141141
assertlen(repos)>0
142142
forstarredinrepos:
143-
assertisinstance(starred,github3.repos.Repository)
143+
assertisinstance(starred,github3.repos.StarredRepository)
144144
assertisinstance(starred.starred_at,datetime.datetime)
145145

146146
deftest_subscriptions(self):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp