doot.util.dkey
Classes
A facade for DKeys and variants. |
|
A MultiKey that always expands as a path, |
|
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.DKeyA 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)
- _relative
- exp_extra_sources_h(
- current: jgdv.structs.dkey._util._interface.SourceChain_d,
- 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,
- 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]