mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 03:41:08 +00:00
Assert that we know all attributes
To be removed before release, since this would break the application if github.com adds a new attribute
This commit is contained in:
@@ -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" ]
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
@@ -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:
|
||||
|
||||
+4
-1
@@ -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 )
|
||||
|
||||
+4
-1
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
+4
-1
@@ -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:
|
||||
|
||||
+4
-1
@@ -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 )
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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 )
|
||||
|
||||
+4
-1
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
+4
-1
@@ -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" ]
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
@@ -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:
|
||||
|
||||
+4
-1
@@ -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 )
|
||||
|
||||
+4
-1
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user