Skip to content

Commit 528809a

Browse files
committed
better annotations processing in pretty_repr/pretty_str
1 parent 4f03b05 commit 528809a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

logwrap/repr_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def _repr_callable(self, src: typing.Union[types.FunctionType, types.MethodType]
234234
for param in _prepare_repr(src):
235235
param_str += f"{prefix}{param.name}"
236236
if param.annotation is not param.empty:
237-
param_str += f": {param.annotation}"
237+
param_str += f": {getattr(param.annotation, '__name__', param.annotation)!s}"
238238
if param.value is not param.empty:
239239
param_str += f"={self.process_element(src=param.value, indent=indent, no_indent_start=True)}"
240240
param_str += ","

logwrap/repr_utils.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ cdef class PrettyFormat:
180180
for param in _prepare_repr(src):
181181
param_str += f"{prefix}{param.name}"
182182
if param.annotation is not param.empty:
183-
param_str += f": {param.annotation}"
183+
param_str += f": {getattr(param.annotation, '__name__', param.annotation)!s}"
184184
if param.value is not param.empty:
185185
param_str += f"={self.process_element(src=param.value, indent=indent, no_indent_start=True)}"
186186
param_str += ","

0 commit comments

Comments
 (0)