diff --git a/codegen/templates/GithubObject.MethodBody.UseResult.py b/codegen/templates/GithubObject.MethodBody.UseResult.py index f422ec12..5eae0955 100644 --- a/codegen/templates/GithubObject.MethodBody.UseResult.py +++ b/codegen/templates/GithubObject.MethodBody.UseResult.py @@ -23,7 +23,7 @@ {% else %} {% if method.type.cardinality == "scalar" %} - return {% if method.type.name != class.name %}{{ method.type.name }}.{% endif %}{{ method.type.name }}( self.__requester, data, lazy = True ) + return {% if method.type.name != class.name %}{{ method.type.name }}.{% endif %}{{ method.type.name }}( self.__requester, data, completion = LazyCompletion ) {% endif %} {% if method.type.cardinality == "list" %} diff --git a/codegen/templates/GithubObject.py b/codegen/templates/GithubObject.py index fcbce68e..10d98951 100644 --- a/codegen/templates/GithubObject.py +++ b/codegen/templates/GithubObject.py @@ -6,13 +6,13 @@ import {{ dependency }} {% endfor %} class {{ class.name }}( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) {% if class.isCompletable %} - if not lazy: + if completion == ImmediateCompletion: self.__complete() {% endif %} @@ -96,13 +96,13 @@ class {{ class.name }}( object ): {% if attribute.type.simple %} self.__{{ attribute.name }} = attributes[ "{{ attribute.name }}" ] {% else %} - self.__{{ attribute.name }} = {% if attribute.type.name != class.name %}{{ attribute.type.name }}.{% endif %}{{ attribute.type.name }}( self.__requester, attributes[ "{{ attribute.name }}" ], lazy = True ) + self.__{{ attribute.name }} = {% if attribute.type.name != class.name %}{{ attribute.type.name }}.{% endif %}{{ attribute.type.name }}( self.__requester, attributes[ "{{ attribute.name }}" ], completion = LazyCompletion ) {% endif %} {% endif %} {% if attribute.type.cardinality == "list" %} self.__{{ attribute.name }} = [ - {% if attribute.type.name != class.name %}{{ attribute.type.name }}.{% endif %}{{ attribute.type.name }}( self.__requester, element, lazy = True ) + {% if attribute.type.name != class.name %}{{ attribute.type.name }}.{% endif %}{{ attribute.type.name }}( self.__requester, element, completion = LazyCompletion ) for element in attributes[ "{{ attribute.name }}" ] ] {% endif %} diff --git a/src/github/AuthenticatedUser.py b/src/github/AuthenticatedUser.py index 1fb9614f..3259e174 100644 --- a/src/github/AuthenticatedUser.py +++ b/src/github/AuthenticatedUser.py @@ -14,12 +14,12 @@ import Event import Authorization class AuthenticatedUser( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property @@ -187,7 +187,7 @@ class AuthenticatedUser( object ): None, post_parameters ) - return Authorization.Authorization( self.__requester, data, lazy = True ) + return Authorization.Authorization( self.__requester, data, completion = LazyCompletion ) def create_fork( self, repo ): status, headers, data = self.__requester.request( @@ -196,7 +196,7 @@ class AuthenticatedUser( object ): None, None ) - return Repository.Repository( self.__requester, data, lazy = True ) + return Repository.Repository( self.__requester, data, completion = LazyCompletion ) def create_gist( self, public, files, description = DefaultValueForOptionalParameters ): post_parameters = { @@ -211,7 +211,7 @@ class AuthenticatedUser( object ): None, post_parameters ) - return Gist.Gist( self.__requester, data, lazy = True ) + return Gist.Gist( self.__requester, data, completion = LazyCompletion ) def create_key( self, title, key ): post_parameters = { @@ -224,7 +224,7 @@ class AuthenticatedUser( object ): None, post_parameters ) - return UserKey.UserKey( self.__requester, data, lazy = True ) + return UserKey.UserKey( self.__requester, data, completion = LazyCompletion ) def create_repo( self, name, description = DefaultValueForOptionalParameters, homepage = DefaultValueForOptionalParameters, private = DefaultValueForOptionalParameters, has_issues = DefaultValueForOptionalParameters, has_wiki = DefaultValueForOptionalParameters, has_downloads = DefaultValueForOptionalParameters, team_id = DefaultValueForOptionalParameters ): post_parameters = { @@ -250,7 +250,7 @@ class AuthenticatedUser( object ): None, post_parameters ) - return Repository.Repository( self.__requester, data, lazy = True ) + return Repository.Repository( self.__requester, data, completion = LazyCompletion ) def edit( self, name = DefaultValueForOptionalParameters, email = DefaultValueForOptionalParameters, blog = DefaultValueForOptionalParameters, company = DefaultValueForOptionalParameters, location = DefaultValueForOptionalParameters, hireable = DefaultValueForOptionalParameters, bio = DefaultValueForOptionalParameters ): post_parameters = { @@ -284,7 +284,7 @@ class AuthenticatedUser( object ): None, None ) - return Authorization.Authorization( self.__requester, data, lazy = True ) + return Authorization.Authorization( self.__requester, data, completion = LazyCompletion ) def get_authorizations( self ): status, headers, data = self.__requester.request( @@ -386,7 +386,7 @@ class AuthenticatedUser( object ): None, None ) - return UserKey.UserKey( self.__requester, data, lazy = True ) + return UserKey.UserKey( self.__requester, data, completion = LazyCompletion ) def get_keys( self ): status, headers, data = self.__requester.request( @@ -437,7 +437,7 @@ class AuthenticatedUser( object ): None, None ) - return Repository.Repository( self.__requester, data, lazy = True ) + return Repository.Repository( self.__requester, data, completion = LazyCompletion ) def get_repos( self, type = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( @@ -626,7 +626,7 @@ class AuthenticatedUser( object ): self.__owned_private_repos = attributes[ "owned_private_repos" ] if "plan" in attributes and attributes[ "plan" ] is not None: assert isinstance( attributes[ "plan" ], dict ) - self.__plan = Plan.Plan( self.__requester, attributes[ "plan" ], lazy = True ) + self.__plan = Plan.Plan( self.__requester, attributes[ "plan" ], completion = LazyCompletion ) if "private_gists" in attributes and attributes[ "private_gists" ] is not None: assert isinstance( attributes[ "private_gists" ], int ) self.__private_gists = attributes[ "private_gists" ] diff --git a/src/github/Authorization.py b/src/github/Authorization.py index ee706cc8..5642c931 100644 --- a/src/github/Authorization.py +++ b/src/github/Authorization.py @@ -5,12 +5,12 @@ import PaginatedList from GithubObject import * class Authorization( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property diff --git a/src/github/Branch.py b/src/github/Branch.py index 60380e9d..e82ce384 100644 --- a/src/github/Branch.py +++ b/src/github/Branch.py @@ -6,9 +6,9 @@ from GithubObject import * import Commit class Branch( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) @@ -31,7 +31,7 @@ class Branch( object ): # @todo No need to check if attribute is in attributes when attribute is mandatory if "commit" in attributes and attributes[ "commit" ] is not None: assert isinstance( attributes[ "commit" ], dict ) - self.__commit = Commit.Commit( self.__requester, attributes[ "commit" ], lazy = True ) + self.__commit = Commit.Commit( self.__requester, attributes[ "commit" ], completion = LazyCompletion ) if "name" in attributes and attributes[ "name" ] is not None: assert isinstance( attributes[ "name" ], ( str, unicode ) ) self.__name = attributes[ "name" ] diff --git a/src/github/Commit.py b/src/github/Commit.py index 865f9cde..4cf97132 100644 --- a/src/github/Commit.py +++ b/src/github/Commit.py @@ -11,12 +11,12 @@ import Commit import CommitComment class Commit( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property @@ -77,7 +77,7 @@ class Commit( object ): None, post_parameters ) - return CommitComment.CommitComment( self.__requester, data, lazy = True ) + return CommitComment.CommitComment( self.__requester, data, completion = LazyCompletion ) def get_comments( self ): status, headers, data = self.__requester.request( @@ -124,23 +124,23 @@ class Commit( object ): # @todo No need to check if attribute is in attributes when attribute is mandatory if "author" in attributes and attributes[ "author" ] is not None: assert isinstance( attributes[ "author" ], dict ) - self.__author = NamedUser.NamedUser( self.__requester, attributes[ "author" ], lazy = True ) + self.__author = NamedUser.NamedUser( self.__requester, attributes[ "author" ], completion = LazyCompletion ) if "commit" in attributes and attributes[ "commit" ] is not None: assert isinstance( attributes[ "commit" ], dict ) - self.__commit = GitCommit.GitCommit( self.__requester, attributes[ "commit" ], lazy = True ) + self.__commit = GitCommit.GitCommit( self.__requester, attributes[ "commit" ], completion = LazyCompletion ) if "committer" in attributes and attributes[ "committer" ] is not None: assert isinstance( attributes[ "committer" ], dict ) - self.__committer = NamedUser.NamedUser( self.__requester, attributes[ "committer" ], lazy = True ) + self.__committer = NamedUser.NamedUser( self.__requester, attributes[ "committer" ], completion = LazyCompletion ) if "files" in attributes and attributes[ "files" ] is not None: assert isinstance( attributes[ "files" ], list ) and ( len( attributes[ "files" ] ) == 0 or isinstance( attributes[ "files" ][ 0 ], dict ) ) self.__files = [ - CommitFile.CommitFile( self.__requester, element, lazy = True ) + CommitFile.CommitFile( self.__requester, element, completion = LazyCompletion ) for element in attributes[ "files" ] ] if "parents" in attributes and attributes[ "parents" ] is not None: assert isinstance( attributes[ "parents" ], list ) and ( len( attributes[ "parents" ] ) == 0 or isinstance( attributes[ "parents" ][ 0 ], dict ) ) self.__parents = [ - Commit( self.__requester, element, lazy = True ) + Commit( self.__requester, element, completion = LazyCompletion ) for element in attributes[ "parents" ] ] if "sha" in attributes and attributes[ "sha" ] is not None: @@ -148,7 +148,7 @@ class Commit( object ): self.__sha = attributes[ "sha" ] if "stats" in attributes and attributes[ "stats" ] is not None: assert isinstance( attributes[ "stats" ], dict ) - self.__stats = CommitStats.CommitStats( self.__requester, attributes[ "stats" ], lazy = True ) + self.__stats = CommitStats.CommitStats( self.__requester, attributes[ "stats" ], completion = LazyCompletion ) if "url" in attributes and attributes[ "url" ] is not None: assert isinstance( attributes[ "url" ], ( str, unicode ) ) self.__url = attributes[ "url" ] diff --git a/src/github/CommitComment.py b/src/github/CommitComment.py index 290fdd69..a1dfed31 100644 --- a/src/github/CommitComment.py +++ b/src/github/CommitComment.py @@ -6,12 +6,12 @@ from GithubObject import * import NamedUser class CommitComment( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property @@ -143,4 +143,4 @@ class CommitComment( object ): self.__url = attributes[ "url" ] if "user" in attributes and attributes[ "user" ] is not None: assert isinstance( attributes[ "user" ], dict ) - self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], lazy = True ) + self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], completion = LazyCompletion ) diff --git a/src/github/CommitFile.py b/src/github/CommitFile.py index ea1df2d2..9729897f 100644 --- a/src/github/CommitFile.py +++ b/src/github/CommitFile.py @@ -5,9 +5,9 @@ import PaginatedList from GithubObject import * class CommitFile( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) diff --git a/src/github/CommitStats.py b/src/github/CommitStats.py index 3268bd5e..46babcdb 100644 --- a/src/github/CommitStats.py +++ b/src/github/CommitStats.py @@ -5,9 +5,9 @@ import PaginatedList from GithubObject import * class CommitStats( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) diff --git a/src/github/Download.py b/src/github/Download.py index 86ecbb15..eb4d2f3d 100644 --- a/src/github/Download.py +++ b/src/github/Download.py @@ -5,12 +5,12 @@ import PaginatedList from GithubObject import * class Download( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property diff --git a/src/github/Event.py b/src/github/Event.py index d4a99462..e6dcb5cc 100644 --- a/src/github/Event.py +++ b/src/github/Event.py @@ -8,12 +8,12 @@ import Repository import NamedUser class Event( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property @@ -111,7 +111,7 @@ class Event( object ): # @todo No need to check if attribute is in attributes when attribute is mandatory if "actor" in attributes and attributes[ "actor" ] is not None: assert isinstance( attributes[ "actor" ], dict ) - self.__actor = NamedUser.NamedUser( self.__requester, attributes[ "actor" ], lazy = True ) + self.__actor = NamedUser.NamedUser( self.__requester, attributes[ "actor" ], completion = LazyCompletion ) if "commit_id" in attributes and attributes[ "commit_id" ] is not None: self.__commit_id = attributes[ "commit_id" ] if "created_at" in attributes and attributes[ "created_at" ] is not None: @@ -124,14 +124,14 @@ class Event( object ): self.__issue = attributes[ "issue" ] if "org" in attributes and attributes[ "org" ] is not None: assert isinstance( attributes[ "org" ], dict ) - self.__org = Organization.Organization( self.__requester, attributes[ "org" ], lazy = True ) + self.__org = Organization.Organization( self.__requester, attributes[ "org" ], completion = LazyCompletion ) if "payload" in attributes and attributes[ "payload" ] is not None: self.__payload = attributes[ "payload" ] if "public" in attributes and attributes[ "public" ] is not None: self.__public = attributes[ "public" ] if "repo" in attributes and attributes[ "repo" ] is not None: assert isinstance( attributes[ "repo" ], dict ) - self.__repo = Repository.Repository( self.__requester, attributes[ "repo" ], lazy = True ) + self.__repo = Repository.Repository( self.__requester, attributes[ "repo" ], completion = LazyCompletion ) if "type" in attributes and attributes[ "type" ] is not None: self.__type = attributes[ "type" ] if "url" in attributes and attributes[ "url" ] is not None: diff --git a/src/github/Gist.py b/src/github/Gist.py index 8e12ade6..faafbfea 100644 --- a/src/github/Gist.py +++ b/src/github/Gist.py @@ -8,12 +8,12 @@ import Gist import GistComment class Gist( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property @@ -96,7 +96,7 @@ class Gist( object ): None, post_parameters ) - return GistComment.GistComment( self.__requester, data, lazy = True ) + return GistComment.GistComment( self.__requester, data, completion = LazyCompletion ) def create_fork( self ): status, headers, data = self.__requester.request( @@ -105,7 +105,7 @@ class Gist( object ): None, None ) - return Gist( self.__requester, data, lazy = True ) + return Gist( self.__requester, data, completion = LazyCompletion ) def delete( self ): status, headers, data = self.__requester.request( @@ -137,7 +137,7 @@ class Gist( object ): None, None ) - return GistComment.GistComment( self.__requester, data, lazy = True ) + return GistComment.GistComment( self.__requester, data, completion = LazyCompletion ) def get_comments( self ): status, headers, data = self.__requester.request( @@ -243,4 +243,4 @@ class Gist( object ): self.__url = attributes[ "url" ] if "user" in attributes and attributes[ "user" ] is not None: assert isinstance( attributes[ "user" ], dict ) - self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], lazy = True ) + self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], completion = LazyCompletion ) diff --git a/src/github/GistComment.py b/src/github/GistComment.py index 800faded..ae2418ad 100644 --- a/src/github/GistComment.py +++ b/src/github/GistComment.py @@ -6,12 +6,12 @@ from GithubObject import * import NamedUser class GistComment( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property @@ -103,4 +103,4 @@ class GistComment( object ): self.__url = attributes[ "url" ] if "user" in attributes and attributes[ "user" ] is not None: assert isinstance( attributes[ "user" ], dict ) - self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], lazy = True ) + self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], completion = LazyCompletion ) diff --git a/src/github/GitAuthor.py b/src/github/GitAuthor.py index ff54e7fb..49c0b9e5 100644 --- a/src/github/GitAuthor.py +++ b/src/github/GitAuthor.py @@ -5,9 +5,9 @@ import PaginatedList from GithubObject import * class GitAuthor( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) diff --git a/src/github/GitBlob.py b/src/github/GitBlob.py index 0a5408d4..87c22b1a 100644 --- a/src/github/GitBlob.py +++ b/src/github/GitBlob.py @@ -5,9 +5,9 @@ import PaginatedList from GithubObject import * class GitBlob( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) diff --git a/src/github/GitCommit.py b/src/github/GitCommit.py index 5f60daa8..ff36c03c 100644 --- a/src/github/GitCommit.py +++ b/src/github/GitCommit.py @@ -8,9 +8,9 @@ import GitCommit import GitTree class GitCommit( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) @@ -58,17 +58,17 @@ class GitCommit( object ): # @todo No need to check if attribute is in attributes when attribute is mandatory if "author" in attributes and attributes[ "author" ] is not None: assert isinstance( attributes[ "author" ], dict ) - self.__author = GitAuthor.GitAuthor( self.__requester, attributes[ "author" ], lazy = True ) + self.__author = GitAuthor.GitAuthor( self.__requester, attributes[ "author" ], completion = LazyCompletion ) if "committer" in attributes and attributes[ "committer" ] is not None: assert isinstance( attributes[ "committer" ], dict ) - self.__committer = GitAuthor.GitAuthor( self.__requester, attributes[ "committer" ], lazy = True ) + self.__committer = GitAuthor.GitAuthor( self.__requester, attributes[ "committer" ], completion = LazyCompletion ) if "message" in attributes and attributes[ "message" ] is not None: assert isinstance( attributes[ "message" ], ( str, unicode ) ) self.__message = attributes[ "message" ] if "parents" in attributes and attributes[ "parents" ] is not None: assert isinstance( attributes[ "parents" ], list ) and ( len( attributes[ "parents" ] ) == 0 or isinstance( attributes[ "parents" ][ 0 ], dict ) ) self.__parents = [ - GitCommit( self.__requester, element, lazy = True ) + GitCommit( self.__requester, element, completion = LazyCompletion ) for element in attributes[ "parents" ] ] if "sha" in attributes and attributes[ "sha" ] is not None: @@ -76,7 +76,7 @@ class GitCommit( object ): self.__sha = attributes[ "sha" ] if "tree" in attributes and attributes[ "tree" ] is not None: assert isinstance( attributes[ "tree" ], dict ) - self.__tree = GitTree.GitTree( self.__requester, attributes[ "tree" ], lazy = True ) + self.__tree = GitTree.GitTree( self.__requester, attributes[ "tree" ], completion = LazyCompletion ) if "url" in attributes and attributes[ "url" ] is not None: assert isinstance( attributes[ "url" ], ( str, unicode ) ) self.__url = attributes[ "url" ] diff --git a/src/github/GitObject.py b/src/github/GitObject.py index d55ec5e1..bb3f09b9 100644 --- a/src/github/GitObject.py +++ b/src/github/GitObject.py @@ -5,9 +5,9 @@ import PaginatedList from GithubObject import * class GitObject( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) diff --git a/src/github/GitRef.py b/src/github/GitRef.py index b7bc1bc8..7673eab0 100644 --- a/src/github/GitRef.py +++ b/src/github/GitRef.py @@ -6,9 +6,9 @@ from GithubObject import * import GitObject class GitRef( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) @@ -58,7 +58,7 @@ class GitRef( object ): # @todo No need to check if attribute is in attributes when attribute is mandatory if "object" in attributes and attributes[ "object" ] is not None: assert isinstance( attributes[ "object" ], dict ) - self.__object = GitObject.GitObject( self.__requester, attributes[ "object" ], lazy = True ) + self.__object = GitObject.GitObject( self.__requester, attributes[ "object" ], completion = LazyCompletion ) if "ref" in attributes and attributes[ "ref" ] is not None: assert isinstance( attributes[ "ref" ], ( str, unicode ) ) self.__ref = attributes[ "ref" ] diff --git a/src/github/GitTag.py b/src/github/GitTag.py index fa02a1fd..6d922a8a 100644 --- a/src/github/GitTag.py +++ b/src/github/GitTag.py @@ -7,9 +7,9 @@ import GitAuthor import GitObject class GitTag( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) @@ -55,7 +55,7 @@ class GitTag( object ): self.__message = attributes[ "message" ] if "object" in attributes and attributes[ "object" ] is not None: assert isinstance( attributes[ "object" ], dict ) - self.__object = GitObject.GitObject( self.__requester, attributes[ "object" ], lazy = True ) + self.__object = GitObject.GitObject( self.__requester, attributes[ "object" ], completion = LazyCompletion ) if "sha" in attributes and attributes[ "sha" ] is not None: assert isinstance( attributes[ "sha" ], ( str, unicode ) ) self.__sha = attributes[ "sha" ] @@ -64,7 +64,7 @@ class GitTag( object ): self.__tag = attributes[ "tag" ] if "tagger" in attributes and attributes[ "tagger" ] is not None: assert isinstance( attributes[ "tagger" ], dict ) - self.__tagger = GitAuthor.GitAuthor( self.__requester, attributes[ "tagger" ], lazy = True ) + self.__tagger = GitAuthor.GitAuthor( self.__requester, attributes[ "tagger" ], completion = LazyCompletion ) if "url" in attributes and attributes[ "url" ] is not None: assert isinstance( attributes[ "url" ], ( str, unicode ) ) self.__url = attributes[ "url" ] diff --git a/src/github/GitTree.py b/src/github/GitTree.py index 1c61c5f6..1c3daa26 100644 --- a/src/github/GitTree.py +++ b/src/github/GitTree.py @@ -6,9 +6,9 @@ from GithubObject import * import GitTreeElement class GitTree( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) @@ -40,7 +40,7 @@ class GitTree( object ): if "tree" in attributes and attributes[ "tree" ] is not None: assert isinstance( attributes[ "tree" ], list ) and ( len( attributes[ "tree" ] ) == 0 or isinstance( attributes[ "tree" ][ 0 ], dict ) ) self.__tree = [ - GitTreeElement.GitTreeElement( self.__requester, element, lazy = True ) + GitTreeElement.GitTreeElement( self.__requester, element, completion = LazyCompletion ) for element in attributes[ "tree" ] ] if "url" in attributes and attributes[ "url" ] is not None: diff --git a/src/github/GitTreeElement.py b/src/github/GitTreeElement.py index 8821c581..17032cfa 100644 --- a/src/github/GitTreeElement.py +++ b/src/github/GitTreeElement.py @@ -5,9 +5,9 @@ import PaginatedList from GithubObject import * class GitTreeElement( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) diff --git a/src/github/Github.py b/src/github/Github.py index 3e3341d0..09ea6312 100644 --- a/src/github/Github.py +++ b/src/github/Github.py @@ -4,6 +4,7 @@ import NamedUser import Organization import Gist import PaginatedList +from GithubObject import LazyCompletion, ImmediateCompletion class Github: def __init__( self, login, password ): @@ -15,27 +16,27 @@ class Github: "url": "https://api.github.com/user", # @todo Erf, this url is replaced by /users/login when __complete is called... # "login": self.__login # @todo ? } - return AuthenticatedUser.AuthenticatedUser( self.__requester, attributes, lazy = True ) + return AuthenticatedUser.AuthenticatedUser( self.__requester, attributes, completion = LazyCompletion ) else: attributes = { "url": "https://api.github.com/users/" + login, "login": login, } - return NamedUser.NamedUser( self.__requester, attributes, lazy = False ) + return NamedUser.NamedUser( self.__requester, attributes, completion = ImmediateCompletion ) def get_organization( self, login ): attributes = { "url": "https://api.github.com/orgs/" + login, "login": login, } - return Organization.Organization( self.__requester, attributes, lazy = False ) + return Organization.Organization( self.__requester, attributes, completion = ImmediateCompletion ) def get_gist( self, id ): attributes = { "url": "https://api.github.com/gists/" + str( id ), "id": id, } - return Gist.Gist( self.__requester, attributes, lazy = False ) + return Gist.Gist( self.__requester, attributes, completion = ImmediateCompletion ) def get_gists( self ): status, headers, data = self.__requester.request( "GET", "https://api.github.com/gists/public", None, None ) diff --git a/src/github/GithubObject.py b/src/github/GithubObject.py index d3552f06..e36123a7 100644 --- a/src/github/GithubObject.py +++ b/src/github/GithubObject.py @@ -2,3 +2,7 @@ class DefaultValueForOptionalParametersType: pass DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() + +LazyCompletion = 0 +ImmediateCompletion = 1 +NoCompletion = 2 diff --git a/src/github/Hook.py b/src/github/Hook.py index 0445edd6..c6ce3091 100644 --- a/src/github/Hook.py +++ b/src/github/Hook.py @@ -5,12 +5,12 @@ import PaginatedList from GithubObject import * class Hook( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property diff --git a/src/github/Issue.py b/src/github/Issue.py index 67900065..d548c70c 100644 --- a/src/github/Issue.py +++ b/src/github/Issue.py @@ -10,12 +10,12 @@ import Milestone import Label class Issue( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property @@ -122,7 +122,7 @@ class Issue( object ): None, post_parameters ) - return IssueComment.IssueComment( self.__requester, data, lazy = True ) + return IssueComment.IssueComment( self.__requester, data, completion = LazyCompletion ) def delete_labels( self ): pass @@ -157,7 +157,7 @@ class Issue( object ): None, None ) - return IssueComment.IssueComment( self.__requester, data, lazy = True ) + return IssueComment.IssueComment( self.__requester, data, completion = LazyCompletion ) def get_comments( self ): status, headers, data = self.__requester.request( @@ -252,7 +252,7 @@ class Issue( object ): # @todo No need to check if attribute is in attributes when attribute is mandatory if "assignee" in attributes and attributes[ "assignee" ] is not None: assert isinstance( attributes[ "assignee" ], dict ) - self.__assignee = NamedUser.NamedUser( self.__requester, attributes[ "assignee" ], lazy = True ) + self.__assignee = NamedUser.NamedUser( self.__requester, attributes[ "assignee" ], completion = LazyCompletion ) if "body" in attributes and attributes[ "body" ] is not None: self.__body = attributes[ "body" ] if "closed_at" in attributes and attributes[ "closed_at" ] is not None: @@ -271,7 +271,7 @@ class Issue( object ): self.__labels = attributes[ "labels" ] if "milestone" in attributes and attributes[ "milestone" ] is not None: assert isinstance( attributes[ "milestone" ], dict ) - self.__milestone = Milestone.Milestone( self.__requester, attributes[ "milestone" ], lazy = True ) + self.__milestone = Milestone.Milestone( self.__requester, attributes[ "milestone" ], completion = LazyCompletion ) if "number" in attributes and attributes[ "number" ] is not None: self.__number = attributes[ "number" ] if "pull_request" in attributes and attributes[ "pull_request" ] is not None: @@ -286,4 +286,4 @@ class Issue( object ): self.__url = attributes[ "url" ] if "user" in attributes and attributes[ "user" ] is not None: assert isinstance( attributes[ "user" ], dict ) - self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], lazy = True ) + self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], completion = LazyCompletion ) diff --git a/src/github/IssueComment.py b/src/github/IssueComment.py index 13e6c8db..f5bd7167 100644 --- a/src/github/IssueComment.py +++ b/src/github/IssueComment.py @@ -6,12 +6,12 @@ from GithubObject import * import NamedUser class IssueComment( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property @@ -103,4 +103,4 @@ class IssueComment( object ): self.__url = attributes[ "url" ] if "user" in attributes and attributes[ "user" ] is not None: assert isinstance( attributes[ "user" ], dict ) - self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], lazy = True ) + self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], completion = LazyCompletion ) diff --git a/src/github/IssueEvent.py b/src/github/IssueEvent.py index 4d5bd006..62e26477 100644 --- a/src/github/IssueEvent.py +++ b/src/github/IssueEvent.py @@ -6,12 +6,12 @@ from GithubObject import * import NamedUser class IssueEvent( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property @@ -79,7 +79,7 @@ class IssueEvent( object ): # @todo No need to check if attribute is in attributes when attribute is mandatory if "actor" in attributes and attributes[ "actor" ] is not None: assert isinstance( attributes[ "actor" ], dict ) - self.__actor = NamedUser.NamedUser( self.__requester, attributes[ "actor" ], lazy = True ) + self.__actor = NamedUser.NamedUser( self.__requester, attributes[ "actor" ], completion = LazyCompletion ) if "commit_id" in attributes and attributes[ "commit_id" ] is not None: self.__commit_id = attributes[ "commit_id" ] if "created_at" in attributes and attributes[ "created_at" ] is not None: diff --git a/src/github/Label.py b/src/github/Label.py index 49ceefa9..0a815ac7 100644 --- a/src/github/Label.py +++ b/src/github/Label.py @@ -5,12 +5,12 @@ import PaginatedList from GithubObject import * class Label( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property diff --git a/src/github/Milestone.py b/src/github/Milestone.py index bbc9bdcb..a0153c2b 100644 --- a/src/github/Milestone.py +++ b/src/github/Milestone.py @@ -7,12 +7,12 @@ import NamedUser import Label class Milestone( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property @@ -142,7 +142,7 @@ class Milestone( object ): self.__created_at = attributes[ "created_at" ] if "creator" in attributes and attributes[ "creator" ] is not None: assert isinstance( attributes[ "creator" ], dict ) - self.__creator = NamedUser.NamedUser( self.__requester, attributes[ "creator" ], lazy = True ) + self.__creator = NamedUser.NamedUser( self.__requester, attributes[ "creator" ], completion = LazyCompletion ) if "description" in attributes and attributes[ "description" ] is not None: self.__description = attributes[ "description" ] if "due_on" in attributes and attributes[ "due_on" ] is not None: diff --git a/src/github/NamedUser.py b/src/github/NamedUser.py index e5668e35..488ed25a 100644 --- a/src/github/NamedUser.py +++ b/src/github/NamedUser.py @@ -10,12 +10,12 @@ import Repository import NamedUser class NamedUser( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property @@ -161,7 +161,7 @@ class NamedUser( object ): None, post_parameters ) - return Gist.Gist( self.__requester, data, lazy = True ) + return Gist.Gist( self.__requester, data, completion = LazyCompletion ) def get_events( self ): status, headers, data = self.__requester.request( @@ -282,7 +282,7 @@ class NamedUser( object ): None, None ) - return Repository.Repository( self.__requester, data, lazy = True ) + return Repository.Repository( self.__requester, data, completion = LazyCompletion ) def get_repos( self, type = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( diff --git a/src/github/Organization.py b/src/github/Organization.py index 97737805..0e21a627 100644 --- a/src/github/Organization.py +++ b/src/github/Organization.py @@ -10,12 +10,12 @@ import Repository import NamedUser class Organization( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property @@ -156,7 +156,7 @@ class Organization( object ): url_parameters, None ) - return Repository.Repository( self.__requester, data, lazy = True ) + return Repository.Repository( self.__requester, data, completion = LazyCompletion ) def create_repo( self, name, description = DefaultValueForOptionalParameters, homepage = DefaultValueForOptionalParameters, private = DefaultValueForOptionalParameters, has_issues = DefaultValueForOptionalParameters, has_wiki = DefaultValueForOptionalParameters, has_downloads = DefaultValueForOptionalParameters, team_id = DefaultValueForOptionalParameters ): post_parameters = { @@ -182,7 +182,7 @@ class Organization( object ): None, post_parameters ) - return Repository.Repository( self.__requester, data, lazy = True ) + return Repository.Repository( self.__requester, data, completion = LazyCompletion ) def create_team( self, name, repo_names = DefaultValueForOptionalParameters, permission = DefaultValueForOptionalParameters ): post_parameters = { @@ -198,7 +198,7 @@ class Organization( object ): None, post_parameters ) - return Team.Team( self.__requester, data, lazy = True ) + return Team.Team( self.__requester, data, completion = LazyCompletion ) def edit( self, billing_email = DefaultValueForOptionalParameters, blog = DefaultValueForOptionalParameters, company = DefaultValueForOptionalParameters, email = DefaultValueForOptionalParameters, location = DefaultValueForOptionalParameters, name = DefaultValueForOptionalParameters ): post_parameters = { @@ -272,7 +272,7 @@ class Organization( object ): None, None ) - return Repository.Repository( self.__requester, data, lazy = True ) + return Repository.Repository( self.__requester, data, completion = LazyCompletion ) def get_repos( self, type = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( @@ -434,7 +434,7 @@ class Organization( object ): self.__owned_private_repos = attributes[ "owned_private_repos" ] if "plan" in attributes and attributes[ "plan" ] is not None: assert isinstance( attributes[ "plan" ], dict ) - self.__plan = Plan.Plan( self.__requester, attributes[ "plan" ], lazy = True ) + self.__plan = Plan.Plan( self.__requester, attributes[ "plan" ], completion = LazyCompletion ) if "private_gists" in attributes and attributes[ "private_gists" ] is not None: assert isinstance( attributes[ "private_gists" ], int ) self.__private_gists = attributes[ "private_gists" ] diff --git a/src/github/PaginatedList.py b/src/github/PaginatedList.py index d070b6c5..5c37642f 100644 --- a/src/github/PaginatedList.py +++ b/src/github/PaginatedList.py @@ -1,3 +1,5 @@ +from GithubObject import LazyCompletion + class PaginatedList: def __init__( self, contentClass, requester, headers, data ): self.__requester = requester @@ -28,7 +30,7 @@ class PaginatedList: self.__nextUrl = None self.__list = [ - self.__contentClass( self.__requester, element, lazy = True ) + self.__contentClass( self.__requester, element, completion = LazyCompletion ) for element in data ] diff --git a/src/github/Permissions.py b/src/github/Permissions.py index 7b78b712..65642f06 100644 --- a/src/github/Permissions.py +++ b/src/github/Permissions.py @@ -5,9 +5,9 @@ import PaginatedList from GithubObject import * class Permissions( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) diff --git a/src/github/Plan.py b/src/github/Plan.py index 606a7139..e4ee5926 100644 --- a/src/github/Plan.py +++ b/src/github/Plan.py @@ -5,9 +5,9 @@ import PaginatedList from GithubObject import * class Plan( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) diff --git a/src/github/PullRequest.py b/src/github/PullRequest.py index 66d9642b..8a440241 100644 --- a/src/github/PullRequest.py +++ b/src/github/PullRequest.py @@ -9,12 +9,12 @@ import PullRequestComment import PullRequestFile class PullRequest( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property @@ -171,7 +171,7 @@ class PullRequest( object ): None, None ) - return PullRequestComment.PullRequestComment( self.__requester, data, lazy = True ) + return PullRequestComment.PullRequestComment( self.__requester, data, completion = LazyCompletion ) def get_comments( self ): status, headers, data = self.__requester.request( @@ -331,4 +331,4 @@ class PullRequest( object ): self.__url = attributes[ "url" ] if "user" in attributes and attributes[ "user" ] is not None: assert isinstance( attributes[ "user" ], dict ) - self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], lazy = True ) + self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], completion = LazyCompletion ) diff --git a/src/github/PullRequestComment.py b/src/github/PullRequestComment.py index fb401c51..3d7ceeb5 100644 --- a/src/github/PullRequestComment.py +++ b/src/github/PullRequestComment.py @@ -6,12 +6,12 @@ from GithubObject import * import NamedUser class PullRequestComment( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property @@ -143,4 +143,4 @@ class PullRequestComment( object ): self.__url = attributes[ "url" ] if "user" in attributes and attributes[ "user" ] is not None: assert isinstance( attributes[ "user" ], dict ) - self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], lazy = True ) + self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], completion = LazyCompletion ) diff --git a/src/github/PullRequestFile.py b/src/github/PullRequestFile.py index 6a65705c..a75415a8 100644 --- a/src/github/PullRequestFile.py +++ b/src/github/PullRequestFile.py @@ -5,9 +5,9 @@ import PaginatedList from GithubObject import * class PullRequestFile( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) diff --git a/src/github/Repository.py b/src/github/Repository.py index 2176697d..e9efc74b 100644 --- a/src/github/Repository.py +++ b/src/github/Repository.py @@ -28,12 +28,12 @@ import Download import Event class Repository( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property @@ -218,7 +218,7 @@ class Repository( object ): None, post_parameters ) - return Download.Download( self.__requester, data, lazy = True ) + return Download.Download( self.__requester, data, completion = LazyCompletion ) def create_git_blob( self, content, encoding ): post_parameters = { @@ -231,7 +231,7 @@ class Repository( object ): None, post_parameters ) - return GitBlob.GitBlob( self.__requester, data, lazy = True ) + return GitBlob.GitBlob( self.__requester, data, completion = LazyCompletion ) def create_git_commit( self, message, tree, parents, author = DefaultValueForOptionalParameters, committer = DefaultValueForOptionalParameters ): post_parameters = { @@ -249,7 +249,7 @@ class Repository( object ): None, post_parameters ) - return GitCommit.GitCommit( self.__requester, data, lazy = True ) + return GitCommit.GitCommit( self.__requester, data, completion = LazyCompletion ) def create_git_ref( self, ref, sha ): post_parameters = { @@ -262,7 +262,7 @@ class Repository( object ): None, post_parameters ) - return GitRef.GitRef( self.__requester, data, lazy = True ) + return GitRef.GitRef( self.__requester, data, completion = LazyCompletion ) def create_git_tag( self, tag, message, object, type, tagger = DefaultValueForOptionalParameters ): post_parameters = { @@ -279,7 +279,7 @@ class Repository( object ): None, post_parameters ) - return GitTag.GitTag( self.__requester, data, lazy = True ) + return GitTag.GitTag( self.__requester, data, completion = LazyCompletion ) def create_git_tree( self, tree, base_tree = DefaultValueForOptionalParameters ): post_parameters = { @@ -293,7 +293,7 @@ class Repository( object ): None, post_parameters ) - return GitTree.GitTree( self.__requester, data, lazy = True ) + return GitTree.GitTree( self.__requester, data, completion = LazyCompletion ) def create_hook( self, name, config, events = DefaultValueForOptionalParameters, active = DefaultValueForOptionalParameters ): post_parameters = { @@ -310,7 +310,7 @@ class Repository( object ): None, post_parameters ) - return Hook.Hook( self.__requester, data, lazy = True ) + return Hook.Hook( self.__requester, data, completion = LazyCompletion ) def create_issue( self, title, body = DefaultValueForOptionalParameters, assignee = DefaultValueForOptionalParameters, milestone = DefaultValueForOptionalParameters, labels = DefaultValueForOptionalParameters ): post_parameters = { @@ -330,7 +330,7 @@ class Repository( object ): None, post_parameters ) - return Issue.Issue( self.__requester, data, lazy = True ) + return Issue.Issue( self.__requester, data, completion = LazyCompletion ) def create_key( self, title, key ): post_parameters = { @@ -343,7 +343,7 @@ class Repository( object ): None, post_parameters ) - return RepositoryKey.RepositoryKey( self.__requester, data, lazy = True ) + return RepositoryKey.RepositoryKey( self.__requester, data, completion = LazyCompletion ) def create_label( self, name, color ): post_parameters = { @@ -356,7 +356,7 @@ class Repository( object ): None, post_parameters ) - return Label.Label( self.__requester, data, lazy = True ) + return Label.Label( self.__requester, data, completion = LazyCompletion ) def create_milestone( self, title, state = DefaultValueForOptionalParameters, description = DefaultValueForOptionalParameters, due_on = DefaultValueForOptionalParameters ): post_parameters = { @@ -374,7 +374,7 @@ class Repository( object ): None, post_parameters ) - return Milestone.Milestone( self.__requester, data, lazy = True ) + return Milestone.Milestone( self.__requester, data, completion = LazyCompletion ) def edit( self, name, description = DefaultValueForOptionalParameters, homepage = DefaultValueForOptionalParameters, public = DefaultValueForOptionalParameters, has_issues = DefaultValueForOptionalParameters, has_wiki = DefaultValueForOptionalParameters, has_downloads = DefaultValueForOptionalParameters ): post_parameters = { @@ -435,7 +435,7 @@ class Repository( object ): None, None ) - return CommitComment.CommitComment( self.__requester, data, lazy = True ) + return CommitComment.CommitComment( self.__requester, data, completion = LazyCompletion ) def get_comments( self ): status, headers, data = self.__requester.request( @@ -458,7 +458,7 @@ class Repository( object ): None, None ) - return Commit.Commit( self.__requester, data, lazy = True ) + return Commit.Commit( self.__requester, data, completion = LazyCompletion ) def get_commits( self, sha = DefaultValueForOptionalParameters, path = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( @@ -495,7 +495,7 @@ class Repository( object ): None, None ) - return Download.Download( self.__requester, data, lazy = True ) + return Download.Download( self.__requester, data, completion = LazyCompletion ) def get_downloads( self ): status, headers, data = self.__requester.request( @@ -546,7 +546,7 @@ class Repository( object ): None, None ) - return GitBlob.GitBlob( self.__requester, data, lazy = True ) + return GitBlob.GitBlob( self.__requester, data, completion = LazyCompletion ) def get_git_commit( self, sha ): status, headers, data = self.__requester.request( @@ -555,7 +555,7 @@ class Repository( object ): None, None ) - return GitCommit.GitCommit( self.__requester, data, lazy = True ) + return GitCommit.GitCommit( self.__requester, data, completion = LazyCompletion ) def get_git_ref( self, ref ): status, headers, data = self.__requester.request( @@ -564,7 +564,7 @@ class Repository( object ): None, None ) - return GitRef.GitRef( self.__requester, data, lazy = True ) + return GitRef.GitRef( self.__requester, data, completion = LazyCompletion ) def get_git_refs( self ): status, headers, data = self.__requester.request( @@ -587,7 +587,7 @@ class Repository( object ): None, None ) - return GitTag.GitTag( self.__requester, data, lazy = True ) + return GitTag.GitTag( self.__requester, data, completion = LazyCompletion ) def get_git_tree( self, sha, recursive = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( @@ -596,7 +596,7 @@ class Repository( object ): None, None ) - return GitTree.GitTree( self.__requester, data, lazy = True ) + return GitTree.GitTree( self.__requester, data, completion = LazyCompletion ) def get_hook( self, id ): status, headers, data = self.__requester.request( @@ -605,7 +605,7 @@ class Repository( object ): None, None ) - return Hook.Hook( self.__requester, data, lazy = True ) + return Hook.Hook( self.__requester, data, completion = LazyCompletion ) def get_hooks( self ): status, headers, data = self.__requester.request( @@ -628,7 +628,7 @@ class Repository( object ): None, None ) - return Issue.Issue( self.__requester, data, lazy = True ) + return Issue.Issue( self.__requester, data, completion = LazyCompletion ) def get_issues( self, milestone = DefaultValueForOptionalParameters, state = DefaultValueForOptionalParameters, assignee = DefaultValueForOptionalParameters, mentioned = DefaultValueForOptionalParameters, labels = DefaultValueForOptionalParameters, sort = DefaultValueForOptionalParameters, direction = DefaultValueForOptionalParameters, since = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( @@ -651,7 +651,7 @@ class Repository( object ): None, None ) - return IssueEvent.IssueEvent( self.__requester, data, lazy = True ) + return IssueEvent.IssueEvent( self.__requester, data, completion = LazyCompletion ) def get_issues_events( self ): status, headers, data = self.__requester.request( @@ -674,7 +674,7 @@ class Repository( object ): None, None ) - return RepositoryKey.RepositoryKey( self.__requester, data, lazy = True ) + return RepositoryKey.RepositoryKey( self.__requester, data, completion = LazyCompletion ) def get_keys( self ): status, headers, data = self.__requester.request( @@ -697,7 +697,7 @@ class Repository( object ): None, None ) - return Label.Label( self.__requester, data, lazy = True ) + return Label.Label( self.__requester, data, completion = LazyCompletion ) def get_labels( self ): status, headers, data = self.__requester.request( @@ -729,7 +729,7 @@ class Repository( object ): None, None ) - return Milestone.Milestone( self.__requester, data, lazy = True ) + return Milestone.Milestone( self.__requester, data, completion = LazyCompletion ) def get_milestones( self, state = DefaultValueForOptionalParameters, sort = DefaultValueForOptionalParameters, direction = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( @@ -766,7 +766,7 @@ class Repository( object ): None, None ) - return PullRequest.PullRequest( self.__requester, data, lazy = True ) + return PullRequest.PullRequest( self.__requester, data, completion = LazyCompletion ) def get_pulls( self, state = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( @@ -950,16 +950,16 @@ class Repository( object ): self.__open_issues = attributes[ "open_issues" ] if "organization" in attributes and attributes[ "organization" ] is not None: assert isinstance( attributes[ "organization" ], dict ) - self.__organization = Organization.Organization( self.__requester, attributes[ "organization" ], lazy = True ) + self.__organization = Organization.Organization( self.__requester, attributes[ "organization" ], completion = LazyCompletion ) if "owner" in attributes and attributes[ "owner" ] is not None: assert isinstance( attributes[ "owner" ], dict ) - self.__owner = NamedUser.NamedUser( self.__requester, attributes[ "owner" ], lazy = True ) + self.__owner = NamedUser.NamedUser( self.__requester, attributes[ "owner" ], completion = LazyCompletion ) if "parent" in attributes and attributes[ "parent" ] is not None: assert isinstance( attributes[ "parent" ], dict ) - self.__parent = Repository( self.__requester, attributes[ "parent" ], lazy = True ) + self.__parent = Repository( self.__requester, attributes[ "parent" ], completion = LazyCompletion ) if "permissions" in attributes and attributes[ "permissions" ] is not None: assert isinstance( attributes[ "permissions" ], dict ) - self.__permissions = Permissions.Permissions( self.__requester, attributes[ "permissions" ], lazy = True ) + self.__permissions = Permissions.Permissions( self.__requester, attributes[ "permissions" ], completion = LazyCompletion ) if "private" in attributes and attributes[ "private" ] is not None: assert isinstance( attributes[ "private" ], bool ) self.__private = attributes[ "private" ] @@ -971,7 +971,7 @@ class Repository( object ): self.__size = attributes[ "size" ] if "source" in attributes and attributes[ "source" ] is not None: assert isinstance( attributes[ "source" ], dict ) - self.__source = Repository( self.__requester, attributes[ "source" ], lazy = True ) + self.__source = Repository( self.__requester, attributes[ "source" ], completion = LazyCompletion ) if "ssh_url" in attributes and attributes[ "ssh_url" ] is not None: assert isinstance( attributes[ "ssh_url" ], ( str, unicode ) ) self.__ssh_url = attributes[ "ssh_url" ] diff --git a/src/github/RepositoryKey.py b/src/github/RepositoryKey.py index 6d573731..970570d3 100644 --- a/src/github/RepositoryKey.py +++ b/src/github/RepositoryKey.py @@ -5,12 +5,12 @@ import PaginatedList from GithubObject import * class RepositoryKey( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property diff --git a/src/github/Tag.py b/src/github/Tag.py index 9b0ef69b..0755fa6b 100644 --- a/src/github/Tag.py +++ b/src/github/Tag.py @@ -6,9 +6,9 @@ from GithubObject import * import Commit class Tag( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) @@ -41,7 +41,7 @@ class Tag( object ): # @todo No need to check if attribute is in attributes when attribute is mandatory if "commit" in attributes and attributes[ "commit" ] is not None: assert isinstance( attributes[ "commit" ], dict ) - self.__commit = Commit.Commit( self.__requester, attributes[ "commit" ], lazy = True ) + self.__commit = Commit.Commit( self.__requester, attributes[ "commit" ], completion = LazyCompletion ) if "name" in attributes and attributes[ "name" ] is not None: self.__name = attributes[ "name" ] if "tarball_url" in attributes and attributes[ "tarball_url" ] is not None: diff --git a/src/github/Team.py b/src/github/Team.py index 4e70d19e..f270b535 100644 --- a/src/github/Team.py +++ b/src/github/Team.py @@ -7,12 +7,12 @@ import Repository import NamedUser class Team( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property diff --git a/src/github/UserKey.py b/src/github/UserKey.py index 3f3fd346..da1f1913 100644 --- a/src/github/UserKey.py +++ b/src/github/UserKey.py @@ -5,12 +5,12 @@ import PaginatedList from GithubObject import * class UserKey( object ): - def __init__( self, requester, attributes, lazy ): + def __init__( self, requester, attributes, completion ): self.__requester = requester - self.__completed = False + self.__completed = completion != LazyCompletion self.__initAttributes() self.__useAttributes( attributes ) - if not lazy: + if completion == ImmediateCompletion: self.__complete() @property