Skip to content

Commit a288e84

Browse files
author
zilto
committed
ran pre-commits
1 parent 62d4b27 commit a288e84

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

hamilton/graph.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,12 @@ def from_modules(
733733
"""
734734

735735
functions = sum([find_functions(module) for module in modules], [])
736-
return FunctionGraph.from_functions(*functions, config=config, adapter=adapter, allow_module_overrides=allow_module_overrides)
736+
return FunctionGraph.from_functions(
737+
*functions,
738+
config=config,
739+
adapter=adapter,
740+
allow_module_overrides=allow_module_overrides,
741+
)
737742

738743
@staticmethod
739744
def from_functions(
@@ -743,7 +748,10 @@ def from_functions(
743748
allow_module_overrides: bool = False,
744749
) -> "FunctionGraph":
745750
nodes = create_function_graph(
746-
*functions, config=config, adapter=adapter, allow_module_overrides=allow_module_overrides
751+
*functions,
752+
config=config,
753+
adapter=adapter,
754+
allow_module_overrides=allow_module_overrides,
747755
)
748756
return FunctionGraph(nodes, config, adapter)
749757

hamilton/graph_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def find_functions(function_module: ModuleType) -> List[Tuple[str, Callable]]:
2525
:return: list of tuples of (func_name, function).
2626
"""
2727
return [
28-
(name, fn) for name, fn in inspect.getmembers(function_module)
29-
if is_hamilton_function(fn)
30-
and is_submodule(inspect.getmodule(fn), function_module)
28+
(name, fn)
29+
for name, fn in inspect.getmembers(function_module)
30+
if is_hamilton_function(fn) and is_submodule(inspect.getmodule(fn), function_module)
3131
]

tests/execution/test_node_grouping.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ def bar(foo: int) -> int:
9898
# This is hacking around function graph which is messy as it is built of larger components
9999
# (modules), and should instead be broken into smaller pieces (functions/nodes), and have utilities
100100
# to create it from those.
101-
fn_graph = graph.FunctionGraph.from_modules(ad_hoc_utils.create_temporary_module(bar), config={})
101+
fn_graph = graph.FunctionGraph.from_modules(
102+
ad_hoc_utils.create_temporary_module(bar), config={}
103+
)
102104
node_ = fn_graph.nodes["bar"]
103105
task = grouping.TaskSpec(
104106
base_id="bar",
@@ -120,7 +122,9 @@ def bar(foo: int, baz: int = 1) -> int:
120122
# This is hacking around function graph which is messy as it is built of larger components
121123
# (modules), and should instead be broken into smaller pieces (functions/nodes), and have utilities
122124
# to create it from those.
123-
fn_graph = graph.FunctionGraph.from_modules(ad_hoc_utils.create_temporary_module(bar), config={})
125+
fn_graph = graph.FunctionGraph.from_modules(
126+
ad_hoc_utils.create_temporary_module(bar), config={}
127+
)
124128
node_ = fn_graph.nodes["bar"]
125129
task = grouping.TaskSpec(
126130
base_id="bar",

tests/function_modifiers/test_adapters.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,9 @@ def test_loader_default_factory_field():
570570
def foo(param: int) -> int:
571571
return param
572572

573-
fn_graph = graph.FunctionGraph.from_modules(ad_hoc_utils.create_temporary_module(foo), config={})
573+
fn_graph = graph.FunctionGraph.from_modules(
574+
ad_hoc_utils.create_temporary_module(foo), config={}
575+
)
574576
assert len(fn_graph.nodes) == 3
575577
assert "foo" in fn_graph.nodes
576578

@@ -599,7 +601,9 @@ def test_saver_default_factory_field():
599601
def foo(param: int) -> int:
600602
return param
601603

602-
fn_graph = graph.FunctionGraph.from_modules(ad_hoc_utils.create_temporary_module(foo), config={})
604+
fn_graph = graph.FunctionGraph.from_modules(
605+
ad_hoc_utils.create_temporary_module(foo), config={}
606+
)
603607
assert len(fn_graph.nodes) == 3
604608
assert "foo" in fn_graph.nodes
605609

0 commit comments

Comments
 (0)