ValueMap

class dsviper.ValueMap

Bases: object

A class used to represent a value of type map<key_type, element_type>. Seamless with a Python dict[object, object].

Or use Value.create(type_map [, initial_value]).

at(key: _InputValues, *, encoded: bool = True) _OutputValues

Return the value for a key.

static cast(value: Value) ValueMap

Return a map or raise.

clear() None

Remove all items.

contains(key: _InputValues) bool

Return True if the value is present.

copy() ValueMap

Return a deep copy.

description(*, namespace: NameSpace | None = None) str

Return the description.

discard(key: _InputValues) None

Remove the key if present.

empty() bool

Return True if the container is empty.

get(key: _InputValues, default: _InputValues | None = None) None | _OutputValues

Return the value associated with the key or default.

hash() int

Return the hash value.

items(*, encoded: bool = True) ValueMapItemsIter

Return a MapItemsIter.

keys(*, encoded: bool = True) ValueMapKeysIter

Return a MapKeysIter.

max(*, encoded: bool = True) _OutputValues

Return the max key.

min(*, encoded: bool = True) _OutputValues

Return the min key.

pop(key: _InputValues, default: _InputValues | None = None, *, encoded: bool = True) _OutputValues

Remove the key and return the corresponding value. If the key is not found, return the default if given; otherwise raise.

popitem() ValueTuple

Remove and return a (key, value) pair as a 2-tuple. Raises error if the map is empty.

remove(key: _InputValues) None

Remove the key or raises.

representation() str

Return the representation.

set(key: _InputValues, value: _InputValues) None

Set the value for a key.

setdefault(key: _InputValues, value: _InputValues) None

Insert the value for the key if the key is not in the map. Return the value for the key if the key is in the map, else default.

size() int

Return the number of elements.

type() Type

Return the type.

type_code() str

Return the type code.

type_map() TypeMap

Return the type map<key_type, element_type>.

update(value: _InputValues) None

for k, v in other: self[key] = v.

values(*, encoded: bool = True) ValueMapValuesIter

Return a MapValuesIter.