Method: flask.json.provider._default
Calls: 10, Exceptions: 0, Paths: 4Back
Path 1: 6 calls (0.6)
datetime (5) date (1)
'Sun, 11 Mar 1973 06:30:45 GMT' (1) 'Sun, 05 Jan 1975 00:00:00 GMT' (1) 'Sun, 01 Jan 2017 12:34:56 GMT' (1) 'Sun, 01 Jan 2017 20:34:56 GMT' (1) 'Sun, ...
1def _default(o: t.Any) -> t.Any:
2 if isinstance(o, date):
3 return http_date(o)
4
5 if isinstance(o, (decimal.Decimal, uuid.UUID)):
6 return str(o)
7
8 if dataclasses and dataclasses.is_dataclass(o):
9 return dataclasses.asdict(o)
10
11 if hasattr(o, "__html__"):
12 return str(o.__html__())
13
14 raise TypeError(f"Object of type {type(o).__name__} is not JSON serializable")
Path 2: 2 calls (0.2)
UUID (1) Decimal (1)
'deadbeef-dead-beef-dead-beefdeadbeef' (1) '0.003' (1)
1def _default(o: t.Any) -> t.Any:
2 if isinstance(o, date):
3 return http_date(o)
4
5 if isinstance(o, (decimal.Decimal, uuid.UUID)):
6 return str(o)
7
8 if dataclasses and dataclasses.is_dataclass(o):
9 return dataclasses.asdict(o)
10
11 if hasattr(o, "__html__"):
12 return str(o.__html__())
13
14 raise TypeError(f"Object of type {type(o).__name__} is not JSON serializable")
Path 3: 1 calls (0.1)
Data (1)
{'name': 'Flask'} (1)
1def _default(o: t.Any) -> t.Any:
2 if isinstance(o, date):
3 return http_date(o)
4
5 if isinstance(o, (decimal.Decimal, uuid.UUID)):
6 return str(o)
7
8 if dataclasses and dataclasses.is_dataclass(o):
9 return dataclasses.asdict(o)
10
11 if hasattr(o, "__html__"):
12 return str(o.__html__())
13
14 raise TypeError(f"Object of type {type(o).__name__} is not JSON serializable")
Path 4: 1 calls (0.1)
test_html_method.
'
test
' (1)
1def _default(o: t.Any) -> t.Any:
2 if isinstance(o, date):
3 return http_date(o)
4
5 if isinstance(o, (decimal.Decimal, uuid.UUID)):
6 return str(o)
7
8 if dataclasses and dataclasses.is_dataclass(o):
9 return dataclasses.asdict(o)
10
11 if hasattr(o, "__html__"):
12 return str(o.__html__())
13
14 raise TypeError(f"Object of type {type(o).__name__} is not JSON serializable")