From 71b0ede8dec2436643ca0d6374c603f3794a1562 Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Sat, 12 May 2012 14:14:31 +0200 Subject: [PATCH] Remove complete-ability from git objects --- .../description.000.human_readable.json | 6 ----- .../description.001.normalized.json | 12 +++++----- src/github/GitBlob.py | 21 ----------------- src/github/GitCommit.py | 23 ------------------- src/github/GitObject.py | 19 --------------- src/github/GitRef.py | 19 --------------- src/github/GitTag.py | 22 ------------------ src/github/GitTree.py | 19 --------------- 8 files changed, 6 insertions(+), 135 deletions(-) diff --git a/codegen/JsonDescriptionOfGithubApiV3/description.000.human_readable.json b/codegen/JsonDescriptionOfGithubApiV3/description.000.human_readable.json index 543eef8e..8a62631f 100644 --- a/codegen/JsonDescriptionOfGithubApiV3/description.000.human_readable.json +++ b/codegen/JsonDescriptionOfGithubApiV3/description.000.human_readable.json @@ -536,7 +536,6 @@ }, { "name": "GitBlob", - "isCompletable": true, "attributes": [ { "name": "content", "type": "string" }, { "name": "encoding", "type": "string" }, @@ -549,7 +548,6 @@ }, { "name": "GitCommit", - "isCompletable": true, "attributes": [ { "name": "author", "type": "GitAuthor" }, { "name": "committer", "type": "GitAuthor" }, @@ -564,7 +562,6 @@ }, { "name": "GitObject", - "isCompletable": true, "attributes": [ { "name": "sha", "type": "string" }, { "name": "type", "type": "string" }, @@ -575,7 +572,6 @@ }, { "name": "GitRef", - "isCompletable": true, "edit": { "mandatoryParameters": [ { "name": "sha", "type": "@todo" } @@ -595,7 +591,6 @@ }, { "name": "GitTag", - "isCompletable": true, "attributes": [ { "name": "message", "type": "string" }, { "name": "object", "type": "GitObject" }, @@ -622,7 +617,6 @@ }, { "name": "GitTree", - "isCompletable": true, "attributes": [ { "name": "sha", "type": "string" }, { "name": "tree", "type": "list:GitTreeElement" }, diff --git a/codegen/JsonDescriptionOfGithubApiV3/description.001.normalized.json b/codegen/JsonDescriptionOfGithubApiV3/description.001.normalized.json index 90ef3721..cc32de0c 100644 --- a/codegen/JsonDescriptionOfGithubApiV3/description.001.normalized.json +++ b/codegen/JsonDescriptionOfGithubApiV3/description.001.normalized.json @@ -3060,7 +3060,7 @@ "name": "url" } ], - "isCompletable": true, + "isCompletable": false, "name": "GitBlob", "methods": [] }, @@ -3123,7 +3123,7 @@ "name": "url" } ], - "isCompletable": true, + "isCompletable": false, "name": "GitCommit", "methods": [] }, @@ -3154,7 +3154,7 @@ "name": "url" } ], - "isCompletable": true, + "isCompletable": false, "name": "GitObject", "methods": [] }, @@ -3185,7 +3185,7 @@ "name": "url" } ], - "isCompletable": true, + "isCompletable": false, "name": "GitRef", "methods": [ { @@ -3312,7 +3312,7 @@ "name": "url" } ], - "isCompletable": true, + "isCompletable": false, "name": "GitTag", "methods": [] }, @@ -3343,7 +3343,7 @@ "name": "url" } ], - "isCompletable": true, + "isCompletable": false, "name": "GitTree", "methods": [] }, diff --git a/src/github/GitBlob.py b/src/github/GitBlob.py index 9b5edc94..febf1a82 100644 --- a/src/github/GitBlob.py +++ b/src/github/GitBlob.py @@ -14,32 +14,25 @@ class GitBlob( object ): self.__completed = False self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: - self.__complete() @property def content( self ): - self.__completeIfNeeded( self.__content ) return self.__content @property def encoding( self ): - self.__completeIfNeeded( self.__encoding ) return self.__encoding @property def sha( self ): - self.__completeIfNeeded( self.__sha ) return self.__sha @property def size( self ): - self.__completeIfNeeded( self.__size ) return self.__size @property def url( self ): - self.__completeIfNeeded( self.__url ) return self.__url def __initAttributes( self ): @@ -49,20 +42,6 @@ class GitBlob( object ): self.__size = None self.__url = None - def __completeIfNeeded( self, testedAttribute ): - if not self.__completed and testedAttribute is None: - self.__complete() - - def __complete( self ): - status, headers, data = self.__requester.request( - "GET", - self.__url, - None, - None - ) - self.__useAttributes( data ) - self.__completed = True - def __useAttributes( self, attributes ): # @todo Remove this debug weakness: we shall assume that github will add new attributes for attribute in attributes: diff --git a/src/github/GitCommit.py b/src/github/GitCommit.py index c2caf05f..06d03a90 100644 --- a/src/github/GitCommit.py +++ b/src/github/GitCommit.py @@ -17,42 +17,33 @@ class GitCommit( object ): self.__completed = False self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: - self.__complete() @property def author( self ): - self.__completeIfNeeded( self.__author ) return self.__author @property def committer( self ): - self.__completeIfNeeded( self.__committer ) return self.__committer @property def message( self ): - self.__completeIfNeeded( self.__message ) return self.__message @property def parents( self ): - self.__completeIfNeeded( self.__parents ) return self.__parents @property def sha( self ): - self.__completeIfNeeded( self.__sha ) return self.__sha @property def tree( self ): - self.__completeIfNeeded( self.__tree ) return self.__tree @property def url( self ): - self.__completeIfNeeded( self.__url ) return self.__url def __initAttributes( self ): @@ -64,20 +55,6 @@ class GitCommit( object ): self.__tree = None self.__url = None - def __completeIfNeeded( self, testedAttribute ): - if not self.__completed and testedAttribute is None: - self.__complete() - - def __complete( self ): - status, headers, data = self.__requester.request( - "GET", - self.__url, - None, - None - ) - self.__useAttributes( data ) - self.__completed = True - def __useAttributes( self, attributes ): # @todo Remove this debug weakness: we shall assume that github will add new attributes for attribute in attributes: diff --git a/src/github/GitObject.py b/src/github/GitObject.py index 803872ce..f471c093 100644 --- a/src/github/GitObject.py +++ b/src/github/GitObject.py @@ -14,22 +14,17 @@ class GitObject( object ): self.__completed = False self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: - self.__complete() @property def sha( self ): - self.__completeIfNeeded( self.__sha ) return self.__sha @property def type( self ): - self.__completeIfNeeded( self.__type ) return self.__type @property def url( self ): - self.__completeIfNeeded( self.__url ) return self.__url def __initAttributes( self ): @@ -37,20 +32,6 @@ class GitObject( object ): self.__type = None self.__url = None - def __completeIfNeeded( self, testedAttribute ): - if not self.__completed and testedAttribute is None: - self.__complete() - - def __complete( self ): - status, headers, data = self.__requester.request( - "GET", - self.__url, - None, - None - ) - self.__useAttributes( data ) - self.__completed = True - def __useAttributes( self, attributes ): # @todo Remove this debug weakness: we shall assume that github will add new attributes for attribute in attributes: diff --git a/src/github/GitRef.py b/src/github/GitRef.py index ca632ac6..cb53f274 100644 --- a/src/github/GitRef.py +++ b/src/github/GitRef.py @@ -15,22 +15,17 @@ class GitRef( object ): self.__completed = False self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: - self.__complete() @property def object( self ): - self.__completeIfNeeded( self.__object ) return self.__object @property def ref( self ): - self.__completeIfNeeded( self.__ref ) return self.__ref @property def url( self ): - self.__completeIfNeeded( self.__url ) return self.__url def delete( self ): @@ -60,20 +55,6 @@ class GitRef( object ): self.__ref = None self.__url = None - def __completeIfNeeded( self, testedAttribute ): - if not self.__completed and testedAttribute is None: - self.__complete() - - def __complete( self ): - status, headers, data = self.__requester.request( - "GET", - self.__url, - None, - None - ) - self.__useAttributes( data ) - self.__completed = True - def __useAttributes( self, attributes ): # @todo Remove this debug weakness: we shall assume that github will add new attributes for attribute in attributes: diff --git a/src/github/GitTag.py b/src/github/GitTag.py index 2564da7b..a48348d8 100644 --- a/src/github/GitTag.py +++ b/src/github/GitTag.py @@ -16,37 +16,29 @@ class GitTag( object ): self.__completed = False self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: - self.__complete() @property def message( self ): - self.__completeIfNeeded( self.__message ) return self.__message @property def object( self ): - self.__completeIfNeeded( self.__object ) return self.__object @property def sha( self ): - self.__completeIfNeeded( self.__sha ) return self.__sha @property def tag( self ): - self.__completeIfNeeded( self.__tag ) return self.__tag @property def tagger( self ): - self.__completeIfNeeded( self.__tagger ) return self.__tagger @property def url( self ): - self.__completeIfNeeded( self.__url ) return self.__url def __initAttributes( self ): @@ -57,20 +49,6 @@ class GitTag( object ): self.__tagger = None self.__url = None - def __completeIfNeeded( self, testedAttribute ): - if not self.__completed and testedAttribute is None: - self.__complete() - - def __complete( self ): - status, headers, data = self.__requester.request( - "GET", - self.__url, - None, - None - ) - self.__useAttributes( data ) - self.__completed = True - def __useAttributes( self, attributes ): # @todo Remove this debug weakness: we shall assume that github will add new attributes for attribute in attributes: diff --git a/src/github/GitTree.py b/src/github/GitTree.py index 29264db0..cc42e29c 100644 --- a/src/github/GitTree.py +++ b/src/github/GitTree.py @@ -15,22 +15,17 @@ class GitTree( object ): self.__completed = False self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: - self.__complete() @property def sha( self ): - self.__completeIfNeeded( self.__sha ) return self.__sha @property def tree( self ): - self.__completeIfNeeded( self.__tree ) return self.__tree @property def url( self ): - self.__completeIfNeeded( self.__url ) return self.__url def __initAttributes( self ): @@ -38,20 +33,6 @@ class GitTree( object ): self.__tree = None self.__url = None - def __completeIfNeeded( self, testedAttribute ): - if not self.__completed and testedAttribute is None: - self.__complete() - - def __complete( self ): - status, headers, data = self.__requester.request( - "GET", - self.__url, - None, - None - ) - self.__useAttributes( data ) - self.__completed = True - def __useAttributes( self, attributes ): # @todo Remove this debug weakness: we shall assume that github will add new attributes for attribute in attributes: