mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 11:51:10 +00:00
Move 'todo's out of generated code
This commit is contained in:
@@ -4,6 +4,9 @@ import os.path
|
||||
import json
|
||||
import itertools
|
||||
|
||||
### @todo Mandatory/optional attributes
|
||||
### @todo Remove '_identity' from the normalized json description
|
||||
|
||||
def checkKeys( d, mandatoryKeys, optionalKeys = [] ):
|
||||
assert set( d.keys() ) >= set( mandatoryKeys ), d.keys()
|
||||
assert set( d.keys() ) <= set( mandatoryKeys ) | set( optionalKeys ) | set( [ "@todo" ] ), d.keys()
|
||||
|
||||
@@ -36,7 +36,6 @@ class {{ class.name }}( object ):
|
||||
{% endfor %}
|
||||
|
||||
{% if class.identity %}
|
||||
# @todo Remove '_identity' from the normalized json description
|
||||
@property
|
||||
def _identity( self ):
|
||||
return {% include "GithubObject.Concatenation.py" with concatenation=class.identity only %}
|
||||
@@ -64,7 +63,6 @@ class {{ class.name }}( object ):
|
||||
{% endif %}
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @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: # pragma no branch
|
||||
|
||||
|
||||
@@ -564,7 +564,6 @@ class AuthenticatedUser( object ):
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @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: # pragma no branch
|
||||
assert isinstance( attributes[ "avatar_url" ], ( str, unicode ) )
|
||||
self.__avatar_url = attributes[ "avatar_url" ]
|
||||
|
||||
@@ -113,7 +113,6 @@ class Authorization( object ):
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "app" in attributes and attributes[ "app" ] is not None: # pragma no branch
|
||||
self.__app = attributes[ "app" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
|
||||
@@ -24,7 +24,6 @@ class Branch( object ):
|
||||
self.__name = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "commit" in attributes and attributes[ "commit" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "commit" ], dict )
|
||||
self.__commit = Commit.Commit( self.__requester, attributes[ "commit" ], completion = LazyCompletion )
|
||||
|
||||
@@ -116,7 +116,6 @@ class Commit( 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 and attributes[ "author" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "author" ], dict )
|
||||
self.__author = NamedUser.NamedUser( self.__requester, attributes[ "author" ], completion = LazyCompletion )
|
||||
|
||||
@@ -117,7 +117,6 @@ class CommitComment( object ):
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "body" in attributes and attributes[ "body" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "body" ], ( str, unicode ) )
|
||||
self.__body = attributes[ "body" ]
|
||||
|
||||
@@ -58,7 +58,6 @@ class CommitFile( object ):
|
||||
self.__status = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "additions" in attributes and attributes[ "additions" ] is not None: # pragma no branch
|
||||
self.__additions = attributes[ "additions" ]
|
||||
if "blob_url" in attributes and attributes[ "blob_url" ] is not None: # pragma no branch
|
||||
|
||||
@@ -28,7 +28,6 @@ class CommitStats( object ):
|
||||
self.__total = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "additions" in attributes and attributes[ "additions" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "additions" ], int )
|
||||
self.__additions = attributes[ "additions" ]
|
||||
|
||||
@@ -158,7 +158,6 @@ class Download( object ):
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "accesskeyid" in attributes and attributes[ "accesskeyid" ] is not None: # pragma no branch
|
||||
self.__accesskeyid = attributes[ "accesskeyid" ]
|
||||
if "acl" in attributes and attributes[ "acl" ] is not None: # pragma no branch
|
||||
|
||||
@@ -56,7 +56,6 @@ class Event( object ):
|
||||
self.__type = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "actor" in attributes and attributes[ "actor" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "actor" ], dict )
|
||||
self.__actor = NamedUser.NamedUser( self.__requester, attributes[ "actor" ], completion = LazyCompletion )
|
||||
|
||||
@@ -216,7 +216,6 @@ class Gist( object ):
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "comments" in attributes and attributes[ "comments" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "comments" ], int )
|
||||
self.__comments = attributes[ "comments" ]
|
||||
|
||||
@@ -64,7 +64,6 @@ class GistComment( object ):
|
||||
self.__user = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "body" in attributes and attributes[ "body" ] is not None: # pragma no branch
|
||||
self.__body = attributes[ "body" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
|
||||
@@ -40,7 +40,6 @@ class GistHistoryState( object ):
|
||||
self.__version = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "change_status" in attributes and attributes[ "change_status" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "change_status" ], dict )
|
||||
self.__change_status = CommitStats.CommitStats( self.__requester, attributes[ "change_status" ], completion = LazyCompletion )
|
||||
|
||||
@@ -28,7 +28,6 @@ class GitAuthor( object ):
|
||||
self.__name = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "date" in attributes and attributes[ "date" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "date" ], ( str, unicode ) )
|
||||
self.__date = attributes[ "date" ]
|
||||
|
||||
@@ -38,7 +38,6 @@ class GitBlob( object ):
|
||||
self.__url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "content" in attributes and attributes[ "content" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "content" ], ( str, unicode ) )
|
||||
self.__content = attributes[ "content" ]
|
||||
|
||||
@@ -51,7 +51,6 @@ class GitCommit( object ):
|
||||
self.__url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "author" in attributes and attributes[ "author" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "author" ], dict )
|
||||
self.__author = GitAuthor.GitAuthor( self.__requester, attributes[ "author" ], completion = LazyCompletion )
|
||||
|
||||
@@ -28,7 +28,6 @@ class GitObject( object ):
|
||||
self.__url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "sha" in attributes and attributes[ "sha" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "sha" ], ( str, unicode ) )
|
||||
self.__sha = attributes[ "sha" ]
|
||||
|
||||
@@ -51,7 +51,6 @@ class GitRef( object ):
|
||||
self.__url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "object" in attributes and attributes[ "object" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "object" ], dict )
|
||||
self.__object = GitObject.GitObject( self.__requester, attributes[ "object" ], completion = LazyCompletion )
|
||||
|
||||
@@ -45,7 +45,6 @@ class GitTag( object ):
|
||||
self.__url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "message" in attributes and attributes[ "message" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "message" ], ( str, unicode ) )
|
||||
self.__message = attributes[ "message" ]
|
||||
|
||||
@@ -29,7 +29,6 @@ class GitTree( object ):
|
||||
self.__url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "sha" in attributes and attributes[ "sha" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "sha" ], ( str, unicode ) )
|
||||
self.__sha = attributes[ "sha" ]
|
||||
|
||||
@@ -43,7 +43,6 @@ class GitTreeElement( object ):
|
||||
self.__url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "mode" in attributes and attributes[ "mode" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "mode" ], ( str, unicode ) )
|
||||
self.__mode = attributes[ "mode" ]
|
||||
|
||||
@@ -95,7 +95,6 @@ class Hook( object ):
|
||||
self.__url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "active" in attributes and attributes[ "active" ] is not None: # pragma no branch
|
||||
self.__active = attributes[ "active" ]
|
||||
if "config" in attributes and attributes[ "config" ] is not None: # pragma no branch
|
||||
|
||||
@@ -264,7 +264,6 @@ class Issue( object ):
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "assignee" in attributes and attributes[ "assignee" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "assignee" ], dict )
|
||||
self.__assignee = NamedUser.NamedUser( self.__requester, attributes[ "assignee" ], completion = LazyCompletion )
|
||||
|
||||
@@ -64,7 +64,6 @@ class IssueComment( object ):
|
||||
self.__user = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "body" in attributes and attributes[ "body" ] is not None: # pragma no branch
|
||||
self.__body = attributes[ "body" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
|
||||
@@ -74,7 +74,6 @@ 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 and attributes[ "actor" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "actor" ], dict )
|
||||
self.__actor = NamedUser.NamedUser( self.__requester, attributes[ "actor" ], completion = LazyCompletion )
|
||||
|
||||
@@ -110,7 +110,6 @@ class Milestone( object ):
|
||||
self.__url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @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: # pragma no branch
|
||||
assert isinstance( attributes[ "closed_issues" ], int )
|
||||
self.__closed_issues = attributes[ "closed_issues" ]
|
||||
|
||||
@@ -313,7 +313,6 @@ class NamedUser( object ):
|
||||
data
|
||||
)
|
||||
|
||||
# @todo Remove '_identity' from the normalized json description
|
||||
@property
|
||||
def _identity( self ):
|
||||
return str( self.login )
|
||||
@@ -361,7 +360,6 @@ class NamedUser( object ):
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @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: # pragma no branch
|
||||
assert isinstance( attributes[ "avatar_url" ], ( str, unicode ) )
|
||||
self.__avatar_url = attributes[ "avatar_url" ]
|
||||
|
||||
@@ -386,7 +386,6 @@ class Organization( object ):
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @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: # pragma no branch
|
||||
assert isinstance( attributes[ "avatar_url" ], ( str, unicode ) )
|
||||
self.__avatar_url = attributes[ "avatar_url" ]
|
||||
|
||||
@@ -28,7 +28,6 @@ class Permissions( object ):
|
||||
self.__push = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "admin" in attributes and attributes[ "admin" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "admin" ], bool )
|
||||
self.__admin = attributes[ "admin" ]
|
||||
|
||||
@@ -33,7 +33,6 @@ class Plan( object ):
|
||||
self.__space = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "collaborators" in attributes and attributes[ "collaborators" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "collaborators" ], int )
|
||||
self.__collaborators = attributes[ "collaborators" ]
|
||||
|
||||
@@ -290,7 +290,6 @@ class PullRequest( 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 and attributes[ "additions" ] is not None: # pragma no branch
|
||||
self.__additions = attributes[ "additions" ]
|
||||
if "base" in attributes and attributes[ "base" ] is not None: # pragma no branch
|
||||
|
||||
@@ -117,7 +117,6 @@ class PullRequestComment( object ):
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "body" in attributes and attributes[ "body" ] is not None: # pragma no branch
|
||||
self.__body = attributes[ "body" ]
|
||||
if "commit_id" in attributes and attributes[ "commit_id" ] is not None: # pragma no branch
|
||||
|
||||
@@ -58,7 +58,6 @@ class PullRequestFile( object ):
|
||||
self.__status = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "additions" in attributes and attributes[ "additions" ] is not None: # pragma no branch
|
||||
self.__additions = attributes[ "additions" ]
|
||||
if "blob_url" in attributes and attributes[ "blob_url" ] is not None: # pragma no branch
|
||||
|
||||
@@ -865,7 +865,6 @@ class Repository( object ):
|
||||
None
|
||||
)
|
||||
|
||||
# @todo Remove '_identity' from the normalized json description
|
||||
@property
|
||||
def _identity( self ):
|
||||
return str( self.owner.login ) + "/" + str( self.name )
|
||||
@@ -917,7 +916,6 @@ class Repository( object ):
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @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: # pragma no branch
|
||||
assert isinstance( attributes[ "clone_url" ], ( str, unicode ) )
|
||||
self.__clone_url = attributes[ "clone_url" ]
|
||||
|
||||
@@ -83,7 +83,6 @@ class RepositoryKey( object ):
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
self.__id = attributes[ "id" ]
|
||||
if "key" in attributes and attributes[ "key" ] is not None: # pragma no branch
|
||||
|
||||
@@ -34,7 +34,6 @@ 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
|
||||
if "commit" in attributes and attributes[ "commit" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "commit" ], dict )
|
||||
self.__commit = Commit.Commit( self.__requester, attributes[ "commit" ], completion = LazyCompletion )
|
||||
|
||||
@@ -168,7 +168,6 @@ class Team( object ):
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
self.__id = attributes[ "id" ]
|
||||
if "members_count" in attributes and attributes[ "members_count" ] is not None: # pragma no branch
|
||||
|
||||
@@ -83,7 +83,6 @@ class UserKey( object ):
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
self.__id = attributes[ "id" ]
|
||||
if "key" in attributes and attributes[ "key" ] is not None: # pragma no branch
|
||||
|
||||
Reference in New Issue
Block a user