From 162825808928a794d507a7f91dd157b14b18d0b9 Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Sun, 26 Feb 2012 08:15:56 +0000 Subject: [PATCH] Put the singular name in ExternalListOfXxx instead of list capacities --- github/GithubObject.UnitTest.py | 20 ++--- github/GithubObjects.py | 128 ++++++++++++++++---------------- github/ObjectCapacities/List.py | 22 +++--- 3 files changed, 85 insertions(+), 85 deletions(-) diff --git a/github/GithubObject.UnitTest.py b/github/GithubObject.UnitTest.py index 10e38b65..2741f342 100644 --- a/github/GithubObject.UnitTest.py +++ b/github/GithubObject.UnitTest.py @@ -212,7 +212,7 @@ class GithubObjectWithListGetableExternalListOfObjects( TestCaseWithGithubTestOb "GithubTestObject", BaseUrl( lambda obj: "/test" ), InternalSimpleAttributes( "a1", "a2" ), - ExternalListOfObjects( "a3s", ContainedObject, ListGetable( [], [ "type" ] ) ) + ExternalListOfObjects( "a3s", "a3", ContainedObject, ListGetable( [], [ "type" ] ) ) ) def testGetList( self ): @@ -240,7 +240,7 @@ class GithubObjectWithElementAddableExternalListOfObjects( TestCaseWithGithubTes "GithubTestObject", BaseUrl( lambda obj: "/test" ), InternalSimpleAttributes( "a1", "a2" ), - ExternalListOfObjects( "a3s", ContainedObject, ElementAddable() ) + ExternalListOfObjects( "a3s", "a3", ContainedObject, ElementAddable() ) ) def testAddToList( self ): @@ -260,7 +260,7 @@ class GithubObjectWithElementRemovableExternalListOfObjects( TestCaseWithGithubT "GithubTestObject", BaseUrl( lambda obj: "/test" ), InternalSimpleAttributes( "a1", "a2" ), - ExternalListOfObjects( "a3s", ContainedObject, ElementRemovable() ) + ExternalListOfObjects( "a3s", "a3", ContainedObject, ElementRemovable() ) ) def testRemoveFromList( self ): @@ -280,7 +280,7 @@ class GithubObjectWithElementHasableExternalListOfObjects( TestCaseWithGithubTes "GithubTestObject", BaseUrl( lambda obj: "/test" ), InternalSimpleAttributes( "a1", "a2" ), - ExternalListOfObjects( "a3s", ContainedObject, ElementHasable() ) + ExternalListOfObjects( "a3s", "a3", ContainedObject, ElementHasable() ) ) def testHasInList( self ): @@ -302,7 +302,7 @@ class GithubObjectWithElementCreatableExternalListOfObjects( TestCaseWithGithubT "GithubTestObject", BaseUrl( lambda obj: "/test" ), InternalSimpleAttributes( "a1", "a2" ), - ExternalListOfObjects( "a3s", ContainedObject, ElementCreatable( "a3", [ "name" ], [ "p1", "p2" ] ) ) + ExternalListOfObjects( "a3s", "a3", ContainedObject, ElementCreatable( [ "name" ], [ "p1", "p2" ] ) ) ) def testCreate( self ): @@ -341,7 +341,7 @@ class GithubObjectWithSeveralElementsAddableExternalListOfObjects( TestCaseWithG "GithubTestObject", BaseUrl( lambda obj: "/test" ), InternalSimpleAttributes( "a1", "a2" ), - ExternalListOfObjects( "a3s", ContainedObject, SeveralElementsAddable() ) + ExternalListOfObjects( "a3s", "a3", ContainedObject, SeveralElementsAddable() ) ) def testAddToList( self ): @@ -360,7 +360,7 @@ class GithubObjectWithListSetableExternalListOfObjects( TestCaseWithGithubTestOb "GithubTestObject", BaseUrl( lambda obj: "/test" ), InternalSimpleAttributes( "a1", "a2" ), - ExternalListOfObjects( "a3s", ContainedObject, ListSetable() ) + ExternalListOfObjects( "a3s", "a3", ContainedObject, ListSetable() ) ) def testSetList( self ): @@ -378,7 +378,7 @@ class GithubObjectWithListDeletableExternalListOfObjects( TestCaseWithGithubTest "GithubTestObject", BaseUrl( lambda obj: "/test" ), InternalSimpleAttributes( "a1", "a2" ), - ExternalListOfObjects( "a3s", ContainedObject, ListDeletable() ) + ExternalListOfObjects( "a3s", "a3", ContainedObject, ListDeletable() ) ) def testGetList( self ): @@ -396,7 +396,7 @@ class GithubObjectWithElementGetableExternalListOfObjects( TestCaseWithGithubTes "GithubTestObject", BaseUrl( lambda obj: "/test" ), InternalSimpleAttributes( "a1", "a2" ), - ExternalListOfObjects( "a3s", ContainedObject, ElementGetable( "a3", lambda obj, id: { "id": id } ) ) + ExternalListOfObjects( "a3s", "a3", ContainedObject, ElementGetable( lambda obj, id: { "id": id } ) ) ) def testGetList( self ): @@ -408,7 +408,7 @@ class GithubObjectWithMultiCapacityExternalListOfSimpleTypes( TestCaseWithGithub "GithubTestObject", BaseUrl( lambda obj: "/test" ), InternalSimpleAttributes( "a1", "a2" ), - ExternalListOfSimpleTypes( "a3s", + ExternalListOfSimpleTypes( "a3s", "a3", ListGetable( [], [] ), SeveralElementsAddable(), SeveralElementsRemovable(), diff --git a/github/GithubObjects.py b/github/GithubObjects.py index 71c78697..bb7f798b 100644 --- a/github/GithubObjects.py +++ b/github/GithubObjects.py @@ -15,7 +15,7 @@ AuthenticatedUser = GithubObject( "disk_usage", "collaborators", "plan", ), Editable( [], [ "name", "email", "blog", "company", "location", "hireable", "bio" ] ), - ExternalListOfSimpleTypes( "emails", + ExternalListOfSimpleTypes( "emails", "email", ListGetable( [], [] ), SeveralElementsAddable(), SeveralElementsRemovable() @@ -39,11 +39,11 @@ NamedUser = GithubObject( ), ) -AuthenticatedUser._addAttributePolicy( ExternalListOfObjects( "followers", NamedUser, ListGetable( [], [] ) ) ) -NamedUser._addAttributePolicy( ExternalListOfObjects( "followers", NamedUser, ListGetable( [], [] ) ) ) +AuthenticatedUser._addAttributePolicy( ExternalListOfObjects( "followers", "follower", NamedUser, ListGetable( [], [] ) ) ) +NamedUser._addAttributePolicy( ExternalListOfObjects( "followers", "follower", NamedUser, ListGetable( [], [] ) ) ) -AuthenticatedUser._addAttributePolicy( ExternalListOfObjects( "following", NamedUser, ListGetable( [], [] ), ElementAddable(), ElementRemovable(), ElementHasable() ) ) -NamedUser._addAttributePolicy( ExternalListOfObjects( "following", NamedUser, ListGetable( [], [] ) ) ) +AuthenticatedUser._addAttributePolicy( ExternalListOfObjects( "following", "following", NamedUser, ListGetable( [], [] ), ElementAddable(), ElementRemovable(), ElementHasable() ) ) +NamedUser._addAttributePolicy( ExternalListOfObjects( "following", "following", NamedUser, ListGetable( [], [] ) ) ) Organization = GithubObject( "Organization", @@ -57,13 +57,13 @@ Organization = GithubObject( "disk_usage", "collaborators", "billing_email", "plan", "private_gists", "total_private_repos", "owned_private_repos", ), - ExternalListOfObjects( "public_members", NamedUser, ListGetable( [], [] ), ElementAddable(), ElementRemovable(), ElementHasable() ), - ExternalListOfObjects( "members", NamedUser, ListGetable( [], [] ), ElementRemovable(), ElementHasable() ), + ExternalListOfObjects( "public_members", "public_member", NamedUser, ListGetable( [], [] ), ElementAddable(), ElementRemovable(), ElementHasable() ), + ExternalListOfObjects( "members", "member", NamedUser, ListGetable( [], [] ), ElementRemovable(), ElementHasable() ), Editable( [], [ "billing_email", "blog", "company", "email", "location", "name" ] ), ) -AuthenticatedUser._addAttributePolicy( ExternalListOfObjects( "orgs", Organization, ListGetable( [], [] ) ) ) -NamedUser._addAttributePolicy( ExternalListOfObjects( "orgs", Organization, ListGetable( [], [] ) ) ) +AuthenticatedUser._addAttributePolicy( ExternalListOfObjects( "orgs", "org", Organization, ListGetable( [], [] ) ) ) +NamedUser._addAttributePolicy( ExternalListOfObjects( "orgs", "org", Organization, ListGetable( [], [] ) ) ) GitRef = GithubObject( "GitRef", @@ -144,7 +144,7 @@ Milestone = GithubObject( InternalObjectAttribute( "creator", NamedUser ), Editable( [ "title" ], [ "state", "description", "due_on" ] ), Deletable(), - ExternalListOfObjects( "labels", Label, ListGetable( [], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ) ), + ExternalListOfObjects( "labels", "label", Label, ListGetable( [], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ) ), ) IssueComment = GithubObject( @@ -172,17 +172,17 @@ Issue = GithubObject( InternalObjectAttribute( "assignee", NamedUser ), InternalObjectAttribute( "milestone", Milestone ), Editable( [], [ "title", "body", "assignee", "state", "milestone", "labels" ] ), - ExternalListOfObjects( "labels", Label, + ExternalListOfObjects( "labels", "label", Label, ListGetable( [], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ), SeveralElementsAddable(), ListSetable(), ListDeletable(), ElementRemovable(), ), - ExternalListOfObjects( "comments", IssueComment, + ExternalListOfObjects( "comments", "comment", IssueComment, ListGetable( [], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ), - ElementGetable( "comment", lambda repo, id: { "_repo": repo, "id": id } ), - ElementCreatable( "comment", [ "body" ], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ), + ElementGetable( lambda repo, id: { "_repo": repo, "id": id } ), + ElementCreatable( [ "body" ], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ), ), ) @@ -225,9 +225,9 @@ Commit = GithubObject( InternalObjectAttribute( "commit", GitCommit ), InternalObjectAttribute( "author", NamedUser ), InternalObjectAttribute( "committer", NamedUser ), - ExternalListOfObjects( "comments", CommitComment, + ExternalListOfObjects( "comments", "comment", CommitComment, ListGetable( [], [] ), - ElementCreatable( "comment", [ "body", "commit_id", "line", "path", "position" ], [] ), + ElementCreatable( [ "body", "commit_id", "line", "path", "position" ], [] ), ), ) @@ -264,80 +264,80 @@ Repository = GithubObject( "mirror_url", "updated_at", "id", ), InternalObjectAttribute( "owner", NamedUser ), - ExternalListOfObjects( "collaborators", NamedUser, ListGetable( [], [] ), ElementAddable(), ElementRemovable(), ElementHasable() ), - ExternalListOfObjects( "contributors", NamedUser, ListGetable( [], [] ) ), - ExternalListOfObjects( "watchers", NamedUser, ListGetable( [], [] ) ), + ExternalListOfObjects( "collaborators", "collaborator", NamedUser, ListGetable( [], [] ), ElementAddable(), ElementRemovable(), ElementHasable() ), + ExternalListOfObjects( "contributors", "contributor", NamedUser, ListGetable( [], [] ) ), + ExternalListOfObjects( "watchers", "watcher", NamedUser, ListGetable( [], [] ) ), Editable( [ "name" ], [ "description", "homepage", "public", "has_issues", "has_wiki", "has_downloads" ] ), - ExternalListOfObjects( "git/refs", GitRef, + ExternalListOfObjects( "git/refs", "git_ref", GitRef, ListGetable( [], [], __modifyAttributesForObjectsReferingRepo ), - ElementGetable( "git_ref", lambda repo, ref: { "_repo": repo, "ref": ref } ), - ElementCreatable( "git_ref", [ "ref", "sha" ], [], __modifyAttributesForObjectsReferingRepo ) + ElementGetable( lambda repo, ref: { "_repo": repo, "ref": ref } ), + ElementCreatable( [ "ref", "sha" ], [], __modifyAttributesForObjectsReferingRepo ) ), - ExternalListOfObjects( "git/commits", GitCommit, - ElementGetable( "git_commit", lambda repo, sha: { "_repo": repo, "sha": sha } ), - ElementCreatable( "git_commit", [ "message", "tree", "parents" ], [ "author", "commiter" ], __modifyAttributesForObjectsReferingRepo ) + ExternalListOfObjects( "git/commits", "git_commit", GitCommit, + ElementGetable( lambda repo, sha: { "_repo": repo, "sha": sha } ), + ElementCreatable( [ "message", "tree", "parents" ], [ "author", "commiter" ], __modifyAttributesForObjectsReferingRepo ) ), - ExternalListOfObjects( "git/trees", GitTree, - ElementGetable( "git_tree", lambda repo, sha: { "_repo": repo, "sha": sha } ), - ElementCreatable( "git_tree", [ "tree" ], [], __modifyAttributesForObjectsReferingRepo ) + ExternalListOfObjects( "git/trees", "git_tree", GitTree, + ElementGetable( lambda repo, sha: { "_repo": repo, "sha": sha } ), + ElementCreatable( [ "tree" ], [], __modifyAttributesForObjectsReferingRepo ) ), - ExternalListOfObjects( "git/blobs", GitBlob, - ElementGetable( "git_blob", lambda repo, sha: { "_repo": repo, "sha": sha } ), - ElementCreatable( "git_blob", [ "content", "encoding" ], [], __modifyAttributesForObjectsReferingRepo ) + ExternalListOfObjects( "git/blobs", "git_blob", GitBlob, + ElementGetable( lambda repo, sha: { "_repo": repo, "sha": sha } ), + ElementCreatable( [ "content", "encoding" ], [], __modifyAttributesForObjectsReferingRepo ) ), - ExternalListOfObjects( "git/tags", GitTag, - ElementGetable( "git_tag", lambda repo, sha: { "_repo": repo, "sha": sha } ), - ElementCreatable( "git_tag", [ "tag", "message", "object", "type" ], [ "tagger" ], __modifyAttributesForObjectsReferingRepo ) + ExternalListOfObjects( "git/tags", "git_tag", GitTag, + ElementGetable( lambda repo, sha: { "_repo": repo, "sha": sha } ), + ElementCreatable( [ "tag", "message", "object", "type" ], [ "tagger" ], __modifyAttributesForObjectsReferingRepo ) ), - ExternalListOfObjects( "labels", Label, + ExternalListOfObjects( "labels", "label", Label, ListGetable( [], [], __modifyAttributesForObjectsReferingRepo ), - ElementGetable( "label", lambda repo, name: { "_repo": repo, "name": name } ), - ElementCreatable( "label", [ "name", "color" ], [], __modifyAttributesForObjectsReferingRepo ), + ElementGetable( lambda repo, name: { "_repo": repo, "name": name } ), + ElementCreatable( [ "name", "color" ], [], __modifyAttributesForObjectsReferingRepo ), ), - ExternalListOfObjects( "milestones", Milestone, + ExternalListOfObjects( "milestones", "milestone", Milestone, ListGetable( [], [ "state", "sort", "direction" ], __modifyAttributesForObjectsReferingRepo ), - ElementGetable( "milestone", lambda repo, number: { "_repo": repo, "number": number } ), - ElementCreatable( "milestone", [ "title" ], [ "state", "description", "due_on" ], __modifyAttributesForObjectsReferingRepo ) + ElementGetable( lambda repo, number: { "_repo": repo, "number": number } ), + ElementCreatable( [ "title" ], [ "state", "description", "due_on" ], __modifyAttributesForObjectsReferingRepo ) ), - ExternalListOfObjects( "issues", Issue, + ExternalListOfObjects( "issues", "issue", Issue, ListGetable( [], [ "milestone", "state", "assignee", "mentioned", "labels", "sort", "direction", "since" ], __modifyAttributesForObjectsReferingRepo ), - ElementGetable( "issue", lambda repo, number: { "_repo": repo, "number": number } ), - ElementCreatable( "issue", [ "title" ], [ "body", "assignee", "milestone", "labels", ], __modifyAttributesForObjectsReferingRepo ) + ElementGetable( lambda repo, number: { "_repo": repo, "number": number } ), + ElementCreatable( [ "title" ], [ "body", "assignee", "milestone", "labels", ], __modifyAttributesForObjectsReferingRepo ) ), ExternalSimpleAttribute( "languages" ), - ExternalListOfObjects( "downloads", Download, + ExternalListOfObjects( "downloads", "download", Download, ListGetable( [], [], __modifyAttributesForObjectsReferingRepo ), - ElementGetable( "download", lambda repo, id : { "_repo": repo, "number": number } ), - ElementCreatable( "download", [ "name", "size" ], [ "description", "content_type" ], __modifyAttributesForObjectsReferingRepo ), + ElementGetable( lambda repo, id : { "_repo": repo, "number": number } ), + ElementCreatable( [ "name", "size" ], [ "description", "content_type" ], __modifyAttributesForObjectsReferingRepo ), ), - ExternalListOfObjects( "comments", CommitComment, + ExternalListOfObjects( "comments", "comment", CommitComment, ListGetable( [], [], __modifyAttributesForObjectsReferingRepo ), - ElementGetable( "comment", lambda repo, id : { "_repo": repo, "id": id } ), + ElementGetable( lambda repo, id : { "_repo": repo, "id": id } ), ), - ExternalListOfObjects( "commits", Commit, + ExternalListOfObjects( "commits", "commit", Commit, ListGetable( [], [ "sha", "path" ], __modifyAttributesForObjectsReferingRepo ), - ElementGetable( "commit", lambda repo, sha : { "_repo": repo, "sha": sha } ), + ElementGetable( lambda repo, sha : { "_repo": repo, "sha": sha } ), ), - ExternalListOfObjects( "tags", Tag, + ExternalListOfObjects( "tags", "tag", Tag, ListGetable( [], [], __modifyAttributesForObjectsReferingRepo ), ), - ExternalListOfObjects( "branches", Branch, + ExternalListOfObjects( "branches", "branch", Branch, ListGetable( [], [], __modifyAttributesForObjectsReferingRepo ), ), ) Repository._addAttributePolicy( InternalObjectAttribute( "parent", Repository ) ) Repository._addAttributePolicy( InternalObjectAttribute( "source", Repository ) ) -Repository._addAttributePolicy( ExternalListOfObjects( "forks", Repository, ListGetable( [], [] ) ) ) +Repository._addAttributePolicy( ExternalListOfObjects( "forks", "fork", Repository, ListGetable( [], [] ) ) ) -__repoElementCreatable = ElementCreatable( "repo", [ "name" ], [ "description", "homepage", "private", "has_issues", "has_wiki", "has_downloads", "team_id", ] ) -__repoElementGetable = ElementGetable( "repo", lambda obj, name: { "owner": { "login": obj.login }, "name": name } ) +__repoElementCreatable = ElementCreatable( [ "name" ], [ "description", "homepage", "private", "has_issues", "has_wiki", "has_downloads", "team_id", ] ) +__repoElementGetable = ElementGetable( lambda obj, name: { "owner": { "login": obj.login }, "name": name } ) __repoListGetable = ListGetable( [], [] ) -AuthenticatedUser._addAttributePolicy( ExternalListOfObjects( "repos", Repository, __repoListGetable, __repoElementGetable, __repoElementCreatable ) ) -NamedUser._addAttributePolicy( ExternalListOfObjects( "repos", Repository, __repoListGetable, __repoElementGetable ) ) -Organization._addAttributePolicy( ExternalListOfObjects( "repos", Repository, __repoListGetable, __repoElementGetable, __repoElementCreatable ) ) +AuthenticatedUser._addAttributePolicy( ExternalListOfObjects( "repos", "repo", Repository, __repoListGetable, __repoElementGetable, __repoElementCreatable ) ) +NamedUser._addAttributePolicy( ExternalListOfObjects( "repos", "repo", Repository, __repoListGetable, __repoElementGetable ) ) +Organization._addAttributePolicy( ExternalListOfObjects( "repos", "repo", Repository, __repoListGetable, __repoElementGetable, __repoElementCreatable ) ) -AuthenticatedUser._addAttributePolicy( ExternalListOfObjects( "watched", Repository, ListGetable( [], [] ), ElementAddable(), ElementRemovable(), ElementHasable() ) ) -NamedUser._addAttributePolicy( ExternalListOfObjects( "watched", Repository, ListGetable( [], [] ) ) ) +AuthenticatedUser._addAttributePolicy( ExternalListOfObjects( "watched", "watched", Repository, ListGetable( [], [] ), ElementAddable(), ElementRemovable(), ElementHasable() ) ) +NamedUser._addAttributePolicy( ExternalListOfObjects( "watched", "watched", Repository, ListGetable( [], [] ) ) ) def __createForkForUser( user, repo ): assert isinstance( repo, Repository ) @@ -357,9 +357,9 @@ Team = GithubObject( ), Editable( [ "name" ], [ "permission" ] ), Deletable(), - ExternalListOfObjects( "members", NamedUser, ListGetable( [], [] ), ElementAddable(), ElementRemovable(), ElementHasable() ), - ExternalListOfObjects( "repos", Repository, ListGetable( [], [] ), ElementAddable(), ElementRemovable(), ElementHasable() ), + ExternalListOfObjects( "members", "member", NamedUser, ListGetable( [], [] ), ElementAddable(), ElementRemovable(), ElementHasable() ), + ExternalListOfObjects( "repos", "repo", Repository, ListGetable( [], [] ), ElementAddable(), ElementRemovable(), ElementHasable() ), ) -Organization._addAttributePolicy( ExternalListOfObjects( "teams", Team, ListGetable( [], [] ), ElementCreatable( "team", [ "name" ], [ "repo_names", "permission" ] ) ) ) -Repository._addAttributePolicy( ExternalListOfObjects( "teams", Team, ListGetable( [], [] ) ) ) +Organization._addAttributePolicy( ExternalListOfObjects( "teams", "team", Team, ListGetable( [], [] ), ElementCreatable( [ "name" ], [ "repo_names", "permission" ] ) ) ) +Repository._addAttributePolicy( ExternalListOfObjects( "teams", "team", Team, ListGetable( [], [] ) ) ) diff --git a/github/ObjectCapacities/List.py b/github/ObjectCapacities/List.py index 82940485..abe0d8ad 100644 --- a/github/ObjectCapacities/List.py +++ b/github/ObjectCapacities/List.py @@ -5,9 +5,11 @@ from TypePolicies import * from ArgumentsChecker import * class ListCapacity: - def setList( self, attributeName, typePolicy ): + def setList( self, attributeName, singularName, typePolicy ): self.attributeName = attributeName + self.singularName = singularName self.safeAttributeName = attributeName.replace( "/", "_" ) + self.safeSingularName = singularName.replace( "/", "_" ) self.typePolicy = typePolicy class ElementAddable( ListCapacity ): @@ -32,25 +34,23 @@ class ElementHasable( ListCapacity ): return obj._github._statusRequest( "GET", obj._baseUrl + "/" + self.attributeName + "/" + self.typePolicy.getIdentity( toBeQueried ), None, None ) == 204 class ElementCreatable( ListCapacity ): - def __init__( self, singularName, mandatoryParameters, optionalParameters, modifyAttributes = lambda obj, attributes: attributes ): + def __init__( self, mandatoryParameters, optionalParameters, modifyAttributes = lambda obj, attributes: attributes ): self.__argumentsChecker = ArgumentsChecker( mandatoryParameters, optionalParameters ) - self.__createName = "create_" + singularName self.__modifyAttributes = modifyAttributes def apply( self, cls ): - cls._addMethod( self.__createName, self.__execute ) + cls._addMethod( "create_" + self.singularName, self.__execute ) 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 ) ) ) class ElementGetable( ListCapacity ): - def __init__( self, singularName, attributes ): - self.__getName = "get_" + singularName + def __init__( self, attributes ): self.__attributes = attributes def apply( self, cls ): - cls._addMethod( self.__getName, self.__execute ) + cls._addMethod( "get_" + self.singularName, self.__execute ) def __execute( self, obj, *args, **kwds ): return self.typePolicy.createNonLazy( obj, self.__attributes( obj, *args, **kwds ) ) @@ -98,12 +98,12 @@ class ListDeletable( ListCapacity ): def __execute( self, obj ): obj._github._statusRequest( "DELETE", obj._baseUrl + "/" + self.attributeName, None, None ) -def ExternalListOfObjects( attributeName, type, *capacities ): +def ExternalListOfObjects( attributeName, singularName, type, *capacities ): for capacity in capacities: - capacity.setList( attributeName, ObjectTypePolicy( type ) ) + capacity.setList( attributeName, singularName, ObjectTypePolicy( type ) ) return SeveralAttributePolicies( capacities ) -def ExternalListOfSimpleTypes( attributeName, *capacities ): +def ExternalListOfSimpleTypes( attributeName, singularName, *capacities ): for capacity in capacities: - capacity.setList( attributeName, SimpleTypePolicy() ) + capacity.setList( attributeName, singularName, SimpleTypePolicy() ) return SeveralAttributePolicies( capacities )