Skip to content

Commit

Permalink
Merge branch 'topic/MoveGithubObjects' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquev6 committed Mar 14, 2012
2 parents 50ac55b + 6e421e9 commit 0909fec
Show file tree
Hide file tree
Showing 46 changed files with 287 additions and 319 deletions.
38 changes: 19 additions & 19 deletions ReferenceOfClasses.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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`
Expand Down Expand Up @@ -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`
Expand All @@ -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`
===================

Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -912,6 +907,11 @@ Teams
-----
* `get_teams()`: list of `Team`

Events
------
* `get_events()`: list of `Event`
* `get_network_events()`: list of `Event`

Class `RepositoryKey`
=====================

Expand Down
9 changes: 0 additions & 9 deletions github/Event.py

This file was deleted.

1 change: 0 additions & 1 deletion github/GenerateDocumentation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/env python

import GithubObject
import GithubObjects

def generateDocumentation():
Expand Down
129 changes: 0 additions & 129 deletions github/GithubObjects.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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 [
Expand All @@ -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" ),
Expand Down Expand Up @@ -58,4 +68,22 @@ def __getOrganizationEvents( user, org ):
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`" ) ),
)
File renamed without changes.
4 changes: 1 addition & 3 deletions github/Branch.py → github/GithubObjects/Branch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from GithubObject import *

from Commit import Commit
from Commit import *

Branch = GithubObject(
"Branch",
Expand Down
8 changes: 3 additions & 5 deletions github/Commit.py → github/GithubObjects/Commit.py
Original file line number Diff line number Diff line change
@@ -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 }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from GithubObject import *

from NamedUser import NamedUser
from NamedUser import *

CommitComment = GithubObject(
"CommitComment",
Expand Down
File renamed without changes.
14 changes: 14 additions & 0 deletions github/GithubObjects/Event.py
Original file line number Diff line number Diff line change
@@ -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 ),
)
6 changes: 2 additions & 4 deletions github/Gist.py → github/GithubObjects/Gist.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from GithubObject import *

from NamedUser import NamedUser
from NamedUser import *

GistComment = GithubObject(
"GistComment",
Expand Down
File renamed without changes.
4 changes: 1 addition & 3 deletions github/GitCommit.py → github/GithubObjects/GitCommit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from GithubObject import *

from GitTree import GitTree
from GitTree import *

GitCommit = GithubObject(
"GitCommit",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions github/GithubObjects/GithubObject/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from GithubObject import *
File renamed without changes.
12 changes: 5 additions & 7 deletions github/Issue.py → github/GithubObjects/Issue.py
Original file line number Diff line number Diff line change
@@ -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 }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from GithubObject import *

from NamedUser import NamedUser
from NamedUser import *

IssueComment = GithubObject(
"IssueComment",
Expand Down
Loading

0 comments on commit 0909fec

Please sign in to comment.