def delete_members(self, group_name, members, batchsize=50): """Remove uwnetids in list ``members`` from the specified group in batches of size ``batchsize``. """ for chunk in grouper(members, batchsize): endpoint = path.join('group', group_name, 'member', ','.join(chunk)) self._request('DELETE', endpoint)
def add_members(self, group_name, members, batchsize=50): """Add uwnetids in list ``members`` to the specified group in batches of size ``batchsize``. """ for chunk in grouper(members, batchsize): endpoint = path.join('group', group_name, 'member', ','.join(chunk)) self._request('PUT', endpoint)
def test02(self): items = range(10) chunks = list(grouper(items, 4, fill=True)) self.assertEquals(chunks[-1], (8, 9, None, None))
def test01(self): items = range(10) chunks = list(grouper(items, 4)) self.assertEquals(chunks[-1], (8, 9))