Skip to content

Commit edf7999

Browse files
committed
Print fully qualified type name in case of type mismatch
1 parent f8b5db3 commit edf7999

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tripy/tripy/function_registry.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ def matches_arg_types(self, args, kwargs) -> "Result":
100100

101101
def sanitize_name(annotation):
102102
# typing module annotations are likely to be better when pretty-printed due to including subscripts
103-
return annotation if annotation.__module__ == "typing" else annotation.__qualname__
103+
return (
104+
annotation
105+
if annotation.__module__ == "typing"
106+
else f"{annotation.__module__}.{annotation.__qualname__}"
107+
)
104108

105109
def render_arg_type(arg: Any) -> str:
106110
# it is more useful to report more detailed types for sequences/tuples in error messages
@@ -116,7 +120,7 @@ def render_arg_type(arg: Any) -> str:
116120
return f"List[Union[{', '.join(arg_types)}]]"
117121
if isinstance(arg, Tuple):
118122
return f"Tuple[{', '.join(map(render_arg_type, arg))}]"
119-
return type(arg).__qualname__
123+
return f"{type(arg).__module__}.{type(arg).__qualname__}"
120124

121125
def matches_type(name: str, annotation: type, arg: Any) -> bool:
122126
from collections.abc import Sequence as ABCSequence

0 commit comments

Comments
 (0)