@@ -1626,28 +1626,27 @@ def add_subgroup(self, parent_uuid, child_uuid):
16261626 response = self .api_post_uri (url , uri_list = data , params = None )
16271627 if response .status_code == 204 :
16281628 return True
1629- elif response .status_code == 401 :
1629+ if response .status_code == 401 :
16301630 logging .error ("You are not authenticated" )
16311631 return False
1632- elif response .status_code == 403 :
1632+ if response .status_code == 403 :
16331633 logging .error ("You are not logged in with sufficient permissions" )
16341634 return False
1635- elif response .status_code == 404 :
1635+ if response .status_code == 404 :
16361636 logging .error ("The parent group doesn't exist" )
16371637 return False
1638- elif response .status_code == 422 :
1638+ if response .status_code == 422 :
16391639 logging .error (
16401640 "The specified group is not found, or if adding the group would create a cyclic reference"
16411641 )
16421642 return False
1643- else :
1644- logging .error (
1645- "Failed to add subgroup %s to group %s: %s" ,
1646- child_uuid ,
1647- parent_uuid ,
1648- response .text ,
1649- )
1650- return False
1643+ logging .error (
1644+ "Failed to add subgroup %s to group %s: %s" ,
1645+ child_uuid ,
1646+ parent_uuid ,
1647+ response .text ,
1648+ )
1649+ return False
16511650
16521651 def remove_subgroup (self , parent_uuid , child_uuid ):
16531652 """
@@ -1663,23 +1662,22 @@ def remove_subgroup(self, parent_uuid, child_uuid):
16631662 if response .status_code == 401 :
16641663 logging .error ("You are not authenticated" )
16651664 return False
1666- elif response .status_code == 403 :
1665+ if response .status_code == 403 :
16671666 logging .error ("You are not logged in with sufficient permissions" )
16681667 return False
1669- elif response .status_code == 404 :
1668+ if response .status_code == 404 :
16701669 logging .error ("The parent group doesn't exist" )
16711670 return False
1672- elif response .status_code == 422 :
1671+ if response .status_code == 422 :
16731672 logging .error ("The specified group is not found" )
16741673 return False
1675- else :
1676- logging .error (
1677- "Failed to remove subgroup %s from group %s: %s" ,
1678- child_uuid ,
1679- parent_uuid ,
1680- response .text ,
1681- )
1682- return False
1674+ logging .error (
1675+ "Failed to remove subgroup %s from group %s: %s" ,
1676+ child_uuid ,
1677+ parent_uuid ,
1678+ response .text ,
1679+ )
1680+ return False
16831681
16841682 def search_groups_by_metadata (self , query , page = 0 , size = 20 ):
16851683 """
@@ -1749,23 +1747,22 @@ def add_eperson_to_group(self, group_uuid, eperson_uuid):
17491747 response = self .api_post_uri (url , uri_list = data , params = None )
17501748 if response .status_code == 204 :
17511749 return True
1752- elif response .status_code == 401 :
1750+ if response .status_code == 401 :
17531751 logging .error ("You are not authenticated" )
17541752 return False
1755- elif response .status_code == 403 :
1753+ if response .status_code == 403 :
17561754 logging .error ("You are not logged in with sufficient permissions" )
17571755 return False
1758- elif response .status_code == 422 :
1756+ if response .status_code == 422 :
17591757 logging .error ("The specified group or EPerson is not found" )
17601758 return False
1761- else :
1762- logging .error (
1763- "Failed to add EPerson %s to group %s: %s" ,
1764- eperson_uuid ,
1765- group_uuid ,
1766- response .text ,
1767- )
1768- return False
1759+ logging .error (
1760+ "Failed to add EPerson %s to group %s: %s" ,
1761+ eperson_uuid ,
1762+ group_uuid ,
1763+ response .text ,
1764+ )
1765+ return False
17691766
17701767 def remove_eperson_from_group (self , group_uuid , eperson_uuid ):
17711768 """
@@ -1778,23 +1775,22 @@ def remove_eperson_from_group(self, group_uuid, eperson_uuid):
17781775 response = self .api_delete (url , params = None )
17791776 if response .status_code == 204 :
17801777 return True
1781- elif response .status_code == 401 :
1778+ if response .status_code == 401 :
17821779 logging .error ("You are not authenticated" )
17831780 return False
1784- elif response .status_code == 403 :
1781+ if response .status_code == 403 :
17851782 logging .error ("You are not logged in with sufficient permissions" )
17861783 return False
1787- elif response .status_code == 422 :
1784+ if response .status_code == 422 :
17881785 logging .error ("The specified group or EPerson is not found" )
17891786 return False
1790- else :
1791- logging .error (
1792- "Failed to remove EPerson %s from group %s: %s" ,
1793- eperson_uuid ,
1794- group_uuid ,
1795- response .text ,
1796- )
1797- return False
1787+ logging .error (
1788+ "Failed to remove EPerson %s from group %s: %s" ,
1789+ eperson_uuid ,
1790+ group_uuid ,
1791+ response .text ,
1792+ )
1793+ return False
17981794
17991795 def update_group_name (self , uuid , new_name ):
18001796 """
@@ -1817,7 +1813,7 @@ def delete_group(self, uuid):
18171813 @return: Boolean indicating success or failure
18181814 """
18191815 url = f"{ self .API_ENDPOINT } /eperson/groups/{ uuid } "
1820- response = self .api_delete (url )
1816+ response = self .api_delete (url , params = None )
18211817 if response .status_code == 204 :
18221818 return True
18231819 else :
0 commit comments