From dabf8789b9b4c13a552a1eb5164d4c0a82732663 Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Mon, 13 Feb 2012 22:50:51 +0100 Subject: [PATCH] add_, remove_ -> add_to_, remove_from_ --- Design.md | 4 ++-- IntegrationTest.py | 8 ++++---- Reference.md | 18 +++++++++--------- github/GithubObject.UnitTest.py | 4 ++-- github/GithubObject.py | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Design.md b/Design.md index 41ec4541..7cd6ba78 100644 --- a/Design.md +++ b/Design.md @@ -15,10 +15,10 @@ List: - elements GET-able or not - to ask if an element is in the list - elements PUT-able or not - - add an existing element to the list: parent.add_element( element ) + - add an existing element to the list: parent.add_to_elements( element ) - POST-able or not - create a new element and add it to the list: parent.create_element( ... ) - elements DELETE-able or not - delete an element from a list can have two meanings: - the element's life is finished: element.delete() - - the element is just removed from the list, but continues to live somewhere else: parent.remove_element( element ) + - the element is just removed from the list, but continues to live somewhere else: parent.remove_from_elements( element ) diff --git a/IntegrationTest.py b/IntegrationTest.py index 32d50ca6..81f07020 100644 --- a/IntegrationTest.py +++ b/IntegrationTest.py @@ -44,12 +44,12 @@ u = g.get_user() # u.edit( bio = u.bio + "(Edited by PyGithub)" ) # print "Bio after:", u.bio -# u.remove_following( g.get_user( "Lyloa" ) ) -# u.add_following( g.get_user( "Lyloa" ) ) +# u.remove_from_following( g.get_user( "Lyloa" ) ) +# u.add_to_following( g.get_user( "Lyloa" ) ) # for r in g.get_user( "cjuniet" ).get_repos(): - # u.add_watched( r ) - # u.remove_watched( r ) + # u.add_to_watched( r ) + # u.remove_from_watched( r ) # o = g.get_organization( "BeaverSoftware" ) # o.edit( location = "Paris, France" ) diff --git a/Reference.md b/Reference.md index 812cdb18..0b5d89b8 100644 --- a/Reference.md +++ b/Reference.md @@ -77,7 +77,7 @@ /orgs/:org/members/:user ======================== - GET: `` (TODO SOON) - - DELETE: `Organization.remove_members( user )` + - DELETE: `Organization.remove_from_members( user )` /orgs/:org/public_members ========================= @@ -86,8 +86,8 @@ /orgs/:org/public_members/:user =============================== - GET: `` (TODO SOON) - - PUT: `Organization.add_public_members( user )` - - DELETE: `Organization.remove_public_members( user )` + - PUT: `Organization.add_to_public_members( user )` + - DELETE: `Organization.remove_from_public_members( user )` /orgs/:org/repos ================ @@ -115,8 +115,8 @@ /repos/:user/:repo/collaborators/:user ====================================== - GET: `` (TODO SOON) - - PUT: `Repository.add_collaborators( user )` - - DELETE: `Repository.remove_collaborators( user )` + - PUT: `Repository.add_to_collaborators( user )` + - DELETE: `Repository.remove_from_collaborators( user )` /repos/:user/:repo/comments =========================== @@ -408,8 +408,8 @@ /user/following/:user ===================== - GET: `` (TODO SOON) - - PUT: `AuthenticatedUser.add_following( user )` - - DELETE: `AuthenticatedUser.remove_following( user )` + - PUT: `AuthenticatedUser.add_to_following( user )` + - DELETE: `AuthenticatedUser.remove_from_following( user )` /user/keys ========== @@ -438,8 +438,8 @@ /user/watched/:user/:repo ========================= - GET: `` (TODO SOON) - - PUT: `AuthenticatedUser.add_watched( repo )` - - DELETE: `AuthenticatedUser.remove_watched( repo )` + - PUT: `AuthenticatedUser.add_to_watched( repo )` + - DELETE: `AuthenticatedUser.remove_from_watched( repo )` /users/:user ============ diff --git a/github/GithubObject.UnitTest.py b/github/GithubObject.UnitTest.py index 661ce692..52ee9768 100644 --- a/github/GithubObject.UnitTest.py +++ b/github/GithubObject.UnitTest.py @@ -220,11 +220,11 @@ class GithubObjectWithModifiableExtendedListAttribute( TestCaseWithGithubTestObj def testAddToList( self ): a3ToAdd = self.ContainedObject( self.g.object, { "id": "idAdd", "name": "nameAdd" }, lazy = True ) self.expectPut( "/test/a3s/idAdd" ).andReturn( {} ) - self.o.add_a3s( a3ToAdd ) + self.o.add_to_a3s( a3ToAdd ) def testRemoveFromList( self ): a3ToRemove = self.ContainedObject( self.g.object, { "id": "idRemove", "name": "nameRemove" }, lazy = True ) self.expectDelete( "/test/a3s/idRemove" ).andReturn( {} ) - self.o.remove_a3s( a3ToRemove ) + self.o.remove_from_a3s( a3ToRemove ) unittest.main() diff --git a/github/GithubObject.py b/github/GithubObject.py index 64d3ab6e..69db6e82 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -104,11 +104,11 @@ class ExtendedListAttribute: self.__type = type self.__getName = "get_" + attributeName if addable: - self.__addName = "add_" + attributeName + self.__addName = "add_to_" + attributeName else: self.__addName = None if removable: - self.__removeName = "remove_" + attributeName + self.__removeName = "remove_from_" + attributeName else: self.__removeName = None