Skip to content

Commit

Permalink
Fix signature for generic structure hooks
Browse files Browse the repository at this point in the history
A generic structure hook is expected to return a value of the type that it accepts as an argument.
  • Loading branch information
tdsmith authored and Tinche committed Nov 2, 2020
1 parent 3a02a04 commit 1ab1cb2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cattr/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def register_unstructure_hook_func(
self._unstructure_func.register_func_list([(check_func, func)])

def register_structure_hook(
self, cl: Type[T], func: Callable[[Any, Type[V]], T]
self, cl: Type[T], func: Callable[[Any, Type[T]], T]
):
"""Register a primitive-to-class converter function for a type.
Expand All @@ -188,7 +188,7 @@ def register_structure_hook(
def register_structure_hook_func(
self,
check_func: Callable[[Type[T]], bool],
func: Callable[[Any, Type[V]], T],
func: Callable[[Any, Type[T]], T],
):
"""Register a class-to-primitive converter function for a class, using
a function to check if it's a match.
Expand Down

0 comments on commit 1ab1cb2

Please sign in to comment.