Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/itsdangerous/_json.py: 85%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from __future__ import annotations
3import json as _json
4import typing as t
7class _CompactJSON:
8 """Wrapper around json module that strips whitespace."""
10 @staticmethod
11 def loads(payload: str | bytes) -> t.Any:
12 return _json.loads(payload)
14 @staticmethod
15 def dumps(obj: t.Any, **kwargs: t.Any) -> str:
16 kwargs.setdefault("ensure_ascii", False)
17 kwargs.setdefault("separators", (",", ":"))
18 return _json.dumps(obj, **kwargs)