jgdv.structs.chainguard._base
The core implementation of the ChainGuard object, which is then extended with mixins.
Type Aliases
Classes
Provides access to toml data (ChainGuard.load(apath)) |
Module Contents
- jgdv.structs.chainguard._base.InputData: TypeAlias = dict
- class jgdv.structs.chainguard._base.GuardBase(
- data=None,
- *,
- index=None,
- mutable=False,
Bases:
dictProvides 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.<str|int>’]
- Parameters:
data (jgdv.Maybe[InputData])
index (jgdv.Maybe[collections.abc.Iterable[int | str]])
mutable (bool)
- get(key, default=None) <Unknown>[source]
Return the value for key if key is in the dictionary, else default.
- Parameters:
key (str)
default (jgdv.Maybe)
- Return type:
jgdv.Maybe
- items() <Unknown>[source]
D.items() -> a set-like object providing a view on D’s items
- Return type:
- update(*args) <Unknown>[source]
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]
- Return type:
Never