diff --git a/CodeGenerator/templates/GithubObject.py b/CodeGenerator/templates/GithubObject.py index 7e6e9d10..957fe2b5 100644 --- a/CodeGenerator/templates/GithubObject.py +++ b/CodeGenerator/templates/GithubObject.py @@ -90,7 +90,13 @@ class {{ class.name }}( object ): {% endfor %} def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory {% for attribute in class.attributes %} if "{{ attribute.name }}" in attributes: +{% 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.__github, attributes[ "{{ attribute.name }}" ], lazy = True ) +{% endif %} + {% endfor %} diff --git a/github/GithubObjects/AuthenticatedUser.py b/github/GithubObjects/AuthenticatedUser.py index f8bb20a0..918b6d29 100644 --- a/github/GithubObjects/AuthenticatedUser.py +++ b/github/GithubObjects/AuthenticatedUser.py @@ -404,6 +404,7 @@ class AuthenticatedUser( object ): pass def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "avatar_url" in attributes: self.__avatar_url = attributes[ "avatar_url" ] if "bio" in attributes: diff --git a/github/GithubObjects/Authorization.py b/github/GithubObjects/Authorization.py index 7f3a3bb8..dcd9482c 100644 --- a/github/GithubObjects/Authorization.py +++ b/github/GithubObjects/Authorization.py @@ -107,6 +107,7 @@ class Authorization( object ): self.__useAttributes( result ) def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "app" in attributes: self.__app = attributes[ "app" ] if "created_at" in attributes: diff --git a/github/GithubObjects/Branch.py b/github/GithubObjects/Branch.py index 367f9d6f..45e1e762 100644 --- a/github/GithubObjects/Branch.py +++ b/github/GithubObjects/Branch.py @@ -42,7 +42,8 @@ class Branch( object ): self.__completed = True def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "commit" in attributes: - self.__commit = attributes[ "commit" ] + self.__commit = Commit.Commit( self.__github, attributes[ "commit" ], lazy = True ) if "name" in attributes: self.__name = attributes[ "name" ] diff --git a/github/GithubObjects/Commit.py b/github/GithubObjects/Commit.py index 987f2e2f..4aa2c446 100644 --- a/github/GithubObjects/Commit.py +++ b/github/GithubObjects/Commit.py @@ -95,12 +95,13 @@ class Commit( object ): ] def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "author" in attributes: - self.__author = attributes[ "author" ] + self.__author = NamedUser.NamedUser( self.__github, attributes[ "author" ], lazy = True ) if "commit" in attributes: - self.__commit = attributes[ "commit" ] + self.__commit = GitCommit.GitCommit( self.__github, attributes[ "commit" ], lazy = True ) if "committer" in attributes: - self.__committer = attributes[ "committer" ] + self.__committer = NamedUser.NamedUser( self.__github, attributes[ "committer" ], lazy = True ) if "files" in attributes: self.__files = attributes[ "files" ] if "parents" in attributes: diff --git a/github/GithubObjects/CommitComment.py b/github/GithubObjects/CommitComment.py index 9abe433c..7c0b18ff 100644 --- a/github/GithubObjects/CommitComment.py +++ b/github/GithubObjects/CommitComment.py @@ -111,6 +111,7 @@ class CommitComment( object ): self.__useAttributes( result ) def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "body" in attributes: self.__body = attributes[ "body" ] if "commit_id" in attributes: @@ -132,4 +133,4 @@ class CommitComment( object ): if "url" in attributes: self.__url = attributes[ "url" ] if "user" in attributes: - self.__user = attributes[ "user" ] + self.__user = NamedUser.NamedUser( self.__github, attributes[ "user" ], lazy = True ) diff --git a/github/GithubObjects/Download.py b/github/GithubObjects/Download.py index 4b503dfc..dad69f9a 100644 --- a/github/GithubObjects/Download.py +++ b/github/GithubObjects/Download.py @@ -152,6 +152,7 @@ class Download( object ): pass def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "accesskeyid" in attributes: self.__accesskeyid = attributes[ "accesskeyid" ] if "acl" in attributes: diff --git a/github/GithubObjects/Event.py b/github/GithubObjects/Event.py index c2c3fe7d..9018dc83 100644 --- a/github/GithubObjects/Event.py +++ b/github/GithubObjects/Event.py @@ -104,8 +104,9 @@ class Event( object ): self.__completed = True def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "actor" in attributes: - self.__actor = attributes[ "actor" ] + self.__actor = NamedUser.NamedUser( self.__github, attributes[ "actor" ], lazy = True ) if "commit_id" in attributes: self.__commit_id = attributes[ "commit_id" ] if "created_at" in attributes: @@ -117,13 +118,13 @@ class Event( object ): if "issue" in attributes: self.__issue = attributes[ "issue" ] if "org" in attributes: - self.__org = attributes[ "org" ] + self.__org = Organization.Organization( self.__github, attributes[ "org" ], lazy = True ) if "payload" in attributes: self.__payload = attributes[ "payload" ] if "public" in attributes: self.__public = attributes[ "public" ] if "repo" in attributes: - self.__repo = attributes[ "repo" ] + self.__repo = Repository.Repository( self.__github, attributes[ "repo" ], lazy = True ) if "type" in attributes: self.__type = attributes[ "type" ] if "url" in attributes: diff --git a/github/GithubObjects/Gist.py b/github/GithubObjects/Gist.py index f509b43e..9e698525 100644 --- a/github/GithubObjects/Gist.py +++ b/github/GithubObjects/Gist.py @@ -164,6 +164,7 @@ class Gist( object ): pass def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "comments" in attributes: self.__comments = attributes[ "comments" ] if "created_at" in attributes: @@ -191,4 +192,4 @@ class Gist( object ): if "url" in attributes: self.__url = attributes[ "url" ] if "user" in attributes: - self.__user = attributes[ "user" ] + self.__user = NamedUser.NamedUser( self.__github, attributes[ "user" ], lazy = True ) diff --git a/github/GithubObjects/GistComment.py b/github/GithubObjects/GistComment.py index 2d6dccc9..5a5dcdd8 100644 --- a/github/GithubObjects/GistComment.py +++ b/github/GithubObjects/GistComment.py @@ -81,6 +81,7 @@ class GistComment( object ): self.__useAttributes( result ) def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "body" in attributes: self.__body = attributes[ "body" ] if "created_at" in attributes: @@ -92,4 +93,4 @@ class GistComment( object ): if "url" in attributes: self.__url = attributes[ "url" ] if "user" in attributes: - self.__user = attributes[ "user" ] + self.__user = NamedUser.NamedUser( self.__github, attributes[ "user" ], lazy = True ) diff --git a/github/GithubObjects/GitBlob.py b/github/GithubObjects/GitBlob.py index 782abef4..307442ca 100644 --- a/github/GithubObjects/GitBlob.py +++ b/github/GithubObjects/GitBlob.py @@ -59,6 +59,7 @@ class GitBlob( object ): self.__completed = True def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "content" in attributes: self.__content = attributes[ "content" ] if "encoding" in attributes: diff --git a/github/GithubObjects/GitCommit.py b/github/GithubObjects/GitCommit.py index cd6769e2..c51297f1 100644 --- a/github/GithubObjects/GitCommit.py +++ b/github/GithubObjects/GitCommit.py @@ -72,6 +72,7 @@ class GitCommit( object ): self.__completed = True def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "author" in attributes: self.__author = attributes[ "author" ] if "committer" in attributes: @@ -83,6 +84,6 @@ class GitCommit( object ): if "sha" in attributes: self.__sha = attributes[ "sha" ] if "tree" in attributes: - self.__tree = attributes[ "tree" ] + self.__tree = GitTree.GitTree( self.__github, attributes[ "tree" ], lazy = True ) if "url" in attributes: self.__url = attributes[ "url" ] diff --git a/github/GithubObjects/GitRef.py b/github/GithubObjects/GitRef.py index 69810a0c..31ee1caa 100644 --- a/github/GithubObjects/GitRef.py +++ b/github/GithubObjects/GitRef.py @@ -64,6 +64,7 @@ class GitRef( object ): self.__useAttributes( result ) def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "object" in attributes: self.__object = attributes[ "object" ] if "ref" in attributes: diff --git a/github/GithubObjects/GitTag.py b/github/GithubObjects/GitTag.py index ced9dadf..7bf472ac 100644 --- a/github/GithubObjects/GitTag.py +++ b/github/GithubObjects/GitTag.py @@ -65,6 +65,7 @@ class GitTag( object ): self.__completed = True def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "message" in attributes: self.__message = attributes[ "message" ] if "object" in attributes: diff --git a/github/GithubObjects/GitTree.py b/github/GithubObjects/GitTree.py index 60c05182..a42e5926 100644 --- a/github/GithubObjects/GitTree.py +++ b/github/GithubObjects/GitTree.py @@ -53,6 +53,7 @@ class GitTree( object ): self.__completed = True def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "recursive" in attributes: self.__recursive = attributes[ "recursive" ] if "sha" in attributes: diff --git a/github/GithubObjects/Hook.py b/github/GithubObjects/Hook.py index 64dd7bd0..db3f4419 100644 --- a/github/GithubObjects/Hook.py +++ b/github/GithubObjects/Hook.py @@ -110,6 +110,7 @@ class Hook( object ): pass def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "active" in attributes: self.__active = attributes[ "active" ] if "config" in attributes: diff --git a/github/GithubObjects/Issue.py b/github/GithubObjects/Issue.py index 17ee302d..fc2c4048 100644 --- a/github/GithubObjects/Issue.py +++ b/github/GithubObjects/Issue.py @@ -213,8 +213,9 @@ class Issue( object ): pass def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "assignee" in attributes: - self.__assignee = attributes[ "assignee" ] + self.__assignee = NamedUser.NamedUser( self.__github, attributes[ "assignee" ], lazy = True ) if "body" in attributes: self.__body = attributes[ "body" ] if "closed_at" in attributes: @@ -232,7 +233,7 @@ class Issue( object ): if "labels" in attributes: self.__labels = attributes[ "labels" ] if "milestone" in attributes: - self.__milestone = attributes[ "milestone" ] + self.__milestone = Milestone.Milestone( self.__github, attributes[ "milestone" ], lazy = True ) if "number" in attributes: self.__number = attributes[ "number" ] if "pull_request" in attributes: @@ -246,4 +247,4 @@ class Issue( object ): if "url" in attributes: self.__url = attributes[ "url" ] if "user" in attributes: - self.__user = attributes[ "user" ] + self.__user = NamedUser.NamedUser( self.__github, attributes[ "user" ], lazy = True ) diff --git a/github/GithubObjects/IssueComment.py b/github/GithubObjects/IssueComment.py index ba7b840f..1f28970f 100644 --- a/github/GithubObjects/IssueComment.py +++ b/github/GithubObjects/IssueComment.py @@ -81,6 +81,7 @@ class IssueComment( object ): self.__useAttributes( result ) def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "body" in attributes: self.__body = attributes[ "body" ] if "created_at" in attributes: @@ -92,4 +93,4 @@ class IssueComment( object ): if "url" in attributes: self.__url = attributes[ "url" ] if "user" in attributes: - self.__user = attributes[ "user" ] + self.__user = NamedUser.NamedUser( self.__github, attributes[ "user" ], lazy = True ) diff --git a/github/GithubObjects/IssueEvent.py b/github/GithubObjects/IssueEvent.py index b13adc34..2b582736 100644 --- a/github/GithubObjects/IssueEvent.py +++ b/github/GithubObjects/IssueEvent.py @@ -72,8 +72,9 @@ class IssueEvent( object ): self.__completed = True def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "actor" in attributes: - self.__actor = attributes[ "actor" ] + self.__actor = NamedUser.NamedUser( self.__github, attributes[ "actor" ], lazy = True ) if "commit_id" in attributes: self.__commit_id = attributes[ "commit_id" ] if "created_at" in attributes: diff --git a/github/GithubObjects/Label.py b/github/GithubObjects/Label.py index 480f22ca..1c362780 100644 --- a/github/GithubObjects/Label.py +++ b/github/GithubObjects/Label.py @@ -63,6 +63,7 @@ class Label( object ): self.__useAttributes( result ) def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "color" in attributes: self.__color = attributes[ "color" ] if "name" in attributes: diff --git a/github/GithubObjects/Milestone.py b/github/GithubObjects/Milestone.py index 990b7cb7..deb22ffa 100644 --- a/github/GithubObjects/Milestone.py +++ b/github/GithubObjects/Milestone.py @@ -124,12 +124,13 @@ class Milestone( object ): ] def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "closed_issues" in attributes: self.__closed_issues = attributes[ "closed_issues" ] if "created_at" in attributes: self.__created_at = attributes[ "created_at" ] if "creator" in attributes: - self.__creator = attributes[ "creator" ] + self.__creator = NamedUser.NamedUser( self.__github, attributes[ "creator" ], lazy = True ) if "description" in attributes: self.__description = attributes[ "description" ] if "due_on" in attributes: diff --git a/github/GithubObjects/NamedUser.py b/github/GithubObjects/NamedUser.py index b74ca93f..658f994c 100644 --- a/github/GithubObjects/NamedUser.py +++ b/github/GithubObjects/NamedUser.py @@ -289,6 +289,7 @@ class NamedUser( object ): ] def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "avatar_url" in attributes: self.__avatar_url = attributes[ "avatar_url" ] if "bio" in attributes: diff --git a/github/GithubObjects/Organization.py b/github/GithubObjects/Organization.py index 8b72376f..6d0af8fe 100644 --- a/github/GithubObjects/Organization.py +++ b/github/GithubObjects/Organization.py @@ -287,6 +287,7 @@ class Organization( object ): pass def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "avatar_url" in attributes: self.__avatar_url = attributes[ "avatar_url" ] if "billing_email" in attributes: diff --git a/github/GithubObjects/PullRequest.py b/github/GithubObjects/PullRequest.py index a05ac0e9..d222eb77 100644 --- a/github/GithubObjects/PullRequest.py +++ b/github/GithubObjects/PullRequest.py @@ -251,6 +251,7 @@ class PullRequest( object ): pass def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "additions" in attributes: self.__additions = attributes[ "additions" ] if "base" in attributes: @@ -302,4 +303,4 @@ class PullRequest( object ): if "url" in attributes: self.__url = attributes[ "url" ] if "user" in attributes: - self.__user = attributes[ "user" ] + self.__user = NamedUser.NamedUser( self.__github, attributes[ "user" ], lazy = True ) diff --git a/github/GithubObjects/PullRequestComment.py b/github/GithubObjects/PullRequestComment.py index dee95122..a1b3d20e 100644 --- a/github/GithubObjects/PullRequestComment.py +++ b/github/GithubObjects/PullRequestComment.py @@ -111,6 +111,7 @@ class PullRequestComment( object ): self.__useAttributes( result ) def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "body" in attributes: self.__body = attributes[ "body" ] if "commit_id" in attributes: @@ -132,4 +133,4 @@ class PullRequestComment( object ): if "url" in attributes: self.__url = attributes[ "url" ] if "user" in attributes: - self.__user = attributes[ "user" ] + self.__user = NamedUser.NamedUser( self.__github, attributes[ "user" ], lazy = True ) diff --git a/github/GithubObjects/PullRequestFile.py b/github/GithubObjects/PullRequestFile.py index 1f279df0..55d00fef 100644 --- a/github/GithubObjects/PullRequestFile.py +++ b/github/GithubObjects/PullRequestFile.py @@ -83,6 +83,7 @@ class PullRequestFile( object ): self.__completed = True def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "additions" in attributes: self.__additions = attributes[ "additions" ] if "blob_url" in attributes: diff --git a/github/GithubObjects/Repository.py b/github/GithubObjects/Repository.py index f4e6b4d5..d4a8d80a 100644 --- a/github/GithubObjects/Repository.py +++ b/github/GithubObjects/Repository.py @@ -578,6 +578,7 @@ class Repository( object ): pass def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "clone_url" in attributes: self.__clone_url = attributes[ "clone_url" ] if "created_at" in attributes: @@ -615,9 +616,9 @@ class Repository( object ): if "organization" in attributes: self.__organization = attributes[ "organization" ] if "owner" in attributes: - self.__owner = attributes[ "owner" ] + self.__owner = NamedUser.NamedUser( self.__github, attributes[ "owner" ], lazy = True ) if "parent" in attributes: - self.__parent = attributes[ "parent" ] + self.__parent = Repository( self.__github, attributes[ "parent" ], lazy = True ) if "permissions" in attributes: self.__permissions = attributes[ "permissions" ] if "private" in attributes: @@ -627,7 +628,7 @@ class Repository( object ): if "size" in attributes: self.__size = attributes[ "size" ] if "source" in attributes: - self.__source = attributes[ "source" ] + self.__source = Repository( self.__github, attributes[ "source" ], lazy = True ) if "ssh_url" in attributes: self.__ssh_url = attributes[ "ssh_url" ] if "svn_url" in attributes: diff --git a/github/GithubObjects/RepositoryKey.py b/github/GithubObjects/RepositoryKey.py index a9b0ddcd..535d7081 100644 --- a/github/GithubObjects/RepositoryKey.py +++ b/github/GithubObjects/RepositoryKey.py @@ -69,6 +69,7 @@ class RepositoryKey( object ): self.__useAttributes( result ) def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "id" in attributes: self.__id = attributes[ "id" ] if "key" in attributes: diff --git a/github/GithubObjects/Tag.py b/github/GithubObjects/Tag.py index e1bf9017..7a7f1fac 100644 --- a/github/GithubObjects/Tag.py +++ b/github/GithubObjects/Tag.py @@ -54,8 +54,9 @@ class Tag( object ): self.__completed = True def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "commit" in attributes: - self.__commit = attributes[ "commit" ] + self.__commit = Commit.Commit( self.__github, attributes[ "commit" ], lazy = True ) if "name" in attributes: self.__name = attributes[ "name" ] if "tarball_url" in attributes: diff --git a/github/GithubObjects/Team.py b/github/GithubObjects/Team.py index 00842601..feb837f4 100644 --- a/github/GithubObjects/Team.py +++ b/github/GithubObjects/Team.py @@ -126,6 +126,7 @@ class Team( object ): pass def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "id" in attributes: self.__id = attributes[ "id" ] if "members_count" in attributes: diff --git a/github/GithubObjects/UserKey.py b/github/GithubObjects/UserKey.py index 77dfe80e..28c5b80b 100644 --- a/github/GithubObjects/UserKey.py +++ b/github/GithubObjects/UserKey.py @@ -71,6 +71,7 @@ class UserKey( object ): self.__useAttributes( result ) def __useAttributes( self, attributes ): + #@todo No need to check if attribute is in attributes when attribute is mandatory if "id" in attributes: self.__id = attributes[ "id" ] if "key" in attributes: