Skip to content

Commit 3ef7a6d

Browse files
committed
style(ops): type-annotate Ops & builder clases
1 parent 6c180af commit 3ef7a6d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

graphtik/netop.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def _build_pydot(self, **kws):
4242
plotter = self.last_plan or self.net
4343
return plotter._build_pydot(**kws)
4444

45-
def compute(self, named_inputs, outputs=None):
45+
def compute(self, named_inputs, outputs=None) -> dict:
4646
"""
4747
Solve & execute the graph, sequentially or parallel.
4848
@@ -82,7 +82,7 @@ def compute(self, named_inputs, outputs=None):
8282

8383
def __call__(
8484
self, named_inputs, outputs=None, method=None, overwrites_collector=None
85-
):
85+
) -> dict:
8686
return self.compute(named_inputs, outputs=outputs)
8787

8888
def set_execution_method(self, method):
@@ -145,7 +145,7 @@ def __init__(self, name=None, merge=False):
145145
self.name = name
146146
self.merge = merge
147147

148-
def __call__(self, *operations, **kwargs):
148+
def __call__(self, *operations, **kwargs) -> NetworkOperation:
149149
"""
150150
Composes a collection of operations into a single computation graph,
151151
obeying the ``merge`` property, if set in the constructor.

graphtik/op.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def __repr__(self):
128128
f"provides={provides!r}, fn{returns_dict_marker}={fn_name!r})"
129129
)
130130

131-
def compute(self, named_inputs, outputs=None):
131+
def compute(self, named_inputs, outputs=None) -> dict:
132132
try:
133133
args = [
134134
named_inputs[n]
@@ -239,7 +239,7 @@ def __init__(
239239

240240
def withset(
241241
self, *, fn=None, name=None, needs=None, provides=None, returns_dict=None
242-
):
242+
) -> "operation":
243243
if fn is not None:
244244
self.fn = fn
245245
if name is not None:
@@ -255,7 +255,7 @@ def withset(
255255

256256
def __call__(
257257
self, fn=None, *, name=None, needs=None, provides=None, returns_dict=None
258-
):
258+
) -> FunctionalOperation:
259259
"""
260260
This enables ``operation`` to act as a decorator or as a functional
261261
operation, for example::

0 commit comments

Comments
 (0)