(batch: List[Any], n: Optional[int])
Chunk the batch into chunks of upto to n items (each)
Chunk the batch into chunks of upto to n items (each)
Chunk the batch into chunks of upto to n items ( each )
def chunks(batch: List[Any], n: Optional[int]) -> Iterable[List[Any]]:
        """
        Chunk the batch into chunks of upto to n items (each)
        """
        if n is None:
            n = len(batch)
        if n < 1:
            raise ValueError("n must be an integer greater than 0")
        for i in range(0, len(batch), n):
            yield batch[i : i + n]
def chunks ( batch : List [ Any ] , n : Optional [ int ] ) -> Iterable [ List [ Any ] ] : if n is None : n = len ( batch ) if n < 1 : raise ValueError ( "n must be an integer greater than 0" ) for i in range ( 0 , len ( batch ) , n ) : yield batch [ i : i + n ]