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

Commite65d27b

Browse files
committed
Split out ShortTeam from Team
This also introduces consistency in the orgs module in how we set-upattributes for the *Team and *Organization classes. It also rewrites thedocstrings to be consistent with the rest of the library
1 parentc68d0b3 commite65d27b

File tree

13 files changed

+678
-297
lines changed

13 files changed

+678
-297
lines changed

‎github3/events.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,10 @@ def _release(payload, session):
266266

267267

268268
def_team(payload,session):
269-
from .orgsimportTeam
269+
from .orgsimportShortTeam
270270
from .reposimportShortRepository
271271
ifpayload.get('team'):
272-
payload['team']=Team(payload['team'],session)
272+
payload['team']=ShortTeam(payload['team'],session)
273273
ifpayload.get('repo'):
274274
payload['repo']=ShortRepository(payload['repo'],session)
275275
ifpayload.get('sender'):
@@ -278,6 +278,7 @@ def _team(payload, session):
278278

279279

280280
defidentity(x,session):
281+
"""Return the value."""
281282
returnx
282283

283284

‎github3/github.py‎

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@
1717
from .importgists
1818
from .issuesimportShortIssue,Issue,issue_params
1919
from .modelsimportGitHubCore
20-
from .orgsimportMembership,ShortOrganization,Organization,Team
20+
from .orgsimportMembership,ShortOrganization,Organization
2121
from .projectsimportProject,ProjectCard,ProjectColumn
2222
from .pullsimportPullRequest
2323
from .reposimportrepo
2424
from .searchimport (CodeSearchResult,IssueSearchResult,
2525
RepositorySearchResult,UserSearchResult)
2626
from .structsimportSearchIterator
27+
from .importorgs
2728
from .importusers
2829
from .notificationsimportThread
2930
from .licensesimportLicense
@@ -828,9 +829,22 @@ def me(self):
828829

829830
@requires_auth
830831
defmembership_in(self,organization):
831-
"""Retrieve the user's membership in the specified organization."""
832-
url=self._build_url('user','memberships','orgs',
833-
str(organization))
832+
"""Retrieve the user's membership in the specified organization.
833+
834+
:param organization:
835+
the organization or organization login to retrieve the authorized
836+
user's membership in
837+
:type organization:
838+
str
839+
:type organization:
840+
:class:`~github3.orgs.Organization`
841+
:returns:
842+
the user's membership
843+
:rtype:
844+
:class:`~github3.orgs.Membership`
845+
"""
846+
organization_name=getattr(organization,'login',organization)
847+
url=self._build_url('user','memberships','orgs',organization_name)
834848
json=self._json(self._get(url),200)
835849
returnself._instance_or_null(Membership,json)
836850

@@ -1708,10 +1722,13 @@ def user_teams(self, number=-1, etag=None):
17081722
authenticated user belongs. This method requires user or repo scope
17091723
when authenticating via OAuth.
17101724
1711-
:returns: generator of :class:`Team <github3.orgs.Team>` objects
1725+
:returns:
1726+
generator of teams
1727+
:rtype:
1728+
:class:`~github3.orgs.ShortTeam`
17121729
"""
17131730
url=self._build_url('user','teams')
1714-
returnself._iter(int(number),url,Team,etag=etag)
1731+
returnself._iter(int(number),url,orgs.ShortTeam,etag=etag)
17151732

17161733
defuser_with_id(self,number):
17171734
"""Get the user's information with id ``number``.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp