jgdv.structs.dkey._interface

Type Aliases

LitFalse

Protocols

IndirectKey_p

Base class for protocol classes.

Key_p

The protocol for a Key, something that used in a template system

MultiKey_p

Base class for protocol classes.

NonKey_p

Base class for protocol classes.

Classes

DKeyMarkAbstract_e

Enum where members are also (and must be) strings

DKeyMark_e

Enums for how to use/build a dkey

DKey_d

Data of a DKey

RawKey_d

Utility class for parsed {}-format string parameters.

Module Contents

jgdv.structs.dkey._interface.LitFalse: TypeAlias = Literal[False]
class jgdv.structs.dkey._interface.IndirectKey_p[source]

Bases: 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:
        ...
_indirect() <Unknown>[source]
Return type:

Literal[True]

class jgdv.structs.dkey._interface.Key_p[source]

Bases: jgdv.structs.strang._interface.Strang_p, Protocol

The protocol for a Key, something that used in a template system

static MarkOf(cls) <Unknown>[source]
Parameters:

cls (type[Key_p.MarkOf.T] | Key_p.MarkOf.T)

Return type:

KeyMark

expand(
*sources,
rec=False,
insist=False,
chain=None,
on_fail=Any,
locs=None,
**kwargs,
) <Unknown>[source]
Parameters:
Return type:

str

redirect(spec=None) <Unknown>[source]
Return type:

Key_p

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

str

_expander: ClassVar[jgdv.structs.dkey._util._interface.Expander_p]
_extra_kwargs: ClassVar[set[str]]
_processor: ClassVar
data: DKey_d
class jgdv.structs.dkey._interface.MultiKey_p[source]

Bases: 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:
        ...
_multi() <Unknown>[source]
Return type:

Literal[True]

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

list[Key_p]

class jgdv.structs.dkey._interface.NonKey_p[source]

Bases: 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:
        ...
_nonkey() <Unknown>[source]
Return type:

Literal[True]

class jgdv.structs.dkey._interface.DKeyMarkAbstract_e[source]

Bases: jgdv.structs.strang._interface.StrangMarkAbstract_e

Enum where members are also (and must be) strings

classmethod default() <Unknown>[source]
Return type:

jgdv.Maybe

classmethod multi() <Unknown>[source]
Return type:

jgdv.Maybe

classmethod null() <Unknown>[source]
Return type:

jgdv.Maybe

class jgdv.structs.dkey._interface.DKeyMark_e[source]

Bases: DKeyMarkAbstract_e

Enums for how to use/build a dkey

classmethod default() <Unknown>[source]
Return type:

Any

classmethod indirect() <Unknown>[source]
Return type:

type

classmethod multi() <Unknown>[source]
Return type:

type

classmethod null() <Unknown>[source]
Return type:

jgdv.Maybe

ARGS
KWARGS
POSTBOX
class jgdv.structs.dkey._interface.DKey_d(**kwargs)[source]

Bases: jgdv.structs.strang._interface.Strang_d

Data of a DKey

convert: jgdv.Maybe[jgdv.FmtStr]
expansion_type: jgdv.Ctor
fallback: jgdv.Maybe[Any]
format: jgdv.Maybe[jgdv.FmtStr]
help: jgdv.Maybe[str]
max_expansions: jgdv.Maybe[int]
multi: bool
name: jgdv.Maybe[str]
raw: tuple[RawKey_d, Ellipsis]
typecheck: jgdv.CHECKTYPE
class jgdv.structs.dkey._interface.RawKey_d(**kwargs)[source]

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.

anon() <Unknown>[source]

Make a format str of this key, with anon variables.

eg: blah {key:f!p} -> blah {}

Return type:

str

direct() <Unknown>[source]

Returns this key in direct form

eg: blah -> blah
    blah_ -> blah
Return type:

str

indirect() <Unknown>[source]

Returns this key in indirect form

eg: blah -> blah_
    blah_ -> blah_
Return type:

str

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

bool

joined() <Unknown>[source]

Returns the key and params as one string

eg: blah, fmt=5, conv=p -> blah:5!p

Return type:

str

wrapped() <Unknown>[source]

Returns this key in simple wrapped form

(it ignores format, conv params and prefix)

eg: blah -> {blah}

Return type:

str

convert: jgdv.Maybe[str]
format: jgdv.Maybe[str]
key: jgdv.Maybe[str]
prefix: str