mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 10:51:14 +00:00
On the way to remove modifyAttributes from ElementCreatable and ListGetable
This commit is contained in:
@@ -133,6 +133,8 @@ Label = GithubObject(
|
||||
Deletable(),
|
||||
)
|
||||
|
||||
__modifyAttributesForObjectsReferingReferedRepo = lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) )
|
||||
|
||||
Milestone = GithubObject(
|
||||
"Milestone",
|
||||
BaseUrl( lambda obj: obj._repo._baseUrl + "/milestones/" + str( obj.number ) ),
|
||||
@@ -144,7 +146,7 @@ Milestone = GithubObject(
|
||||
InternalObjectAttribute( "creator", NamedUser ),
|
||||
Editable( [ "title" ], [ "state", "description", "due_on" ] ),
|
||||
Deletable(),
|
||||
ExternalListOfObjects( "labels", "label", Label, ListGetable( [], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ) ),
|
||||
ExternalListOfObjects( "labels", "label", Label, ListGetable( [], [], __modifyAttributesForObjectsReferingReferedRepo ) ),
|
||||
)
|
||||
|
||||
IssueComment = GithubObject(
|
||||
@@ -173,16 +175,16 @@ Issue = GithubObject(
|
||||
InternalObjectAttribute( "milestone", Milestone ),
|
||||
Editable( [], [ "title", "body", "assignee", "state", "milestone", "labels" ] ),
|
||||
ExternalListOfObjects( "labels", "label", Label,
|
||||
ListGetable( [], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ),
|
||||
ListGetable( [], [], __modifyAttributesForObjectsReferingReferedRepo ),
|
||||
SeveralElementsAddable(),
|
||||
ListSetable(),
|
||||
ListDeletable(),
|
||||
ElementRemovable(),
|
||||
),
|
||||
ExternalListOfObjects( "comments", "comment", IssueComment,
|
||||
ListGetable( [], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ),
|
||||
ListGetable( [], [], __modifyAttributesForObjectsReferingReferedRepo ),
|
||||
ElementGetable( [ "id" ], [], "_repo" ),
|
||||
ElementCreatable( [ "body" ], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ),
|
||||
ElementCreatable( [ "body" ], [], __modifyAttributesForObjectsReferingReferedRepo ),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -43,7 +43,8 @@ class ElementCreatable( ListCapacity ):
|
||||
|
||||
def __execute( self, obj, *args, **kwds ):
|
||||
data = self.__argumentsChecker.check( args, kwds )
|
||||
return self.typePolicy.createLazy( obj, self.__modifyAttributes( obj, obj._github._dataRequest( "POST", obj._baseUrl + "/" + self.attributeName, None, data ) ) )
|
||||
attributes = obj._github._dataRequest( "POST", obj._baseUrl + "/" + self.attributeName, None, data )
|
||||
return self.typePolicy.createLazy( obj, self.__modifyAttributes( obj, attributes ) )
|
||||
|
||||
class ElementGetable( ListCapacity ):
|
||||
def __init__( self, mandatoryParameters, optionalParameters, objReferenceName = None ):
|
||||
|
||||
Reference in New Issue
Block a user