.. _jgdv.structs.dkey._interface: ============================ jgdv.structs.dkey._interface ============================ .. py:module:: jgdv.structs.dkey._interface Type Aliases ------------ .. autoapisummary:: jgdv.structs.dkey._interface.LitFalse Protocols --------- .. autoapisummary:: jgdv.structs.dkey._interface.IndirectKey_p jgdv.structs.dkey._interface.Key_p jgdv.structs.dkey._interface.MultiKey_p jgdv.structs.dkey._interface.NonKey_p Classes ------- .. autoapisummary:: jgdv.structs.dkey._interface.DKeyMarkAbstract_e jgdv.structs.dkey._interface.DKeyMark_e jgdv.structs.dkey._interface.DKey_d jgdv.structs.dkey._interface.RawKey_d Module Contents =============== .. py:data:: LitFalse :type: TypeAlias :value: Literal[False] .. _jgdv.structs.dkey._interface.IndirectKey_p: .. py:class:: IndirectKey_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:: _indirect() -> .. _jgdv.structs.dkey._interface.Key_p: .. py:class:: Key_p Bases: :py:obj:`jgdv.structs.strang._interface.Strang_p`, :py:obj:`Protocol` The protocol for a Key, something that used in a template system .. py:method:: MarkOf(cls) -> :staticmethod: .. py:method:: expand(*sources, rec=False, insist=False, chain = None, on_fail=Any, locs = None, **kwargs) -> .. py:method:: redirect(spec=None) -> .. py:method:: var_name() -> .. py:attribute:: _expander :type: ClassVar[jgdv.structs.dkey._util._interface.Expander_p] .. py:attribute:: _extra_kwargs :type: ClassVar[set[str]] .. py:attribute:: _processor :type: ClassVar .. py:attribute:: data :type: DKey_d .. _jgdv.structs.dkey._interface.MultiKey_p: .. py:class:: MultiKey_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:: _multi() -> .. py:method:: keys() -> .. _jgdv.structs.dkey._interface.NonKey_p: .. py:class:: NonKey_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:: _nonkey() -> .. _jgdv.structs.dkey._interface.DKeyMarkAbstract_e: .. py:class:: DKeyMarkAbstract_e Bases: :py:obj:`jgdv.structs.strang._interface.StrangMarkAbstract_e` Enum where members are also (and must be) strings .. py:method:: default() -> :classmethod: .. py:method:: multi() -> :classmethod: .. py:method:: null() -> :classmethod: .. _jgdv.structs.dkey._interface.DKeyMark_e: .. py:class:: DKeyMark_e Bases: :py:obj:`DKeyMarkAbstract_e` Enums for how to use/build a dkey .. py:method:: default() -> :classmethod: .. py:method:: indirect() -> :classmethod: .. py:method:: multi() -> :classmethod: .. py:method:: null() -> :classmethod: .. py:attribute:: ARGS .. py:attribute:: KWARGS .. py:attribute:: POSTBOX .. _jgdv.structs.dkey._interface.DKey_d: .. py:class:: DKey_d(**kwargs) Bases: :py:obj:`jgdv.structs.strang._interface.Strang_d` Data of a DKey .. py:attribute:: convert :type: jgdv.Maybe[jgdv.FmtStr] .. py:attribute:: expansion_type :type: jgdv.Ctor .. py:attribute:: fallback :type: jgdv.Maybe[Any] .. py:attribute:: format :type: jgdv.Maybe[jgdv.FmtStr] .. py:attribute:: help :type: jgdv.Maybe[str] .. py:attribute:: max_expansions :type: jgdv.Maybe[int] .. py:attribute:: multi :type: bool .. py:attribute:: name :type: jgdv.Maybe[str] .. py:attribute:: raw :type: tuple[RawKey_d, Ellipsis] .. py:attribute:: typecheck :type: jgdv.CHECKTYPE .. _jgdv.structs.dkey._interface.RawKey_d: .. py:class:: RawKey_d(**kwargs) Utility class for parsed {}-format string parameters. :: see: https://peps.python.org/pep-3101/ and: https://docs.python.org/3/library/string.html#format-string-syntax Provides the data from string.Formatter.parse, but in a structure instead of a tuple. .. py:method:: anon() -> Make a format str of this key, with anon variables. eg: blah {key:f!p} -> blah {} .. py:method:: direct() -> Returns this key in direct form :: eg: blah -> blah blah_ -> blah .. py:method:: indirect() -> Returns this key in indirect form :: eg: blah -> blah_ blah_ -> blah_ .. py:method:: is_indirect() -> .. py:method:: joined() -> Returns the key and params as one string eg: blah, fmt=5, conv=p -> blah:5!p .. py:method:: wrapped() -> Returns this key in simple wrapped form (it ignores format, conv params and prefix) eg: blah -> {blah} .. py:attribute:: convert :type: jgdv.Maybe[str] .. py:attribute:: format :type: jgdv.Maybe[str] .. py:attribute:: key :type: jgdv.Maybe[str] .. py:attribute:: prefix :type: str