Skip to content

unienv_data.storages.dict_storage

Classes:

Name Description
DictStorage

Functions:

Name Description
map_transform
get_chained_residual_space
get_chained_space

DictStorage

DictStorage(
    single_instance_space: DictSpace[BDeviceType, BDtypeType, BRNGType],
    storage_map: Dict[
        str, SpaceStorage[BArrayType, BArrayType, BDeviceType, BDtypeType, BRNGType]
    ],
    cache_filename: Optional[Union[str, PathLike]] = None,
    nested_separator: str = "/",
)

Bases: SpaceStorage[Dict[str, Any], BArrayType, BDeviceType, BDtypeType, BRNGType]

Methods:

Name Description
create
load_from
extend_length
shrink_length
mark_segment_start
append
mark_segment_end
open_segment_writer
abort_segment
get_segments
get_flattened
get
set_flattened
set
get_subspace_by_key
get_column
clear
dumps
close

Attributes:

Name Type Description
single_file_ext
storage_map
nested_separator
cache_filename Optional[Union[str, PathLike]]
is_mutable bool
is_multiprocessing_safe bool
capacity Optional[int]
has_open_segment bool
pending_segment_length int
backend ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType]
device Optional[BDeviceType]
single_instance_space

single_file_ext class-attribute instance-attribute

single_file_ext = None

storage_map instance-attribute

storage_map = storage_map

nested_separator instance-attribute

nested_separator = nested_separator

cache_filename property

cache_filename: Optional[Union[str, PathLike]]

is_mutable property

is_mutable: bool

is_multiprocessing_safe property

is_multiprocessing_safe: bool

capacity property

capacity: Optional[int]

has_open_segment property

has_open_segment: bool

pending_segment_length property

pending_segment_length: int

backend property

backend: ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType]

device property

device: Optional[BDeviceType]

single_instance_space instance-attribute

single_instance_space = single_instance_space

create classmethod

create(
    single_instance_space: Space[Any, BDeviceType, BDtypeType, BRNGType],
    storage_cls_map: Dict[str, Type[SpaceStorage]],
    *args,
    capacity: Optional[int] = None,
    cache_path: Optional[str] = None,
    multiprocessing: bool = False,
    key_kwargs: Dict[str, Any] = {},
    type_kwargs: Dict[
        Type[SpaceStorage[Any, BArrayType, BDeviceType, BDtypeType, BRNGType]],
        Dict[str, Any],
    ] = {},
    nested_separator: str = "/",
    **kwargs,
) -> DictStorage[BArrayType, BDeviceType, BDtypeType, BRNGType]

load_from classmethod

load_from(
    path: Union[str, PathLike],
    single_instance_space: Space[Any, BDeviceType, BDtypeType, BRNGType],
    *,
    capacity: Optional[int] = None,
    read_only: bool = True,
    multiprocessing: bool = False,
    key_kwargs: Dict[str, Any] = {},
    type_kwargs: Dict[
        Type[SpaceStorage[Any, BArrayType, BDeviceType, BDtypeType, BRNGType]],
        Dict[str, Any],
    ] = {},
    **kwargs,
) -> DictStorage[BArrayType, BDeviceType, BDtypeType, BRNGType]

extend_length

extend_length(length)

shrink_length

shrink_length(length)

mark_segment_start

mark_segment_start(start_index: int) -> None

append

append(value) -> None

mark_segment_end

mark_segment_end() -> None

open_segment_writer

open_segment_writer() -> SegmentWriter

abort_segment

abort_segment() -> None

get_segments

get_segments()

get_flattened

get_flattened(index)

get

get(index)

set_flattened

set_flattened(index, value)

set

set(index, value)

get_subspace_by_key

get_subspace_by_key(key: str) -> Space[Any, BDeviceType, BDtypeType, BRNGType]

get_column

get_column(
    nested_keys: Sequence[str],
) -> SpaceStorage[Any, BDeviceType, BDtypeType, BRNGType]

clear

clear()

dumps

dumps(path)

close

close()

map_transform

map_transform(
    data: Dict[str, Any],
    value_map: Dict[str, Any],
    fn: Callable[[str, Any, Any], Any],
    prefix: str = "",
    nested_separator: str = "/",
) -> Tuple[Dict[str, Any], Dict[str, Any]]

get_chained_residual_space

get_chained_residual_space(
    space: DictSpace[BDeviceType, BDtypeType, BRNGType],
    all_keys: List[str],
    prefix: str = "",
    nested_separator: str = "/",
) -> Optional[DictSpace[BDeviceType, BDtypeType, BRNGType]]

get_chained_space

get_chained_space(
    space: DictSpace[BDeviceType, BDtypeType, BRNGType],
    key_chain: str,
    all_keys: List[str],
    nested_separator: str = "/",
) -> Optional[Space[Any, BDeviceType, BDtypeType, BRNGType]]