.. _jgdv.structs.chainguard._base: ============================= jgdv.structs.chainguard._base ============================= .. py:module:: jgdv.structs.chainguard._base .. autoapi-nested-parse:: The core implementation of the ChainGuard object, which is then extended with mixins. Type Aliases ------------ .. autoapisummary:: jgdv.structs.chainguard._base.InputData Classes ------- .. autoapisummary:: jgdv.structs.chainguard._base.GuardBase Module Contents =============== .. py:data:: InputData :type: TypeAlias :value: dict .. _jgdv.structs.chainguard._base.GuardBase: .. py:class:: GuardBase(data = None, *, index = None, mutable = False) Bases: :py:obj:`dict` Provides access to toml data (ChainGuard.load(apath)) but as attributes (data.a.path.in.the.data) instead of key access (data['a']['path']['in']['the']['data']) while also providing typed, guarded access: data.on_fail("test", str | int).a.path.that.may.exist() while it can then report missing paths: data.report_defaulted() -> ['a.path.that.may.exist.'] .. py:method:: _index(sub = None) -> .. py:method:: _table() -> .. py:method:: get(key, default = None) -> Return the value for key if key is in the dictionary, else default. .. py:method:: items() -> D.items() -> a set-like object providing a view on D's items .. py:method:: keys() -> D.keys() -> a set-like object providing a view on D's keys .. py:method:: update(*args) -> D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k] .. py:method:: values() -> D.values() -> an object providing a view on D's values