jgdv.structs.dkey.processor
Classes
The Metaclass for keys, which ensures that subclasses of DKeyBase |
Module Contents
- class jgdv.structs.dkey.processor.DKeyProcessor[source]
Bases:
jgdv._abstract.protocols.pre_processable.PreProcessor_pThe Metaclass for keys, which ensures that subclasses of DKeyBase are API.Key_p’s, despite there not being an actual subclass relation between them.
This allows DKeyBase to actually bottom out at str
- extract_raw_keys(
- data,
- *,
- implicit=False,
Calls the Python format string parser to extract keys and their formatting/conversion specs, then wraps them in jgdv.structs.dkey._util.parser.API.RawKey_d’s for convenience
if ‘implicit’ then will parse the entire string as {str}
- Parameters:
data (str)
- Return type:
tuple[jgdv.structs.dkey._interface.RawKey_d, Ellipsis]
- inspect_raw(raw_keys, kdata) <Unknown>[source]
Take extracted keys of the text, and determine features of them. can return modified text, and a mark
- Parameters:
raw_keys (collections.abc.Iterable[jgdv.structs.dkey._interface.RawKey_d])
kdata (dict)
- Return type:
tuple[jgdv.Maybe[str], jgdv.Maybe[jgdv.structs.dkey._interface.KeyMark]]
- post_process(obj, data=None) <Unknown>[source]
Build subkeys if necessary
- Parameters:
obj (T)
data (jgdv.Maybe[dict])
- Return type:
jgdv.Maybe[T]
- pre_process(
- cls,
- input,
- *args,
- strict=False,
- **kwargs,
Pre-process the Key text,
Extracts subkeys, and refines the type of key to build
- process(obj, *, data=None) <Unknown>[source]
The key constructed, build slices
- Parameters:
obj (T)
data (jgdv.Maybe[dict])
- Return type:
jgdv.Maybe[T]
- register_convert_param(cls, convert) <Unknown>[source]
- Parameters:
convert (jgdv.Maybe[str])
- Return type:
None
- select_ctor(
- cls,
- *,
- mark,
- force,
- insist,
Select the appropriate key ctor, which can be forced if necessary, otherwise uses the mark and multi params
- Parameters:
cls (jgdv.Ctor[T])
mark (jgdv.structs.dkey._interface.KeyMark)
force (jgdv.Maybe[jgdv.Ctor[T]])
insist (bool)
- Return type:
jgdv.Ctor[T]
- validate_init_kwargs(ctor, kwargs) <Unknown>[source]
returns any keys not expected by a dkey or dkey subclass
- Parameters:
kwargs (dict)
- Return type:
None
- parser: ClassVar[jgdv.structs.dkey._util.parser.DKeyParser]