diff --git a/github/GitBlob.py b/github/GitBlob.py new file mode 100644 index 00000000..607429fa --- /dev/null +++ b/github/GitBlob.py @@ -0,0 +1,11 @@ +from GithubObject import * + +GitBlob = GithubObject( + "GitBlob", + BaseUrl( lambda obj: obj._repo._baseUrl() + "/git/blobs/" + obj.sha ), + InternalSimpleAttributes( + "sha", "size", "url", + "content", "encoding", + "_repo", + ), +) diff --git a/github/GitCommit.py b/github/GitCommit.py new file mode 100644 index 00000000..aebaa599 --- /dev/null +++ b/github/GitCommit.py @@ -0,0 +1,15 @@ +from GithubObject import * + +from GitTree import GitTree + +GitCommit = GithubObject( + "GitCommit", + BaseUrl( lambda obj: obj._repo._baseUrl() + "/git/commits/" + obj.sha ), + InternalSimpleAttributes( + "sha", "url", "message", + "parents", + "author", "committer", + "_repo", + ), + InternalObjectAttribute( "tree", GitTree ), +) diff --git a/github/GitRef.py b/github/GitRef.py new file mode 100644 index 00000000..4ac2d8e8 --- /dev/null +++ b/github/GitRef.py @@ -0,0 +1,12 @@ +from GithubObject import * + +GitRef = GithubObject( + "GitRef", + BaseUrl( lambda obj: obj._repo._baseUrl() + "/git/" + obj.ref ), + InternalSimpleAttributes( + "ref", "url", + "object", + "_repo", + ), + Editable( [ "sha" ], [ "force" ] ), +) diff --git a/github/GitTag.py b/github/GitTag.py new file mode 100644 index 00000000..9248ea61 --- /dev/null +++ b/github/GitTag.py @@ -0,0 +1,13 @@ +from GithubObject import * + +GitTag = GithubObject( + "GitTag", + BaseUrl( lambda obj: obj._repo._baseUrl() + "/git/tags/" + obj.sha ), + InternalSimpleAttributes( + "tag", "sha", "url", + "message", + "tagger", + "object", + "_repo", + ), +) diff --git a/github/GitTree.py b/github/GitTree.py new file mode 100644 index 00000000..a7ac8bd5 --- /dev/null +++ b/github/GitTree.py @@ -0,0 +1,11 @@ +from GithubObject import * + +GitTree = GithubObject( + "GitTree", + BaseUrl( lambda obj: obj._repo._baseUrl() + "/git/trees/" + obj.sha ), + InternalSimpleAttributes( + "sha", "url", + "tree", + "_repo", + ), +) diff --git a/github/GithubObjects.py b/github/GithubObjects.py index 4f434edc..5dafd5d8 100644 --- a/github/GithubObjects.py +++ b/github/GithubObjects.py @@ -16,60 +16,11 @@ NamedUser._addAttributePolicy( ) ) -GitRef = GithubObject( - "GitRef", - BaseUrl( lambda obj: obj._repo._baseUrl() + "/git/" + obj.ref ), - InternalSimpleAttributes( - "ref", "url", - "object", - "_repo", - ), - Editable( [ "sha" ], [ "force" ] ), -) - -GitTree = GithubObject( - "GitTree", - BaseUrl( lambda obj: obj._repo._baseUrl() + "/git/trees/" + obj.sha ), - InternalSimpleAttributes( - "sha", "url", - "tree", - "_repo", - ), -) - -GitCommit = GithubObject( - "GitCommit", - BaseUrl( lambda obj: obj._repo._baseUrl() + "/git/commits/" + obj.sha ), - InternalSimpleAttributes( - "sha", "url", "message", - "parents", - "author", "committer", - "_repo", - ), - InternalObjectAttribute( "tree", GitTree ), -) - -GitBlob = GithubObject( - "GitBlob", - BaseUrl( lambda obj: obj._repo._baseUrl() + "/git/blobs/" + obj.sha ), - InternalSimpleAttributes( - "sha", "size", "url", - "content", "encoding", - "_repo", - ), -) - -GitTag = GithubObject( - "GitTag", - BaseUrl( lambda obj: obj._repo._baseUrl() + "/git/tags/" + obj.sha ), - InternalSimpleAttributes( - "tag", "sha", "url", - "message", - "tagger", - "object", - "_repo", - ), -) +from GitRef import GitRef +from GitTree import GitTree +from GitCommit import GitCommit +from GitBlob import GitBlob +from GitTag import GitTag Label = GithubObject( "Label",