From 378558f6cac6183b4a7100c0ce5eaad1cfff6717 Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Tue, 13 Mar 2012 19:14:56 +0100 Subject: [PATCH] Spliting GithubObjects.py --- github/Event.py | 9 +++++++++ github/GithubObjects.py | 25 ++----------------------- github/Hook.py | 16 ++++++++++++++++ 3 files changed, 27 insertions(+), 23 deletions(-) create mode 100644 github/Event.py create mode 100644 github/Hook.py diff --git a/github/Event.py b/github/Event.py new file mode 100644 index 00000000..ba568058 --- /dev/null +++ b/github/Event.py @@ -0,0 +1,9 @@ +from GithubObject import * + +Event = GithubObject( + "Event", + InternalSimpleAttributes( + "type", "public", "payload", "created_at", "id", "commit_id", "url", + "event", "issue", + ), +) diff --git a/github/GithubObjects.py b/github/GithubObjects.py index a5dff5b8..dca59b9d 100644 --- a/github/GithubObjects.py +++ b/github/GithubObjects.py @@ -1,30 +1,9 @@ -import itertools import urllib from GithubObject import * -Event = GithubObject( - "Event", - InternalSimpleAttributes( - "type", "public", "payload", "created_at", "id", "commit_id", "url", - "event", "issue", - ), -) - -def __testHook( hook ): - hook._github._statusRequest( "POST", hook._baseUrl() + "/test", None, None ) -Hook = GithubObject( - "Hook", - BaseUrl( lambda obj: obj._repo._baseUrl() + "/hooks/" + str( obj.id ) ), - InternalSimpleAttributes( - "url", "updated_at", "created_at", "name", "events", "active", "config", - "id", "last_response", - "_repo", - ), - Editable( [ "name", "config" ], [ "events", "add_events", "remove_events", "active" ] ), - Deletable(), - SeveralAttributePolicies( [ MethodFromCallable( "test", [], [], __testHook, SimpleTypePolicy( None ) ) ], "Testing" ) -) +from Event import Event +from Hook import Hook Authorization = GithubObject( "Authorization", diff --git a/github/Hook.py b/github/Hook.py new file mode 100644 index 00000000..07f9660e --- /dev/null +++ b/github/Hook.py @@ -0,0 +1,16 @@ +from GithubObject import * + +def __testHook( hook ): + hook._github._statusRequest( "POST", hook._baseUrl() + "/test", None, None ) +Hook = GithubObject( + "Hook", + BaseUrl( lambda obj: obj._repo._baseUrl() + "/hooks/" + str( obj.id ) ), + InternalSimpleAttributes( + "url", "updated_at", "created_at", "name", "events", "active", "config", + "id", "last_response", + "_repo", + ), + Editable( [ "name", "config" ], [ "events", "add_events", "remove_events", "active" ] ), + Deletable(), + SeveralAttributePolicies( [ MethodFromCallable( "test", [], [], __testHook, SimpleTypePolicy( None ) ) ], "Testing" ) +)