mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 03:41:08 +00:00
Separate the three distributed classes
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
from Organization import *
|
||||
|
||||
from Repository import *
|
||||
from Team import *
|
||||
from Event import *
|
||||
|
||||
Organization._addAttributePolicy(
|
||||
ExternalListOfObjects( "repos", "repo", Repository,
|
||||
ListGetable( [], [ "type" ] ),
|
||||
ElementGetable( [ "name" ], [], { "owner" : lambda user: { "login": user.login } } ),
|
||||
ElementCreatable( [ "name" ], [ "description", "homepage", "private", "has_issues", "has_wiki", "has_downloads", "team_id", ] )
|
||||
)
|
||||
)
|
||||
|
||||
def __createForkForOrg( org, repo ):
|
||||
assert isinstance( repo, Repository )
|
||||
return Repository( org._github, org._github._dataRequest( "POST", repo._baseUrl() + "/forks", { "org": org.login }, None ), lazy = True )
|
||||
|
||||
Organization._addAttributePolicy(
|
||||
SeveralAttributePolicies( [ MethodFromCallable( "create_fork", [ "repo" ], [], __createForkForOrg, ObjectTypePolicy( Repository ) ) ], "Forking" )
|
||||
)
|
||||
|
||||
Organization._addAttributePolicy(
|
||||
ExternalListOfObjects( "teams", "team", Team,
|
||||
ListGetable( [], [] ),
|
||||
ElementCreatable( [ "name" ], [ "repo_names", "permission" ] )
|
||||
)
|
||||
)
|
||||
|
||||
Organization._addAttributePolicy(
|
||||
ExternalListOfObjects( "events", "event", Event,
|
||||
ListGetable( [], [] )
|
||||
),
|
||||
)
|
||||
Reference in New Issue
Block a user