Skip to content

Commit

Permalink
Fix TypeError when passing dict to wrapped partial (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepyaman authored Oct 21, 2020
1 parent 1fca77d commit f56ed16
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
## Major features and improvements

## Bug fixes and other changes
* Fixed `TypeError` when converting dict inputs to a node made from a wrapped `partial` function.
* Improved handling of non-ASCII word characters in dataset names.
- For example, a dataset named `jalapeño` will be accessible as `DataCatalog.datasets.jalapeño` rather than `DataCatalog.datasets.jalape__o`.
* Fixed `kedro install` for an Anaconda environment defined in `environment.yml`.
Expand Down
2 changes: 1 addition & 1 deletion kedro/pipeline/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ def _dict_inputs_to_list(func: Callable[[Any], Any], inputs: Dict[str, str]):
"""Convert a dict representation of the node inputs to a list , ensuring
the appropriate order for binding them to the node's function.
"""
sig = inspect.signature(func).bind(**inputs)
sig = inspect.signature(func, follow_wrapped=False).bind(**inputs)
# for deterministic behavior in python 3.5, sort kwargs inputs alphabetically
return list(sig.args) + sorted(sig.kwargs.values())

Expand Down
10 changes: 10 additions & 0 deletions tests/pipeline/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,3 +464,13 @@ def test_updated_partial(self):
assert str(n) == "identity([in]) -> [out]"
assert n.name == "identity([in]) -> [out]"
assert n.short_name == "Identity"

def test_updated_partial_dict_inputs(self):
n = node(
update_wrapper(partial(biconcat, input1=["in1"]), biconcat),
dict(input2="in2"),
["out"],
)
assert str(n) == "biconcat([in2]) -> [out]"
assert n.name == "biconcat([in2]) -> [out]"
assert n.short_name == "Biconcat"

0 comments on commit f56ed16

Please sign in to comment.