doot.util.dkey

Classes

TaskNameDKey

A facade for DKeys and variants.

DootPathDKey

A MultiKey that always expands as a path,

DootKeyed

Extends jgdv.structs.dkey.DKeyed to handle additional decoration types

Module Contents

class doot.util.dkey.TaskNameDKey(*args: Any, **kwargs: Any)[source]

Bases: jgdv.structs.dkey.DKey

A facade for DKeys and variants. Implements __new__ to create the correct key type, from a string, dynamically.

kwargs: explicit = insists that keys in the string are wrapped in braces ‘{akey} {anotherkey}’. mark = pre-register expansion parameters / type etc check = dictate a type that expanding this key must match fparams = str formatting instructions for the key

Eg: DKey(‘blah’) -> SingleDKey(‘blah’) -> SingleDKey(‘blah’).format(‘w’) -> ‘{blah}’ -> [toml] aValue = ‘{blah}’

Because cls.__new__ calls __init__ automatically for return values of type cls, DKey is the factory, but all DKeys are subclasses of DKeyBase, to allow control over __init__.

Base class for implementing actual DKeys.

init takes kwargs: fmt, mark, check, ctor, help, fallback, max_exp

on class definition, can register a ‘mark’, ‘multi’, and a conversion parameter str

Parameters:
  • args (Any)

  • kwargs (Any)

class doot.util.dkey.DootPathDKey(*args: Any, **kwargs: Any)[source]

Bases: jgdv.structs.dkey.DKey[pathlib.Path]

A MultiKey that always expands as a path, eg: {temp}/{name}.log

Parameters:
  • args (Any)

  • kwargs (Any)

_extra_kwargs: ClassVar[set[str]]
_relative
_multi() Literal[True][source]
Return type:

Literal[True]

exp_extra_sources_h(
current: jgdv.structs.dkey._util._interface.SourceChain_d,
) jgdv.structs.dkey._util._interface.SourceChain_d[source]
Parameters:

current (jgdv.structs.dkey._util._interface.SourceChain_d)

Return type:

jgdv.structs.dkey._util._interface.SourceChain_d

exp_final_h(
inst: jgdv.structs.dkey.ExpInst_d,
root: jgdv.Maybe[jgdv.structs.dkey.ExpInst_d],
factory: jgdv.structs.dkey._util._interface.InstructionFactory_p,
opts: dict,
) jgdv.Maybe[jgdv.structs.dkey.ExpInst_d][source]
Parameters:
  • inst (jgdv.structs.dkey.ExpInst_d)

  • root (jgdv.Maybe[jgdv.structs.dkey.ExpInst_d])

  • factory (jgdv.structs.dkey._util._interface.InstructionFactory_p)

  • opts (dict)

Return type:

jgdv.Maybe[jgdv.structs.dkey.ExpInst_d]

class doot.util.dkey.DootKeyed[source]

Bases: jgdv.decorators.DecoratorAccessor_m, jgdv.structs.dkey.DKeyed

Extends jgdv.structs.dkey.DKeyed to handle additional decoration types specific for doot

_decoration_builder: ClassVar[type]
classmethod taskname(
fn: collections.abc.Callable,
) jgdv.Decorator[source]
Parameters:

fn (collections.abc.Callable)

Return type:

jgdv.Decorator