MCPcopy Create free account
hub / github.com/datapane/datapane / Pipeline

Class Pipeline

python-client/src/datapane/processors/types.py:43–67  ·  view source on GitHub ↗

A simple, programmable, eagerly-evaluated, pipeline specialised on ViewAST transformations similar to f :: State s => s ViewState x -> s ViewState y

Source from the content-addressed store, hash-verified

41
42# TODO - type this properly
43class Pipeline(t.Generic[P_IN]):
44 """
45 A simple, programmable, eagerly-evaluated, pipeline specialised on ViewAST transformations
46 similar to f :: State s => s ViewState x -> s ViewState y
47 """
48
49 # NOTE - toolz has an untyped function for this
50
51 def __init__(self, s: ViewState, x: P_IN = None):
52 self._state = s
53 self._x = x
54
55 def pipe(self, p: BaseProcessor[P_IN, P_OUT]) -> Pipeline[P_OUT]:
56 p.s = self._state
57 y = p.__call__(self._x) # need to call as positional args
58 self._state = p.s
59 return Pipeline(self._state, y)
60
61 @property
62 def state(self) -> ViewState:
63 return self._state
64
65 @property
66 def result(self) -> P_IN:
67 return self._x
68
69
70def mk_null_pipe(blocks: Blocks) -> Pipeline[None]:

Callers 6

_view_to_xml_and_filesFunction · 0.90
build_reportFunction · 0.85
save_reportFunction · 0.85
stringify_reportFunction · 0.85
pipeMethod · 0.85
mk_null_pipeFunction · 0.85

Calls

no outgoing calls

Tested by 1

_view_to_xml_and_filesFunction · 0.72