.. _jgdv.structs.chainguard._interface: ================================== jgdv.structs.chainguard._interface ================================== .. py:module:: jgdv.structs.chainguard._interface Type Aliases ------------ .. autoapisummary:: jgdv.structs.chainguard._interface.ProxyWrapper jgdv.structs.chainguard._interface.TomlTypes Protocols --------- .. autoapisummary:: jgdv.structs.chainguard._interface.ChainGuard_i jgdv.structs.chainguard._interface.ChainGuard_p jgdv.structs.chainguard._interface.ChainProxy_p jgdv.structs.chainguard._interface.ProxyEntry_p Module Contents =============== .. py:data:: ProxyWrapper :type: TypeAlias :value: Callable[[*Any], T] .. py:data:: TomlTypes :type: TypeAlias :value: str | int | float | bool | list[TomlTypes] | dict[str, TomlTypes] | datetime.datetime .. _jgdv.structs.chainguard._interface.ChainGuard_i: .. py:class:: ChainGuard_i(data = None, *, index = None, mutable = False) Bases: :py:obj:`ChainGuard_p`, :py:obj:`Protocol` The interface for a base ChainGuard object .. _jgdv.structs.chainguard._interface.ChainGuard_p: .. py:class:: ChainGuard_p(data = None, *, index = None, mutable = False) Bases: :py:obj:`ProxyEntry_p`, :py:obj:`jgdv._abstract.protocols.stdlib.Mapping_p`, :py:obj:`Protocol` The interface for a base ChainGuard object .. py:method:: _index() -> .. py:method:: _table() -> .. py:method:: from_dict(data) -> :classmethod: .. py:method:: get(key, default = None) -> .. py:method:: load(*paths) -> :classmethod: .. py:method:: load_dir(dirp) -> :classmethod: .. py:method:: read(text) -> :classmethod: .. py:method:: report_defaulted() -> :staticmethod: .. py:method:: to_file(path) -> .. _jgdv.structs.chainguard._interface.ChainProxy_p: .. py:class:: ChainProxy_p Bases: :py:obj:`Protocol` The proxy interface Used for special access like:: cg.on_fail(...).val() .. _jgdv.structs.chainguard._interface.ProxyEntry_p: .. py:class:: ProxyEntry_p Bases: :py:obj:`Protocol` Base class for protocol classes. Protocol classes are defined as:: class Proto(Protocol): def meth(self) -> int: ... Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing). For example:: class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:: class GenProto[T](Protocol): def meth(self) -> T: ... .. py:method:: all_of(fallback = None, types = None) -> .. py:method:: first_of(fallback = None, types = None) -> .. py:method:: flatten_on(fallback) -> .. py:method:: match_on(**kwargs) -> .. py:method:: on_fail(fallback = None, types = None, *, non_root = False) ->