INNER CODE UNIT · Python

__get_append_stage_attr_doc

pdpipe/pdpipe · src/pdpipe/core.py:44

def __get_append_stage_attr_doc(class_obj: object) -> str:
    doc = class_obj.__doc__
    if doc is None:  # pragma: no cover
        return
    first_line = doc[: doc.find(".") + 1]
    if "An" in first_line:
        new_first_line = first_line.replace("An", "Create and adds an", 1)
    else:
        new_first_line = first_line.replace("A", "Create and adds a", 1)
    new_first_line = new_first_line[0:-1] + (" to this pipeline stage.")
    return doc.replace(first_line, new_first_line, 1)


def __load_stage_attribute__(class_obj: object) -> None:
    def _append_stage_func(self, *args, **kwds):
        # self is always a PdPipelineStage
        return self + class_obj(*args, **kwds)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…