Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Commit

Permalink
Cleaner fix for @does. The function is only useful for the
Browse files Browse the repository at this point in the history
node generator -- not for the rest. This ensures that we don't use it
to handle signatures, rather, we just use the node's return types.
  • Loading branch information
elijahbenizzy committed Dec 15, 2022
1 parent cdea1f8 commit 0f8ae0d
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions hamilton/function_modifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,7 @@ def expand_node(
fn = node_.callable
base_doc = node_.documentation

@functools.wraps(fn)
def df_generator(*args, **kwargs):
def df_generator(*args, **kwargs) -> pd.DataFrame:
df_generated = fn(*args, **kwargs)
if self.fill_with is not None:
for col in self.columns:
Expand All @@ -441,12 +440,8 @@ def df_generator(*args, **kwargs):
return df_generated

output_nodes = [
node.Node(
node_.name,
typ=pd.DataFrame,
doc_string=base_doc,
node_.copy_with(
callabl=df_generator,
tags=node_.tags.copy(),
)
]

Expand Down Expand Up @@ -553,7 +548,6 @@ def expand_node(
fn = node_.callable
base_doc = node_.documentation

@functools.wraps(fn)
def dict_generator(*args, **kwargs):
dict_generated = fn(*args, **kwargs)
if self.fill_with is not None:
Expand All @@ -562,15 +556,7 @@ def dict_generator(*args, **kwargs):
dict_generated[field] = self.fill_with
return dict_generated

output_nodes = [
node.Node(
node_.name,
typ=dict,
doc_string=base_doc,
callabl=dict_generator,
tags=node_.tags.copy(),
)
]
output_nodes = [node_.copy_with(callabl=dict_generator)]

for field, field_type in self.fields.items():
doc_string = base_doc # default doc string of base function.
Expand Down Expand Up @@ -744,7 +730,7 @@ def generate_node(self, fn: Callable, config) -> node.Node:
and the same parameters/types as the original function.
"""

@functools.wraps(fn)
# @functools.wraps(fn)
def wrapper_function(**kwargs):
final_kwarg_values = {
key: param_spec.default
Expand Down

0 comments on commit 0f8ae0d

Please sign in to comment.