Skip to content

State

SP state API wrappers.

kxi.sp.state.Unpickle (IntEnum)

An enumeration.

kxi.sp.state.Unpickle.auto

kxi.sp.state.Unpickle.false

kxi.sp.state.Unpickle.true

kxi.sp.state.Pickle (IntEnum)

An enumeration.

kxi.sp.state.Pickle.false

kxi.sp.state.Pickle.true

kxi.sp.state.get

Get the state of an operator.

Parameters:

Name Type Description Default
operator Union[str, pykx.wrappers.SymbolAtom, pykx.wrappers.Dictionary]

The operator, specified as a configuration dictionary or name.

required
metadata Dictionary

The metadata dictionary, provided for specialized data retrieval.

required
unpickle Unpickle

A Unpickle enum value representing whether the retrieved data should be unpickled. Can be provided as a boolean. Defaults to Unpickle.auto, which unpickles the data only if it appears to be bytes in a pickled format.

<Unpickle.auto: 2>

Returns:

Type Description
Any

The data that was stored in the operator's state.

kxi.sp.state.set

Set the state of an operator.

Parameters:

Name Type Description Default
operator Union[str, pykx.wrappers.SymbolAtom, pykx.wrappers.Dictionary]

The operator, specified as a configuration dictionary or name.

required
metadata Dictionary

The metadata dictionary, provided for specialized data storage.

required
data Any

The data to be stored. By default the data will be converted to a pykx.K object using the default conversion logic. To store the object as-is set pickle=True.

required
pickle Pickle

A Pickle enum value representing whether the data should be pickled or not. Can be provided as a boolean.

<Pickle.false: 0>

Returns:

Type Description
Any

The data that was stored in the operator's state.