n_const.data_format

class DataClass(**kwargs)[source]

Bases: SimpleNamespace

Storage of constant values.

Both attribute access and dict-like key access are supported. Dict methods are almost fully supported except [fromkeys|setdefault].

Parameters

kwargs (Any) – Arbitrary number of parameters in key=value format.

Examples

>>> param = DataClass(a=50, b="abc")
>>> param.a
50
>>> param["b"]
'abc'
clear()[source]

Equivalent to dict.clear() method.

Return type

None

copy()[source]

Equivalent to dict.copy() method.

Return type

DataClass

get(key, default=None)[source]

Equivalent to dict.get(key, default) method.

Parameters
  • key (Hashable) –

  • default (Optional[Any]) –

Return type

Any

items()[source]

Equivalent to dict.items() method.

Return type

ItemsView

keys()[source]

Equivalent to dict.keys() method.

Return type

KeysView

pop(key, default=<class 'KeyError'>)[source]

Equivalent to dict.pop(key, default) method.

Parameters
  • key (Hashable) –

  • default (Any) –

Return type

Any

popitem()[source]

Equivalent to dict.popitem() method.

Return type

Tuple[Hashable, Any]

update(other)[source]

Equivalent to dict.update() method.

Parameters

other (DataClass) –

Return type

None

values()[source]

Equivalent to dict.values() method.

Return type

ValuesView