Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Fix rendering datetime and None in CLI #1221

Merged
merged 3 commits into from
Sep 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/cli/onefuzz/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"""

import argparse
import datetime
import inspect
import json
import logging
Expand Down Expand Up @@ -502,12 +503,14 @@ def normalize(result: Any) -> Any:
return {normalize(k): normalize(v) for (k, v) in result.items()}
if isinstance(result, Enum):
return result.name
if isinstance(result, UUID):
if isinstance(result, (UUID, datetime.datetime)):
return str(result)
if isinstance(result, (int, float, str)):
return result
if result is None:
return result

logging.debug(f"unable to normalize type f{type(result)}")
logging.warning(f"unable to normalize type f{type(result)}")

return result

Expand Down