Skip to content

Commit

Permalink
Make sure it output ints.
Browse files Browse the repository at this point in the history
  • Loading branch information
ionelmc committed May 2, 2024
1 parent af36ce7 commit 5cd0f61
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/hunter/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,23 @@ def safe_repr(obj, maxdepth=5):
return repr(obj)
elif obj_type is datetime:
return (
f'{obj_type.__name__}({obj.year}, {obj.month}, {obj.day}, {obj.hour}, {obj.minute}, {obj.second}, {obj.microsecond}, '
f'{obj_type.__name__}('
f'{obj.year:d}, '
f'{obj.month:d}, '
f'{obj.day:d}, '
f'{obj.hour:d}, '
f'{obj.minute:d}, '
f'{obj.second:d}, '
f'{obj.microsecond:d}, '
f'tzinfo={safe_repr(obj.tzinfo)}{f", fold={safe_repr(obj.fold)}" if hasattr(obj, "fold") else ""})'
)
elif obj_type is time:
return (
f'{obj_type.__name__}({obj.hour}, {obj.minute}, {obj.second}, {obj.microsecond}, '
f'{obj_type.__name__}('
f'{obj.hour:d}, '
f'{obj.minute:d}, '
f'{obj.second:d}, '
f'{obj.microsecond:d}, '
f'tzinfo={safe_repr(obj.tzinfo)}{f", fold={safe_repr(obj.fold)}" if hasattr(obj, "fold") else ""})'
)
elif obj_type is types.MethodType:
Expand Down

0 comments on commit 5cd0f61

Please sign in to comment.