diff --git a/codegen/templates/GithubObject.py b/codegen/templates/GithubObject.py index 741e24b7..6ee14ba4 100644 --- a/codegen/templates/GithubObject.py +++ b/codegen/templates/GithubObject.py @@ -68,7 +68,11 @@ class {{ class.name }}( object ): {% endif %} def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ {% for attribute in class.attributes|dictsort:"name" %}"{{ attribute.name }}", {% endfor %}] + + # @todo No need to check if attribute is in attributes when attribute is mandatory {% for attribute in class.attributes|dictsort:"name" %} if "{{ attribute.name }}" in attributes and attributes[ "{{ attribute.name }}" ] is not None: diff --git a/src/github/AuthenticatedUser.py b/src/github/AuthenticatedUser.py index 14a73dc1..21f7ccb7 100644 --- a/src/github/AuthenticatedUser.py +++ b/src/github/AuthenticatedUser.py @@ -570,7 +570,10 @@ class AuthenticatedUser( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "avatar_url", "bio", "blog", "collaborators", "company", "created_at", "disk_usage", "email", "followers", "following", "gravatar_id", "hireable", "html_url", "id", "location", "login", "name", "owned_private_repos", "plan", "private_gists", "public_gists", "public_repos", "total_private_repos", "type", "url", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "avatar_url" in attributes and attributes[ "avatar_url" ] is not None: assert isinstance( attributes[ "avatar_url" ], ( str, unicode ) ) self.__avatar_url = attributes[ "avatar_url" ] diff --git a/src/github/Authorization.py b/src/github/Authorization.py index 5926229f..37798c84 100644 --- a/src/github/Authorization.py +++ b/src/github/Authorization.py @@ -117,7 +117,10 @@ class Authorization( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "app", "created_at", "id", "note", "note_url", "scopes", "token", "updated_at", "url", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "app" in attributes and attributes[ "app" ] is not None: self.__app = attributes[ "app" ] if "created_at" in attributes and attributes[ "created_at" ] is not None: diff --git a/src/github/Branch.py b/src/github/Branch.py index be8e60dc..393c096a 100644 --- a/src/github/Branch.py +++ b/src/github/Branch.py @@ -29,7 +29,10 @@ class Branch( object ): self.__name = None def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "commit", "name", ] + # @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 ) diff --git a/src/github/Commit.py b/src/github/Commit.py index 8ca86b15..77621c35 100644 --- a/src/github/Commit.py +++ b/src/github/Commit.py @@ -122,7 +122,10 @@ class Commit( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "author", "commit", "committer", "files", "parents", "sha", "stats", "url", ] + # @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 ) diff --git a/src/github/CommitComment.py b/src/github/CommitComment.py index 924890d9..88f02659 100644 --- a/src/github/CommitComment.py +++ b/src/github/CommitComment.py @@ -121,7 +121,10 @@ class CommitComment( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "body", "commit_id", "created_at", "html_url", "id", "line", "path", "position", "updated_at", "url", "user", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "body" in attributes and attributes[ "body" ] is not None: self.__body = attributes[ "body" ] if "commit_id" in attributes and attributes[ "commit_id" ] is not None: diff --git a/src/github/CommitFile.py b/src/github/CommitFile.py index 56a74354..02d3777d 100644 --- a/src/github/CommitFile.py +++ b/src/github/CommitFile.py @@ -63,7 +63,10 @@ class CommitFile( object ): self.__status = None def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "additions", "blob_url", "changes", "deletions", "filename", "patch", "raw_url", "sha", "status", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "additions" in attributes and attributes[ "additions" ] is not None: self.__additions = attributes[ "additions" ] if "blob_url" in attributes and attributes[ "blob_url" ] is not None: diff --git a/src/github/CommitStats.py b/src/github/CommitStats.py index 8cda88c0..ab48c3bf 100644 --- a/src/github/CommitStats.py +++ b/src/github/CommitStats.py @@ -33,7 +33,10 @@ class CommitStats( object ): self.__total = None def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "additions", "deletions", "total", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "additions" in attributes and attributes[ "additions" ] is not None: assert isinstance( attributes[ "additions" ], int ) self.__additions = attributes[ "additions" ] diff --git a/src/github/Download.py b/src/github/Download.py index 3ab6343d..d6ea7263 100644 --- a/src/github/Download.py +++ b/src/github/Download.py @@ -162,7 +162,10 @@ class Download( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "accesskeyid", "acl", "bucket", "content_type", "created_at", "description", "download_count", "expirationdate", "html_url", "id", "mime_type", "name", "path", "policy", "prefix", "redirect", "s3_url", "signature", "size", "url", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "accesskeyid" in attributes and attributes[ "accesskeyid" ] is not None: self.__accesskeyid = attributes[ "accesskeyid" ] if "acl" in attributes and attributes[ "acl" ] is not None: diff --git a/src/github/Event.py b/src/github/Event.py index 07040616..95ea45d0 100644 --- a/src/github/Event.py +++ b/src/github/Event.py @@ -109,7 +109,10 @@ class Event( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "actor", "commit_id", "created_at", "event", "id", "issue", "org", "payload", "public", "repo", "type", "url", ] + # @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 ) diff --git a/src/github/Gist.py b/src/github/Gist.py index 8819f148..d1a885bf 100644 --- a/src/github/Gist.py +++ b/src/github/Gist.py @@ -213,7 +213,10 @@ class Gist( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "comments", "created_at", "description", "files", "forks", "git_pull_url", "git_push_url", "history", "html_url", "id", "public", "updated_at", "url", "user", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "comments" in attributes and attributes[ "comments" ] is not None: self.__comments = attributes[ "comments" ] if "created_at" in attributes and attributes[ "created_at" ] is not None: diff --git a/src/github/GistComment.py b/src/github/GistComment.py index 44e02f22..dce4698d 100644 --- a/src/github/GistComment.py +++ b/src/github/GistComment.py @@ -91,7 +91,10 @@ class GistComment( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "body", "created_at", "id", "updated_at", "url", "user", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "body" in attributes and attributes[ "body" ] is not None: self.__body = attributes[ "body" ] if "created_at" in attributes and attributes[ "created_at" ] is not None: diff --git a/src/github/GitAuthor.py b/src/github/GitAuthor.py index ca6a3c61..954678f7 100644 --- a/src/github/GitAuthor.py +++ b/src/github/GitAuthor.py @@ -33,7 +33,10 @@ class GitAuthor( object ): self.__name = None def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "date", "email", "name", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "date" in attributes and attributes[ "date" ] is not None: assert isinstance( attributes[ "date" ], ( str, unicode ) ) self.__date = attributes[ "date" ] diff --git a/src/github/GitBlob.py b/src/github/GitBlob.py index 011333ca..9b5edc94 100644 --- a/src/github/GitBlob.py +++ b/src/github/GitBlob.py @@ -64,7 +64,10 @@ class GitBlob( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "content", "encoding", "sha", "size", "url", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "content" in attributes and attributes[ "content" ] is not None: assert isinstance( attributes[ "content" ], ( str, unicode ) ) self.__content = attributes[ "content" ] diff --git a/src/github/GitCommit.py b/src/github/GitCommit.py index 260ef2d7..c2caf05f 100644 --- a/src/github/GitCommit.py +++ b/src/github/GitCommit.py @@ -79,7 +79,10 @@ class GitCommit( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "author", "committer", "message", "parents", "sha", "tree", "url", ] + # @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 ) diff --git a/src/github/GitObject.py b/src/github/GitObject.py index 5893f22c..803872ce 100644 --- a/src/github/GitObject.py +++ b/src/github/GitObject.py @@ -52,7 +52,10 @@ class GitObject( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "sha", "type", "url", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "sha" in attributes and attributes[ "sha" ] is not None: assert isinstance( attributes[ "sha" ], ( str, unicode ) ) self.__sha = attributes[ "sha" ] diff --git a/src/github/GitRef.py b/src/github/GitRef.py index 8437f216..ca632ac6 100644 --- a/src/github/GitRef.py +++ b/src/github/GitRef.py @@ -75,7 +75,10 @@ class GitRef( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "object", "ref", "url", ] + # @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 ) diff --git a/src/github/GitTag.py b/src/github/GitTag.py index 22fec82c..2564da7b 100644 --- a/src/github/GitTag.py +++ b/src/github/GitTag.py @@ -72,7 +72,10 @@ class GitTag( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "message", "object", "sha", "tag", "tagger", "url", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "message" in attributes and attributes[ "message" ] is not None: assert isinstance( attributes[ "message" ], ( str, unicode ) ) self.__message = attributes[ "message" ] diff --git a/src/github/GitTree.py b/src/github/GitTree.py index 54fedb09..a2c648a0 100644 --- a/src/github/GitTree.py +++ b/src/github/GitTree.py @@ -52,7 +52,10 @@ class GitTree( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "sha", "tree", "url", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "sha" in attributes and attributes[ "sha" ] is not None: assert isinstance( attributes[ "sha" ], ( str, unicode ) ) self.__sha = attributes[ "sha" ] diff --git a/src/github/Hook.py b/src/github/Hook.py index c78508a7..63421c9a 100644 --- a/src/github/Hook.py +++ b/src/github/Hook.py @@ -125,7 +125,10 @@ class Hook( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "active", "config", "created_at", "events", "id", "last_response", "name", "updated_at", "url", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "active" in attributes and attributes[ "active" ] is not None: self.__active = attributes[ "active" ] if "config" in attributes and attributes[ "config" ] is not None: diff --git a/src/github/Issue.py b/src/github/Issue.py index d8a5d911..eb3d60e7 100644 --- a/src/github/Issue.py +++ b/src/github/Issue.py @@ -250,7 +250,10 @@ class Issue( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "assignee", "body", "closed_at", "closed_by", "comments", "created_at", "html_url", "id", "labels", "milestone", "number", "pull_request", "state", "title", "updated_at", "url", "user", ] + # @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 ) diff --git a/src/github/IssueComment.py b/src/github/IssueComment.py index b5ea2f47..35fc3194 100644 --- a/src/github/IssueComment.py +++ b/src/github/IssueComment.py @@ -91,7 +91,10 @@ class IssueComment( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "body", "created_at", "id", "updated_at", "url", "user", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "body" in attributes and attributes[ "body" ] is not None: self.__body = attributes[ "body" ] if "created_at" in attributes and attributes[ "created_at" ] is not None: diff --git a/src/github/IssueEvent.py b/src/github/IssueEvent.py index 33f4e7c7..6d5ba4fd 100644 --- a/src/github/IssueEvent.py +++ b/src/github/IssueEvent.py @@ -77,7 +77,10 @@ class IssueEvent( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "actor", "commit_id", "created_at", "event", "id", "issue", "url", ] + # @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 ) diff --git a/src/github/Label.py b/src/github/Label.py index edde408e..5ebccdde 100644 --- a/src/github/Label.py +++ b/src/github/Label.py @@ -73,7 +73,10 @@ class Label( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "color", "name", "url", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "color" in attributes and attributes[ "color" ] is not None: self.__color = attributes[ "color" ] if "name" in attributes and attributes[ "name" ] is not None: diff --git a/src/github/Milestone.py b/src/github/Milestone.py index 5a82cbbb..8199f3d5 100644 --- a/src/github/Milestone.py +++ b/src/github/Milestone.py @@ -136,7 +136,10 @@ class Milestone( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "closed_issues", "created_at", "creator", "description", "due_on", "number", "open_issues", "state", "title", "url", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "closed_issues" in attributes and attributes[ "closed_issues" ] is not None: self.__closed_issues = attributes[ "closed_issues" ] if "created_at" in attributes and attributes[ "created_at" ] is not None: diff --git a/src/github/NamedUser.py b/src/github/NamedUser.py index 4c71f849..8afcffbd 100644 --- a/src/github/NamedUser.py +++ b/src/github/NamedUser.py @@ -364,7 +364,10 @@ class NamedUser( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "avatar_url", "bio", "blog", "collaborators", "company", "contributions", "created_at", "disk_usage", "email", "followers", "following", "gravatar_id", "hireable", "html_url", "id", "location", "login", "name", "owned_private_repos", "plan", "private_gists", "public_gists", "public_repos", "total_private_repos", "type", "url", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "avatar_url" in attributes and attributes[ "avatar_url" ] is not None: self.__avatar_url = attributes[ "avatar_url" ] if "bio" in attributes and attributes[ "bio" ] is not None: diff --git a/src/github/Organization.py b/src/github/Organization.py index bdd1e1e0..a3e3c726 100644 --- a/src/github/Organization.py +++ b/src/github/Organization.py @@ -381,7 +381,10 @@ class Organization( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "avatar_url", "billing_email", "blog", "collaborators", "company", "created_at", "disk_usage", "email", "followers", "following", "gravatar_id", "html_url", "id", "location", "login", "name", "owned_private_repos", "plan", "private_gists", "public_gists", "public_repos", "total_private_repos", "type", "url", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "avatar_url" in attributes and attributes[ "avatar_url" ] is not None: assert isinstance( attributes[ "avatar_url" ], ( str, unicode ) ) self.__avatar_url = attributes[ "avatar_url" ] diff --git a/src/github/Permissions.py b/src/github/Permissions.py index 24d100db..cefc8fb8 100644 --- a/src/github/Permissions.py +++ b/src/github/Permissions.py @@ -33,7 +33,10 @@ class Permissions( object ): self.__push = None def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "admin", "pull", "push", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "admin" in attributes and attributes[ "admin" ] is not None: assert isinstance( attributes[ "admin" ], bool ) self.__admin = attributes[ "admin" ] diff --git a/src/github/Plan.py b/src/github/Plan.py index 296de191..e029744f 100644 --- a/src/github/Plan.py +++ b/src/github/Plan.py @@ -38,7 +38,10 @@ class Plan( object ): self.__space = None def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "collaborators", "name", "private_repos", "space", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "collaborators" in attributes and attributes[ "collaborators" ] is not None: assert isinstance( attributes[ "collaborators" ], int ) self.__collaborators = attributes[ "collaborators" ] diff --git a/src/github/PullRequest.py b/src/github/PullRequest.py index 9ecb0a24..8aea5595 100644 --- a/src/github/PullRequest.py +++ b/src/github/PullRequest.py @@ -279,7 +279,10 @@ class PullRequest( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "additions", "base", "body", "changed_files", "closed_at", "comments", "commits", "created_at", "deletions", "diff_url", "head", "html_url", "id", "issue_url", "mergeable", "merged", "merged_at", "merged_by", "number", "patch_url", "review_comments", "state", "title", "updated_at", "url", "user", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "additions" in attributes and attributes[ "additions" ] is not None: self.__additions = attributes[ "additions" ] if "base" in attributes and attributes[ "base" ] is not None: diff --git a/src/github/PullRequestComment.py b/src/github/PullRequestComment.py index 1ddd18fe..8af4822e 100644 --- a/src/github/PullRequestComment.py +++ b/src/github/PullRequestComment.py @@ -121,7 +121,10 @@ class PullRequestComment( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "body", "commit_id", "created_at", "html_url", "id", "line", "path", "position", "updated_at", "url", "user", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "body" in attributes and attributes[ "body" ] is not None: self.__body = attributes[ "body" ] if "commit_id" in attributes and attributes[ "commit_id" ] is not None: diff --git a/src/github/PullRequestFile.py b/src/github/PullRequestFile.py index 648e676b..44389215 100644 --- a/src/github/PullRequestFile.py +++ b/src/github/PullRequestFile.py @@ -63,7 +63,10 @@ class PullRequestFile( object ): self.__status = None def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "additions", "blob_url", "changes", "deletions", "filename", "patch", "raw_url", "sha", "status", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "additions" in attributes and attributes[ "additions" ] is not None: self.__additions = attributes[ "additions" ] if "blob_url" in attributes and attributes[ "blob_url" ] is not None: diff --git a/src/github/Repository.py b/src/github/Repository.py index eff3edf8..429afbb9 100644 --- a/src/github/Repository.py +++ b/src/github/Repository.py @@ -897,7 +897,10 @@ class Repository( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "clone_url", "created_at", "description", "fork", "forks", "git_url", "has_downloads", "has_issues", "has_wiki", "homepage", "html_url", "id", "language", "master_branch", "mirror_url", "name", "open_issues", "organization", "owner", "parent", "permissions", "private", "pushed_at", "size", "source", "ssh_url", "svn_url", "updated_at", "url", "watchers", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "clone_url" in attributes and attributes[ "clone_url" ] is not None: assert isinstance( attributes[ "clone_url" ], ( str, unicode ) ) self.__clone_url = attributes[ "clone_url" ] diff --git a/src/github/RepositoryKey.py b/src/github/RepositoryKey.py index d821834c..5e499351 100644 --- a/src/github/RepositoryKey.py +++ b/src/github/RepositoryKey.py @@ -79,7 +79,10 @@ class RepositoryKey( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "id", "key", "title", "url", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "id" in attributes and attributes[ "id" ] is not None: self.__id = attributes[ "id" ] if "key" in attributes and attributes[ "key" ] is not None: diff --git a/src/github/Tag.py b/src/github/Tag.py index d3193d13..88eb24f1 100644 --- a/src/github/Tag.py +++ b/src/github/Tag.py @@ -39,7 +39,10 @@ class Tag( object ): self.__zipball_url = None def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "commit", "name", "tarball_url", "zipball_url", ] + # @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 ) diff --git a/src/github/Team.py b/src/github/Team.py index 426f7405..cff9f678 100644 --- a/src/github/Team.py +++ b/src/github/Team.py @@ -172,7 +172,10 @@ class Team( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "id", "members_count", "name", "permission", "repos_count", "url", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "id" in attributes and attributes[ "id" ] is not None: self.__id = attributes[ "id" ] if "members_count" in attributes and attributes[ "members_count" ] is not None: diff --git a/src/github/UserKey.py b/src/github/UserKey.py index 2a1de5de..226f27de 100644 --- a/src/github/UserKey.py +++ b/src/github/UserKey.py @@ -81,7 +81,10 @@ class UserKey( object ): self.__completed = True def __useAttributes( self, attributes ): - #@todo No need to check if attribute is in attributes when attribute is mandatory + # @todo Remove this debug weakness: we shall assume that github will add new attributes + for attribute in attributes: + assert attribute in [ "id", "key", "title", "url", ] + # @todo No need to check if attribute is in attributes when attribute is mandatory if "id" in attributes and attributes[ "id" ] is not None: self.__id = attributes[ "id" ] if "key" in attributes and attributes[ "key" ] is not None: