mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 11:21:16 +00:00
Remove the notion of ImmediateCompletion
This commit is contained in:
+9
-11
@@ -11,13 +11,11 @@ import Commit
|
||||
import CommitComment
|
||||
|
||||
class Commit( object ):
|
||||
def __init__( self, requester, attributes, completion ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
self.__completed = completion != LazyCompletion
|
||||
if completion == ImmediateCompletion:
|
||||
self.__complete() # pragma: no cover
|
||||
self.__completed = completed
|
||||
|
||||
@property
|
||||
def author( self ):
|
||||
@@ -82,7 +80,7 @@ class Commit( object ):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return CommitComment.CommitComment( self.__requester, data, completion = NoCompletion )
|
||||
return CommitComment.CommitComment( self.__requester, data, completed = True )
|
||||
|
||||
def get_comments( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
@@ -125,23 +123,23 @@ class Commit( object ):
|
||||
def __useAttributes( self, attributes ):
|
||||
if "author" in attributes and attributes[ "author" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "author" ], dict ), attributes[ "author" ]
|
||||
self.__author = NamedUser.NamedUser( self.__requester, attributes[ "author" ], completion = LazyCompletion )
|
||||
self.__author = NamedUser.NamedUser( self.__requester, attributes[ "author" ], completed = False )
|
||||
if "commit" in attributes and attributes[ "commit" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "commit" ], dict ), attributes[ "commit" ]
|
||||
self.__commit = GitCommit.GitCommit( self.__requester, attributes[ "commit" ], completion = LazyCompletion )
|
||||
self.__commit = GitCommit.GitCommit( self.__requester, attributes[ "commit" ], completed = False )
|
||||
if "committer" in attributes and attributes[ "committer" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "committer" ], dict ), attributes[ "committer" ]
|
||||
self.__committer = NamedUser.NamedUser( self.__requester, attributes[ "committer" ], completion = LazyCompletion )
|
||||
self.__committer = NamedUser.NamedUser( self.__requester, attributes[ "committer" ], completed = False )
|
||||
if "files" in attributes and attributes[ "files" ] is not None: # pragma no branch
|
||||
assert all( isinstance( element, dict ) for element in attributes[ "files" ] ), attributes[ "files" ]
|
||||
self.__files = [
|
||||
CommitFile.CommitFile( self.__requester, element, completion = LazyCompletion )
|
||||
CommitFile.CommitFile( self.__requester, element, completed = False )
|
||||
for element in attributes[ "files" ]
|
||||
]
|
||||
if "parents" in attributes and attributes[ "parents" ] is not None: # pragma no branch
|
||||
assert all( isinstance( element, dict ) for element in attributes[ "parents" ] ), attributes[ "parents" ]
|
||||
self.__parents = [
|
||||
Commit( self.__requester, element, completion = LazyCompletion )
|
||||
Commit( self.__requester, element, completed = False )
|
||||
for element in attributes[ "parents" ]
|
||||
]
|
||||
if "sha" in attributes and attributes[ "sha" ] is not None: # pragma no branch
|
||||
@@ -149,7 +147,7 @@ class Commit( object ):
|
||||
self.__sha = attributes[ "sha" ]
|
||||
if "stats" in attributes and attributes[ "stats" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "stats" ], dict ), attributes[ "stats" ]
|
||||
self.__stats = CommitStats.CommitStats( self.__requester, attributes[ "stats" ], completion = LazyCompletion )
|
||||
self.__stats = CommitStats.CommitStats( self.__requester, attributes[ "stats" ], completed = False )
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
|
||||
Reference in New Issue
Block a user