.. _jgdv.structs.strang.processor: ============================= jgdv.structs.strang.processor ============================= .. py:module:: jgdv.structs.strang.processor Functions --------- .. autoapisummary:: jgdv.structs.strang.processor.name_to_hook Classes ------- .. autoapisummary:: jgdv.structs.strang.processor.StrangBasicProcessor Module Contents =============== .. py:function:: name_to_hook(val) -> .. _jgdv.structs.strang.processor.StrangBasicProcessor: .. py:class:: StrangBasicProcessor Bases: :py:obj:`jgdv._abstract.protocols.pre_processable.PreProcessor_p` A processor for basic strangs, the instance is assigned into Strang._processor If the strang type implements _{call}_h, the processor uses that for a stage instead .. py:method:: _build_mark(val, *, sec, data) -> converts applicable words to mark enum values Matches using strang._interface.MARK_RE .. py:method:: _calc_obj_meta(obj) -> Set object level meta dict ie: mark the obj as an instance .. py:method:: _clean_separators(cls, val) -> Clean even repetitions of the separator down to single uses eg: for sep='.', a..b::c....d -> a.b::c.d but: a.b::c...d -> a.b::c..d .. py:method:: _compress_types(cls, val) -> Extract values of explicitly typed words. allows the base str of the Strang to be readable, and for post-process to insert types as necessary eg: a.b.c::d.e. -> (a.b.c::d.e., {uuids:[UUIDstr]} .. py:method:: _get_args(val) -> .. py:method:: _implicit_mark(val, *, sec, data, index, maxcount) -> Builds certain implicit marks, but only for the first and last words of a section # TODO handle combined marks like val::+_.blah .. py:method:: _make_type(val, *, sec, data, obj) -> Handle words, which may have had data extracted during pre-processing. .. py:method:: _post_process_section(obj, idx, data) -> .. py:method:: _process_args(obj, *, data) -> Extract args and set values as necessary .. py:method:: _process_section(obj, section, *, start = -1) -> Set the slices of a section, return the index where the section ends .. py:method:: _slice_section(obj, *, case, start = 0, max = -1) -> Get a list of word slices of a section, with an offset. .. py:method:: _validate_marks(obj) -> Check marks make sense. eg: +|_ are only at obj[1:0] .. py:method:: _verify_structure(cls, val) -> Verify basic strang structure. ie: all necessary sections are, provisionally, there. .. py:method:: post_process(obj, data) -> With the strang cleaned and slices, build meta data for words takes the data extracted during pre-processing. .. py:method:: pre_process(cls, input, *args, strict = False, **kwargs) -> run before str.__new__ is called, to do early modification of the string Filters out extraneous duplicated separators .. py:method:: prep_word(val, *, fallback = '') -> .. py:method:: process(obj, *, data) -> slice the sections of the strang populates obj.data: - slices - flat - bounds .. py:method:: use_hook(cls, stage, *args, **kwargs) ->