.. _doot.reporters._interface: ========================= doot.reporters._interface ========================= .. py:module:: doot.reporters._interface Type Aliases ------------ .. autoapisummary:: doot.reporters._interface.Logger Protocols --------- .. autoapisummary:: doot.reporters._interface.ReportGroup_p doot.reporters._interface.WorkflowGroup_p doot.reporters._interface.GeneralGroup_p doot.reporters._interface.TreeGroup_p doot.reporters._interface.SummaryGroup_p doot.reporters._interface.Reporter_p doot.reporters._interface.ReportFormatter_p Classes ------- .. autoapisummary:: doot.reporters._interface.TraceRecord_d doot.reporters._interface.ReportStackEntry_d Module Contents =============== .. py:data:: Logger :type: TypeAlias :value: logmod.Logger .. _doot.reporters._interface.ReportGroup_p: .. py:class:: ReportGroup_p Bases: :py:obj:`Protocol` Base class for protocol classes. Protocol classes are defined as:: class Proto(Protocol): def meth(self) -> int: ... Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing). For example:: class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:: class GenProto[T](Protocol): def meth(self) -> T: ... .. py:method:: _out(key: str, *, info: jgdv.Maybe = None, msg: jgdv.Maybe = None, level: int = 0) -> None .. _doot.reporters._interface.WorkflowGroup_p: .. py:class:: WorkflowGroup_p Bases: :py:obj:`ReportGroup_p`, :py:obj:`Protocol` A Re-entrant ctx manager, used for reporting user-level information about a task workflow run. .. py:method:: root() -> Self .. py:method:: wait() -> Self .. py:method:: act(info: str, msg: str) -> Self .. py:method:: fail(*, info: jgdv.Maybe[str] = None, msg: jgdv.Maybe[str] = None) -> Self .. py:method:: branch(name: str | doot.workflow._interface.TaskName_p, info: jgdv.Maybe[str] = None) -> Self .. py:method:: pause(reason: str) -> Self .. py:method:: result(state: list[str], info: jgdv.Maybe[str] = None) -> Self .. py:method:: resume(name: str | doot.workflow._interface.TaskName_p) -> Self .. py:method:: finished() -> Self .. py:method:: queue(num: int) -> Self .. py:method:: state_result(*vals: str) -> Self .. py:method:: line(msg: jgdv.Maybe[str] = None, char: jgdv.Maybe[str] = None) -> Self .. _doot.reporters._interface.GeneralGroup_p: .. py:class:: GeneralGroup_p Bases: :py:obj:`ReportGroup_p`, :py:obj:`Protocol` Reporter Methods for general user facing messages .. py:method:: header() -> Self .. py:method:: user(msg: str, *rest: Any, **kwargs: Any) -> Self .. py:method:: trace(msg: str, *rest: Any, **kwargs: Any) -> Self .. py:method:: failure(msg: str, *rest: Any, **kwargs: Any) -> Self .. py:method:: detail(msg: str, *rest: Any, **kwargs: Any) -> Self .. py:method:: warn(msg: str, *rest: Any, **kwargs: Any) -> Self .. py:method:: error(msg: str, *rest: Any, **kwargs: Any) -> Self .. py:method:: line(msg: jgdv.Maybe[str] = None, char: jgdv.Maybe[str] = None) -> Self .. py:method:: gap() -> Self .. _doot.reporters._interface.TreeGroup_p: .. py:class:: TreeGroup_p Bases: :py:obj:`ReportGroup_p`, :py:obj:`Protocol` Base class for protocol classes. Protocol classes are defined as:: class Proto(Protocol): def meth(self) -> int: ... Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing). For example:: class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:: class GenProto[T](Protocol): def meth(self) -> T: ... .. _doot.reporters._interface.SummaryGroup_p: .. py:class:: SummaryGroup_p Bases: :py:obj:`ReportGroup_p`, :py:obj:`Protocol` Base class for protocol classes. Protocol classes are defined as:: class Proto(Protocol): def meth(self) -> int: ... Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing). For example:: class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:: class GenProto[T](Protocol): def meth(self) -> T: ... .. py:method:: start() -> None .. py:method:: finish() -> None .. py:method:: add(key: str, *vals: Any) -> Self .. py:method:: summarise() -> Self .. _doot.reporters._interface.Reporter_p: .. py:class:: Reporter_p Bases: :py:obj:`Protocol` Reporters provide attr access to any registered ReportGroup_p's, for formatted printing of workflow information .. py:attribute:: _entry_count :type: int .. py:attribute:: _fmt :type: ReportFormatter_p .. py:attribute:: _logger :type: Logger .. py:attribute:: _stack :type: list[ReportStackEntry_d] .. py:property:: state :type: ReportStackEntry_d .. py:property:: wf :type: WorkflowGroup_p .. py:property:: gen :type: GeneralGroup_p .. py:property:: tree :type: TreeGroup_p .. py:property:: summary :type: SummaryGroup_p .. py:method:: push_state(state: str, **kwargs: Any) -> Self .. py:method:: pop_state() -> Self .. py:method:: active_level(level: int) -> None .. _doot.reporters._interface.ReportFormatter_p: .. py:class:: ReportFormatter_p Bases: :py:obj:`Protocol` Base class for protocol classes. Protocol classes are defined as:: class Proto(Protocol): def meth(self) -> int: ... Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing). For example:: class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:: class GenProto[T](Protocol): def meth(self) -> T: ... .. py:method:: get_segment(key: str) -> jgdv.Maybe[str] .. _doot.reporters._interface.TraceRecord_d: .. py:class:: TraceRecord_d(*, what: str, where: str, why: str, when: jgdv.DateTime) For Storing what happened, where, and why .. py:attribute:: what .. py:attribute:: where .. py:attribute:: why .. py:attribute:: when .. _doot.reporters._interface.ReportStackEntry_d: .. py:class:: ReportStackEntry_d(**kwargs: Any) Data for storing the context of the reporter .. py:attribute:: log_extra :type: dict .. py:attribute:: log_level :type: int .. py:attribute:: depth :type: int .. py:attribute:: state :type: str .. py:attribute:: data :type: dict .. py:attribute:: prefix :type: list[str] .. py:attribute:: extra :type: dict