def chunk_iter(replicas): chunker = Chunker(chunk_size=chunk_size, max_record_size=max_record_size) return chunker.chunks(result_iterator([replicas], **kwargs))
def chunk_iter(replicas): chunker = Chunker(chunk_size=chunk_size) return chunker.chunks(classic_iterator([replicas], **kwargs))
def test_less_than_a_hunk(self): records = _sizelimitedinput(HUNK_SIZE / 2) chunker = Chunker(chunk_size=HUNK_SIZE * 2) chunks = list(chunker.chunks(records)) self.assertEqual(len(chunks), 1)
def test_more_than_a_hunk(self): chunk_size = HUNK_SIZE * 2 records = _sizelimitedinput(chunk_size) chunker = Chunker(chunk_size=chunk_size) chunks = list(chunker.chunks(records)) self.assertEqual(len(chunks), 1)
def __iter__(self): chunker = Chunker(chunk_size=self.chunk_size) for chunk in chunker.chunks(RecordIter([self.url], **self.kwargs)): yield chunk