jgdv.structs.chainguard._base

The core implementation of the ChainGuard object, which is then extended with mixins.

Type Aliases

InputData

Classes

GuardBase

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,
)[source]

Bases: 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.<str|int>’]

Parameters:
_index(sub=None) <Unknown>[source]
Parameters:

sub (jgdv.Maybe[int | str | tuple[int | str, Ellipsis]])

Return type:

tuple[int | str, Ellipsis]

_table() <Unknown>[source]
Return type:

dict

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:

collections.abc.ItemsView

keys() <Unknown>[source]

D.keys() -> a set-like object providing a view on D’s keys

Return type:

collections.abc.KeysView[str]

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

values() <Unknown>[source]

D.values() -> an object providing a view on D’s values

Return type:

list | collections.abc.ValuesView