CppDict

class dictIO.cpp_dict.CppDict(**kwargs: Any)
class dictIO.cpp_dict.CppDict(arg: Mapping[str, Any], **kwargs: Any)
class dictIO.cpp_dict.CppDict(arg: Iterable[tuple[str, Any]], **kwargs: Any)
class dictIO.cpp_dict.CppDict(arg: str | os.PathLike[str], **kwargs: Any)

Bases: SDict[str, Any]

Data structure for C++ dictionaries.

This class is deprecated and will be removed in 0.5.0. Use SDict[K, V] instead.

__init__(**kwargs: Any) None
__init__(arg: Mapping[str, Any], **kwargs: Any) None
__init__(arg: Iterable[tuple[str, Any]], **kwargs: Any) None
__init__(arg: str | os.PathLike[str], **kwargs: Any) None

Methods

__init__()

clear()

copy()

Return a shallow copy of the SDict instance.

dump([target_file])

Dump the content of the current SDict instance into a dict file.

find_global_key([query])

Return the global key thread to the first key the value of which matches the passed in query.

fromkeys(iterable[, value])

Create a new SDict instance from the keys of an iterable.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

global_key_exists(global_key)

Check whether the specified global key exists.

include(dict_to_include)

Add an include directive for the passed in dict.

items()

keys()

load(source_file)

Load a dict file into this SDict instance.

merge(other)

Merge the passed in dict into the existing SDict instance.

order_keys()

alpha-numeric sorting of keys, recursively.

pop(k[,d])

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem()

Remove and return a (key, value) pair as a 2-tuple.

reduce_scope(scope)

Reduces the dict to the keys defined in scope.

reset()

Reset the dict.

set_global_key(global_key, value)

Set the value for the passed in global key.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([m])

Update top-level keys with the keys from the passed in dict.

values()

Attributes

data

Mimick the data property of the CppDict class from dictIO <= v0.3.4.

name

Return the name of the source file of the SDict instance.

path

Return the path of the source file of the SDict instance.

source_file

Return the source file of the SDict instance.

variables

Returns a dict with all Variables currently registered.