mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 03:41:08 +00:00
Merge branch 'topic/MoveGithubObjects' into develop
This commit is contained in:
+19
-19
@@ -549,16 +549,6 @@ Attributes
|
||||
* `owned_private_repos`
|
||||
* `private_gists`
|
||||
|
||||
Events
|
||||
------
|
||||
* `get_events()`: list of `Event`
|
||||
* `get_public_events()`: list of `Event`
|
||||
|
||||
Received events
|
||||
---------------
|
||||
* `get_received_events()`: list of `Event`
|
||||
* `get_public_received_events()`: list of `Event`
|
||||
|
||||
Followers
|
||||
---------
|
||||
* `get_followers()`: list of `NamedUser`
|
||||
@@ -571,6 +561,16 @@ Orgs
|
||||
----
|
||||
* `get_orgs()`: list of `Organization`
|
||||
|
||||
Events
|
||||
------
|
||||
* `get_events()`: list of `Event`
|
||||
* `get_public_events()`: list of `Event`
|
||||
|
||||
Received events
|
||||
---------------
|
||||
* `get_received_events()`: list of `Event`
|
||||
* `get_public_received_events()`: list of `Event`
|
||||
|
||||
Repos
|
||||
-----
|
||||
* `get_repos( [type] )`: list of `Repository`
|
||||
@@ -636,10 +636,6 @@ Members
|
||||
* `has_in_members( member )`: bool
|
||||
* `member`: `NamedUser`
|
||||
|
||||
Events
|
||||
------
|
||||
* `get_events()`: list of `Event`
|
||||
|
||||
Repos
|
||||
-----
|
||||
* `get_repos( [type] )`: list of `Repository`
|
||||
@@ -655,6 +651,10 @@ Teams
|
||||
* `get_teams()`: list of `Team`
|
||||
* `create_team( name, [repo_names, permission] )`: `Team`
|
||||
|
||||
Events
|
||||
------
|
||||
* `get_events()`: list of `Event`
|
||||
|
||||
Class `PullRequest`
|
||||
===================
|
||||
|
||||
@@ -782,11 +782,6 @@ Attributes
|
||||
* `parent`: `Repository`
|
||||
* `source`: `Repository`
|
||||
|
||||
Events
|
||||
------
|
||||
* `get_events()`: list of `Event`
|
||||
* `get_network_events()`: list of `Event`
|
||||
|
||||
Issues events
|
||||
-------------
|
||||
* `get_issues_events()`: list of `IssueEvent`
|
||||
@@ -912,6 +907,11 @@ Teams
|
||||
-----
|
||||
* `get_teams()`: list of `Team`
|
||||
|
||||
Events
|
||||
------
|
||||
* `get_events()`: list of `Event`
|
||||
* `get_network_events()`: list of `Event`
|
||||
|
||||
Class `RepositoryKey`
|
||||
=====================
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
from GithubObject import *
|
||||
|
||||
Event = GithubObject(
|
||||
"Event",
|
||||
InternalSimpleAttributes(
|
||||
"type", "public", "payload", "created_at", "id", "commit_id", "url",
|
||||
"event", "issue",
|
||||
),
|
||||
)
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/bin/env python
|
||||
|
||||
import GithubObject
|
||||
import GithubObjects
|
||||
|
||||
def generateDocumentation():
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
from GithubObject import *
|
||||
|
||||
from Event import Event
|
||||
from Hook import Hook
|
||||
from Authorization import Authorization
|
||||
from UserKey import UserKey
|
||||
from AuthenticatedUser import AuthenticatedUser
|
||||
from NamedUser import NamedUser
|
||||
from Organization import Organization
|
||||
from GitRef import GitRef
|
||||
from GitTree import GitTree
|
||||
from GitCommit import GitCommit
|
||||
from GitBlob import GitBlob
|
||||
from GitTag import GitTag
|
||||
from Label import Label
|
||||
from Milestone import Milestone
|
||||
from IssueComment import IssueComment
|
||||
from IssueEvent import IssueEvent
|
||||
from Issue import Issue
|
||||
from Download import Download
|
||||
from CommitComment import CommitComment
|
||||
from Commit import Commit
|
||||
from Tag import Tag
|
||||
from Branch import Branch
|
||||
from PullRequestFile import PullRequestFile
|
||||
from PullRequestComment import PullRequestComment
|
||||
from PullRequest import PullRequest
|
||||
from RepositoryKey import RepositoryKey
|
||||
from Repository import Repository
|
||||
from Team import Team
|
||||
from GistComment import GistComment
|
||||
from Gist import Gist
|
||||
|
||||
NamedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "orgs", "org", Organization,
|
||||
ListGetable( [], [] )
|
||||
)
|
||||
)
|
||||
|
||||
__repoElementCreatable = ElementCreatable( [ "name" ], [ "description", "homepage", "private", "has_issues", "has_wiki", "has_downloads", "team_id", ] )
|
||||
__repoElementGetable = ElementGetable( [ "name" ], [], { "owner" : lambda user: { "login": user.login } } )
|
||||
__repoListGetable = ListGetable( [], [ "type" ] )
|
||||
AuthenticatedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "repos", "repo", Repository,
|
||||
__repoListGetable,
|
||||
__repoElementGetable,
|
||||
__repoElementCreatable
|
||||
)
|
||||
)
|
||||
NamedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "repos", "repo", Repository,
|
||||
__repoListGetable,
|
||||
__repoElementGetable
|
||||
)
|
||||
)
|
||||
Organization._addAttributePolicy(
|
||||
ExternalListOfObjects( "repos", "repo", Repository,
|
||||
__repoListGetable,
|
||||
__repoElementGetable,
|
||||
__repoElementCreatable
|
||||
)
|
||||
)
|
||||
|
||||
AuthenticatedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "watched", "watched", Repository,
|
||||
ListGetable( [], [] ),
|
||||
ElementAddable(),
|
||||
ElementRemovable(),
|
||||
ElementHasable()
|
||||
)
|
||||
)
|
||||
NamedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "watched", "watched", Repository,
|
||||
ListGetable( [], [] )
|
||||
)
|
||||
)
|
||||
|
||||
def __createForkForUser( user, repo ):
|
||||
assert isinstance( repo, Repository )
|
||||
return Repository( user._github, user._github._dataRequest( "POST", repo._baseUrl() + "/forks", None, None ), lazy = True )
|
||||
AuthenticatedUser._addAttributePolicy( SeveralAttributePolicies( [ MethodFromCallable( "create_fork", [ "repo" ], [], __createForkForUser, ObjectTypePolicy( Repository ) ) ], "Forking" ) )
|
||||
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" ] )
|
||||
)
|
||||
)
|
||||
Repository._addAttributePolicy(
|
||||
ExternalListOfObjects( "teams", "team", Team,
|
||||
ListGetable( [], [] )
|
||||
)
|
||||
)
|
||||
|
||||
NamedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "gists", "gist", Gist,
|
||||
ListGetable( [], [] ),
|
||||
)
|
||||
)
|
||||
|
||||
AuthenticatedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "gists", "gist", Gist,
|
||||
ListGetable( [], [] ),
|
||||
ElementCreatable( [ "public", "files", ], [ "description" ] ),
|
||||
url = "/gists",
|
||||
)
|
||||
)
|
||||
def __getStaredGists( user ):
|
||||
return [
|
||||
Gist( user._github, attributes, lazy = True )
|
||||
for attributes in user._github._dataRequest( "GET", "/gists/starred", None, None )
|
||||
]
|
||||
AuthenticatedUser._addAttributePolicy(
|
||||
MethodFromCallable( "get_starred_gists", [], [], __getStaredGists, SimpleTypePolicy( "list of `Gist`" ) ),
|
||||
)
|
||||
|
||||
Event._addAttributePolicy(
|
||||
InternalObjectAttribute( "repo", Repository ),
|
||||
)
|
||||
Event._addAttributePolicy(
|
||||
InternalObjectAttribute( "actor", NamedUser ),
|
||||
)
|
||||
Event._addAttributePolicy(
|
||||
InternalObjectAttribute( "org", Organization ),
|
||||
)
|
||||
@@ -1,10 +1,10 @@
|
||||
from GithubObject import *
|
||||
|
||||
from Authorization import Authorization
|
||||
from UserKey import UserKey
|
||||
from Event import Event
|
||||
from NamedUser import NamedUser
|
||||
from Organization import Organization
|
||||
from Authorization import *
|
||||
from UserKey import *
|
||||
from Event import *
|
||||
from NamedUser import *
|
||||
from Organization import *
|
||||
from Repository import *
|
||||
from Gist import *
|
||||
|
||||
def __getOrganizationEvents( user, org ):
|
||||
return [
|
||||
@@ -13,6 +13,16 @@ def __getOrganizationEvents( user, org ):
|
||||
in user._github._dataRequest( "GET", "/users/" + user.login + "/events/orgs/" + org.login, None, None )
|
||||
]
|
||||
|
||||
def __createFork( user, repo ):
|
||||
assert isinstance( repo, Repository )
|
||||
return Repository( user._github, user._github._dataRequest( "POST", repo._baseUrl() + "/forks", None, None ), lazy = True )
|
||||
|
||||
def __getStaredGists( user ):
|
||||
return [
|
||||
Gist( user._github, attributes, lazy = True )
|
||||
for attributes in user._github._dataRequest( "GET", "/gists/starred", None, None )
|
||||
]
|
||||
|
||||
AuthenticatedUser = GithubObject(
|
||||
"AuthenticatedUser",
|
||||
BaseUrl( lambda obj: "/user" ),
|
||||
@@ -58,4 +68,22 @@ AuthenticatedUser = GithubObject(
|
||||
ListGetable( [], [] )
|
||||
),
|
||||
MethodFromCallable( "get_organization_events", [ "org" ], [], __getOrganizationEvents, SimpleTypePolicy( "list of `Event`" ) ),
|
||||
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", ] )
|
||||
),
|
||||
ExternalListOfObjects( "watched", "watched", Repository,
|
||||
ListGetable( [], [] ),
|
||||
ElementAddable(),
|
||||
ElementRemovable(),
|
||||
ElementHasable()
|
||||
),
|
||||
SeveralAttributePolicies( [ MethodFromCallable( "create_fork", [ "repo" ], [], __createFork, ObjectTypePolicy( Repository ) ) ], "Forking" ),
|
||||
ExternalListOfObjects( "gists", "gist", Gist,
|
||||
ListGetable( [], [] ),
|
||||
ElementCreatable( [ "public", "files", ], [ "description" ] ),
|
||||
url = "/gists",
|
||||
),
|
||||
MethodFromCallable( "get_starred_gists", [], [], __getStaredGists, SimpleTypePolicy( "list of `Gist`" ) ),
|
||||
)
|
||||
@@ -1,6 +1,4 @@
|
||||
from GithubObject import *
|
||||
|
||||
from Commit import Commit
|
||||
from Commit import *
|
||||
|
||||
Branch = GithubObject(
|
||||
"Branch",
|
||||
@@ -1,8 +1,6 @@
|
||||
from GithubObject import *
|
||||
|
||||
from GitCommit import GitCommit
|
||||
from NamedUser import NamedUser
|
||||
from CommitComment import CommitComment
|
||||
from GitCommit import *
|
||||
from NamedUser import *
|
||||
from CommitComment import *
|
||||
|
||||
__modifyAttributesForObjectsReferingReferedRepo = { "_repo": lambda obj: obj._repo }
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
from GithubObject import *
|
||||
|
||||
from NamedUser import NamedUser
|
||||
from NamedUser import *
|
||||
|
||||
CommitComment = GithubObject(
|
||||
"CommitComment",
|
||||
@@ -0,0 +1,14 @@
|
||||
from Repository import *
|
||||
from NamedUser import *
|
||||
from Organization import *
|
||||
|
||||
Event = GithubObject(
|
||||
"Event",
|
||||
InternalSimpleAttributes(
|
||||
"type", "public", "payload", "created_at", "id", "commit_id", "url",
|
||||
"event", "issue",
|
||||
),
|
||||
InternalObjectAttribute( "repo", Repository ),
|
||||
InternalObjectAttribute( "actor", NamedUser ),
|
||||
InternalObjectAttribute( "org", Organization ),
|
||||
)
|
||||
@@ -1,7 +1,5 @@
|
||||
from GithubObject import *
|
||||
|
||||
from NamedUser import NamedUser
|
||||
from GistComment import GistComment
|
||||
from NamedUser import *
|
||||
from GistComment import *
|
||||
|
||||
def __isStarred( gist ):
|
||||
return gist._github._statusRequest( "GET", gist._baseUrl() + "/star", None, None ) == 204
|
||||
@@ -1,6 +1,4 @@
|
||||
from GithubObject import *
|
||||
|
||||
from NamedUser import NamedUser
|
||||
from NamedUser import *
|
||||
|
||||
GistComment = GithubObject(
|
||||
"GistComment",
|
||||
@@ -1,6 +1,4 @@
|
||||
from GithubObject import *
|
||||
|
||||
from GitTree import GitTree
|
||||
from GitTree import *
|
||||
|
||||
GitCommit = GithubObject(
|
||||
"GitCommit",
|
||||
@@ -1,9 +1,9 @@
|
||||
import itertools
|
||||
|
||||
from ObjectCapacities.ArgumentsChecker import *
|
||||
from ObjectCapacities.Basic import *
|
||||
from ObjectCapacities.List import *
|
||||
from ObjectCapacities.TypePolicies import *
|
||||
from ArgumentsChecker import *
|
||||
from Basic import *
|
||||
from List import *
|
||||
from TypePolicies import *
|
||||
|
||||
class BadGithubObjectException( Exception ):
|
||||
pass
|
||||
@@ -0,0 +1 @@
|
||||
from GithubObject import *
|
||||
@@ -1,10 +1,8 @@
|
||||
from GithubObject import *
|
||||
|
||||
from NamedUser import NamedUser
|
||||
from Milestone import Milestone
|
||||
from Label import Label
|
||||
from IssueComment import IssueComment
|
||||
from IssueEvent import IssueEvent
|
||||
from NamedUser import *
|
||||
from Milestone import *
|
||||
from Label import *
|
||||
from IssueComment import *
|
||||
from IssueEvent import *
|
||||
|
||||
__modifyAttributesForObjectsReferingReferedRepo = { "_repo": lambda obj: obj._repo }
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
from GithubObject import *
|
||||
|
||||
from NamedUser import NamedUser
|
||||
from NamedUser import *
|
||||
|
||||
IssueComment = GithubObject(
|
||||
"IssueComment",
|
||||
@@ -1,6 +1,4 @@
|
||||
from GithubObject import *
|
||||
|
||||
from NamedUser import NamedUser
|
||||
from NamedUser import *
|
||||
|
||||
IssueEvent = GithubObject(
|
||||
"IssueEvent",
|
||||
@@ -1,7 +1,5 @@
|
||||
from GithubObject import *
|
||||
|
||||
from NamedUser import NamedUser
|
||||
from Label import Label
|
||||
from NamedUser import *
|
||||
from Label import *
|
||||
|
||||
__modifyAttributesForObjectsReferingReferedRepo = { "_repo": lambda obj: obj._repo }
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
from GithubObject import *
|
||||
|
||||
NamedUser = GithubObject(
|
||||
"NamedUser",
|
||||
BaseUrl( lambda obj: "/users/" + obj.login ),
|
||||
Identity( lambda obj: obj.login ),
|
||||
InternalSimpleAttributes(
|
||||
"login", "id", "avatar_url", "gravatar_id", "url", "name", "company",
|
||||
"blog", "location", "email", "hireable", "bio", "public_repos",
|
||||
"public_gists", "followers", "following", "html_url", "created_at",
|
||||
"type",
|
||||
# Only in Repository.get_contributors()
|
||||
"contributions",
|
||||
# Seen only by user herself
|
||||
"disk_usage", "collaborators", "plan", "total_private_repos",
|
||||
"owned_private_repos", "private_gists",
|
||||
),
|
||||
)
|
||||
|
||||
NamedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "followers", "follower", NamedUser,
|
||||
ListGetable( [], [] )
|
||||
)
|
||||
)
|
||||
|
||||
NamedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "following", "following", NamedUser,
|
||||
ListGetable( [], [] )
|
||||
)
|
||||
)
|
||||
@@ -1,54 +1,65 @@
|
||||
from GithubObject import *
|
||||
|
||||
from Event import Event
|
||||
|
||||
def __getPublicEvents( user ):
|
||||
return [
|
||||
Event( user._github, attributes, lazy = True )
|
||||
for attributes
|
||||
in user._github._dataRequest( "GET", user._baseUrl() + "/events/public", None, None )
|
||||
]
|
||||
|
||||
def __getPublicReceivedEvents( user ):
|
||||
return [
|
||||
Event( user._github, attributes, lazy = True )
|
||||
for attributes
|
||||
in user._github._dataRequest( "GET", user._baseUrl() + "/received_events/public", None, None )
|
||||
]
|
||||
|
||||
NamedUser = GithubObject(
|
||||
"NamedUser",
|
||||
BaseUrl( lambda obj: "/users/" + obj.login ),
|
||||
Identity( lambda obj: obj.login ),
|
||||
InternalSimpleAttributes(
|
||||
"login", "id", "avatar_url", "gravatar_id", "url", "name", "company",
|
||||
"blog", "location", "email", "hireable", "bio", "public_repos",
|
||||
"public_gists", "followers", "following", "html_url", "created_at",
|
||||
"type",
|
||||
# Only in Repository.get_contributors()
|
||||
"contributions",
|
||||
# Seen only by user herself
|
||||
"disk_usage", "collaborators", "plan", "total_private_repos",
|
||||
"owned_private_repos", "private_gists",
|
||||
),
|
||||
ExternalListOfObjects( "events", "event", Event,
|
||||
ListGetable( [], [] )
|
||||
),
|
||||
MethodFromCallable( "get_public_events", [], [], __getPublicEvents, SimpleTypePolicy( "list of `Event`" ) ),
|
||||
ExternalListOfObjects( "received_events", "received_event", Event,
|
||||
ListGetable( [], [] )
|
||||
),
|
||||
MethodFromCallable( "get_public_received_events", [], [], __getPublicReceivedEvents, SimpleTypePolicy( "list of `Event`" ) ),
|
||||
)
|
||||
|
||||
NamedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "followers", "follower", NamedUser,
|
||||
ListGetable( [], [] )
|
||||
)
|
||||
)
|
||||
|
||||
NamedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "following", "following", NamedUser,
|
||||
ListGetable( [], [] )
|
||||
)
|
||||
)
|
||||
from NamedUser import *
|
||||
|
||||
from Organization import *
|
||||
from Event import *
|
||||
from Repository import *
|
||||
from Gist import *
|
||||
|
||||
NamedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "orgs", "org", Organization,
|
||||
ListGetable( [], [] )
|
||||
)
|
||||
)
|
||||
|
||||
NamedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "events", "event", Event,
|
||||
ListGetable( [], [] )
|
||||
)
|
||||
)
|
||||
|
||||
def __getPublicEvents( user ):
|
||||
return [
|
||||
Event( user._github, attributes, lazy = True )
|
||||
for attributes
|
||||
in user._github._dataRequest( "GET", user._baseUrl() + "/events/public", None, None )
|
||||
]
|
||||
|
||||
NamedUser._addAttributePolicy(
|
||||
MethodFromCallable( "get_public_events", [], [], __getPublicEvents, SimpleTypePolicy( "list of `Event`" ) )
|
||||
)
|
||||
|
||||
NamedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "received_events", "received_event", Event,
|
||||
ListGetable( [], [] )
|
||||
)
|
||||
)
|
||||
|
||||
def __getPublicReceivedEvents( user ):
|
||||
return [
|
||||
Event( user._github, attributes, lazy = True )
|
||||
for attributes
|
||||
in user._github._dataRequest( "GET", user._baseUrl() + "/received_events/public", None, None )
|
||||
]
|
||||
|
||||
NamedUser._addAttributePolicy(
|
||||
MethodFromCallable( "get_public_received_events", [], [], __getPublicReceivedEvents, SimpleTypePolicy( "list of `Event`" ) )
|
||||
)
|
||||
|
||||
NamedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "repos", "repo", Repository,
|
||||
ListGetable( [], [ "type" ] ),
|
||||
ElementGetable( [ "name" ], [], { "owner" : lambda user: { "login": user.login } } )
|
||||
)
|
||||
)
|
||||
|
||||
NamedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "watched", "watched", Repository,
|
||||
ListGetable( [], [] )
|
||||
)
|
||||
)
|
||||
|
||||
NamedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "gists", "gist", Gist,
|
||||
ListGetable( [], [] ),
|
||||
)
|
||||
)
|
||||
@@ -1,7 +1,4 @@
|
||||
from GithubObject import *
|
||||
|
||||
from NamedUser import NamedUser
|
||||
from Event import Event
|
||||
from NamedUser import *
|
||||
|
||||
Organization = GithubObject(
|
||||
"Organization",
|
||||
@@ -27,7 +24,4 @@ Organization = GithubObject(
|
||||
ElementRemovable(),
|
||||
ElementHasable()
|
||||
),
|
||||
ExternalListOfObjects( "events", "event", Event,
|
||||
ListGetable( [], [] )
|
||||
),
|
||||
)
|
||||
@@ -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( [], [] )
|
||||
),
|
||||
)
|
||||
@@ -1,9 +1,7 @@
|
||||
from GithubObject import *
|
||||
|
||||
from NamedUser import NamedUser
|
||||
from Commit import Commit
|
||||
from PullRequestFile import PullRequestFile
|
||||
from PullRequestComment import PullRequestComment
|
||||
from NamedUser import *
|
||||
from Commit import *
|
||||
from PullRequestFile import *
|
||||
from PullRequestComment import *
|
||||
|
||||
__modifyAttributesForObjectsReferingReferedRepo = { "_repo": lambda obj: obj._repo }
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
from GithubObject import *
|
||||
|
||||
from NamedUser import NamedUser
|
||||
from NamedUser import *
|
||||
|
||||
PullRequestComment = GithubObject(
|
||||
"PullRequestComment",
|
||||
@@ -1,24 +1,21 @@
|
||||
from GithubObject import *
|
||||
|
||||
from NamedUser import NamedUser
|
||||
from Event import Event
|
||||
from IssueEvent import IssueEvent
|
||||
from RepositoryKey import RepositoryKey
|
||||
from Hook import Hook
|
||||
from GitBlob import GitBlob
|
||||
from GitCommit import GitCommit
|
||||
from GitRef import GitRef
|
||||
from GitTag import GitTag
|
||||
from GitTree import GitTree
|
||||
from Label import Label
|
||||
from Milestone import Milestone
|
||||
from Issue import Issue
|
||||
from Download import Download
|
||||
from CommitComment import CommitComment
|
||||
from Commit import Commit
|
||||
from Tag import Tag
|
||||
from Branch import Branch
|
||||
from PullRequest import PullRequest
|
||||
from NamedUser import *
|
||||
from IssueEvent import *
|
||||
from RepositoryKey import *
|
||||
from Hook import *
|
||||
from GitBlob import *
|
||||
from GitCommit import *
|
||||
from GitRef import *
|
||||
from GitTag import *
|
||||
from GitTree import *
|
||||
from Label import *
|
||||
from Milestone import *
|
||||
from Issue import *
|
||||
from Download import *
|
||||
from CommitComment import *
|
||||
from Commit import *
|
||||
from Tag import *
|
||||
from Branch import *
|
||||
from PullRequest import *
|
||||
|
||||
__modifyAttributesForObjectsReferingRepo = { "_repo": lambda repo: repo }
|
||||
|
||||
@@ -39,20 +36,6 @@ Repository = GithubObject(
|
||||
)
|
||||
Repository._addAttributePolicy( InternalObjectAttribute( "parent", Repository ) )
|
||||
Repository._addAttributePolicy( InternalObjectAttribute( "source", Repository ) )
|
||||
Repository._addAttributePolicy(
|
||||
ExternalListOfObjects( "events", "event", Event,
|
||||
ListGetable( [], [] )
|
||||
),
|
||||
)
|
||||
def __getNetworkEvents( repo ):
|
||||
return [
|
||||
Event( repo._github, attributes, lazy = True )
|
||||
for attributes
|
||||
in repo._github._dataRequest( "GET", "/networks/" + repo.owner.login + "/" + repo.name + "/events", None, None )
|
||||
]
|
||||
Repository._addAttributePolicy(
|
||||
MethodFromCallable( "get_network_events", [], [], __getNetworkEvents, SimpleTypePolicy( "list of `Event`" ) )
|
||||
)
|
||||
Repository._addAttributePolicy(
|
||||
ExternalListOfObjects( "issues/events", "issues_event", IssueEvent,
|
||||
ListGetable( [], [], __modifyAttributesForObjectsReferingRepo ),
|
||||
@@ -0,0 +1,27 @@
|
||||
from Repository import *
|
||||
|
||||
from Team import *
|
||||
from Event import *
|
||||
|
||||
Repository._addAttributePolicy(
|
||||
ExternalListOfObjects( "teams", "team", Team,
|
||||
ListGetable( [], [] )
|
||||
)
|
||||
)
|
||||
|
||||
Repository._addAttributePolicy(
|
||||
ExternalListOfObjects( "events", "event", Event,
|
||||
ListGetable( [], [] )
|
||||
),
|
||||
)
|
||||
|
||||
def __getNetworkEvents( repo ):
|
||||
return [
|
||||
Event( repo._github, attributes, lazy = True )
|
||||
for attributes
|
||||
in repo._github._dataRequest( "GET", "/networks/" + repo.owner.login + "/" + repo.name + "/events", None, None )
|
||||
]
|
||||
|
||||
Repository._addAttributePolicy(
|
||||
MethodFromCallable( "get_network_events", [], [], __getNetworkEvents, SimpleTypePolicy( "list of `Event`" ) )
|
||||
)
|
||||
@@ -1,6 +1,4 @@
|
||||
from GithubObject import *
|
||||
|
||||
from Commit import Commit
|
||||
from Commit import *
|
||||
|
||||
Tag = GithubObject(
|
||||
"Tag",
|
||||
@@ -1,7 +1,5 @@
|
||||
from GithubObject import *
|
||||
|
||||
from NamedUser import NamedUser
|
||||
from Repository import Repository
|
||||
from NamedUser import *
|
||||
from Repository import *
|
||||
|
||||
Team = GithubObject(
|
||||
"Team",
|
||||
@@ -0,0 +1,13 @@
|
||||
from AuthenticatedUser import *
|
||||
|
||||
# This strange import pattern works around cyclic dependencies
|
||||
from NamedUser import *
|
||||
from NamedUser_complete import *
|
||||
|
||||
from Organization import *
|
||||
from Organization_complete import *
|
||||
|
||||
from Repository import *
|
||||
from Repository_complete import *
|
||||
|
||||
from Gist import *
|
||||
Reference in New Issue
Block a user