jgdv.structs.chainguard._interface
Type Aliases
Protocols
The interface for a base ChainGuard object |
|
The interface for a base ChainGuard object |
|
The proxy interface |
|
Base class for protocol classes. |
Module Contents
- jgdv.structs.chainguard._interface.ProxyWrapper: TypeAlias = Callable[[*Any], T]
- jgdv.structs.chainguard._interface.TomlTypes: TypeAlias = str | int | float | bool | list[TomlTypes] | dict[str, TomlTypes] | datetime.datetime
- class jgdv.structs.chainguard._interface.ChainGuard_i(
- data=None,
- *,
- index=None,
- mutable=False,
Bases:
ChainGuard_p,ProtocolThe interface for a base ChainGuard object
- class jgdv.structs.chainguard._interface.ChainGuard_p(
- data=None,
- *,
- index=None,
- mutable=False,
Bases:
ProxyEntry_p,jgdv._abstract.protocols.stdlib.Mapping_p,ProtocolThe interface for a base ChainGuard object
- get(key, default=None) <Unknown>[source]
- Parameters:
key (str)
default (jgdv.Maybe)
- Return type:
jgdv.Maybe
- classmethod load(*paths) <Unknown>[source]
- Parameters:
paths (str | pathlib.Path)
- Return type:
Self
- classmethod load_dir(dirp) <Unknown>[source]
- Parameters:
dirp (str | pathlib.Path)
- Return type:
Self
- to_file(path) <Unknown>[source]
- Parameters:
path (pathlib.Path)
- Return type:
None
- class jgdv.structs.chainguard._interface.ChainProxy_p[source]
Bases:
ProtocolThe proxy interface
Used for special access like:
cg.on_fail(...).val()
- class jgdv.structs.chainguard._interface.ProxyEntry_p[source]
Bases:
ProtocolBase 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: ...
- all_of(fallback=None, types=None) <Unknown>[source]
- Parameters:
fallback (jgdv.Maybe[ProxyEntry_p.all_of.T])
types (jgdv.Maybe[type[ProxyEntry_p.all_of.T]])
- Return type:
ChainProxy_p[ProxyEntry_p.all_of.T]
- first_of(
- fallback=None,
- types=None,
- Parameters:
fallback (jgdv.Maybe[ProxyEntry_p.first_of.T])
types (jgdv.Maybe[type[ProxyEntry_p.first_of.T]])
- Return type:
ChainProxy_p[ProxyEntry_p.first_of.T]
- flatten_on(fallback) <Unknown>[source]
- Parameters:
fallback (jgdv.Maybe[ProxyEntry_p.flatten_on.T])
- Return type:
ChainProxy_p[ProxyEntry_p.flatten_on.T]
- on_fail(
- fallback=None,
- types=None,
- *,
- non_root=False,
- Parameters:
- Return type:
ChainProxy_p[ProxyEntry_p.on_fail.T]