Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
ray / purelib / ray / data / _internal / block_builder.py
Size: Mime:
from typing import Generic

from ray.data.block import Block, BlockAccessor, T


class BlockBuilder(Generic[T]):
    """A builder class for blocks."""

    @staticmethod
    def for_block(block: Block) -> "BlockBuilder[T]":
        return BlockAccessor.for_block(block).builder()

    def add(self, item: T) -> None:
        """Append a single row to the block being built."""
        raise NotImplementedError

    def add_block(self, block: Block) -> None:
        """Append an entire block to the block being built."""
        raise NotImplementedError

    def build(self) -> Block:
        """Build the block."""
        raise NotImplementedError

    def num_rows(self) -> int:
        """Return the number of rows added in the block."""
        raise NotImplementedError

    def get_estimated_memory_usage(self) -> int:
        """Return the estimated memory usage so far in bytes."""
        raise NotImplementedError