Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/itsdangerous/_json.py: 67%

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

12 statements  

1from __future__ import annotations 

2 

3import json as _json 

4import typing as t 

5 

6 

7class _CompactJSON: 

8 """Wrapper around json module that strips whitespace.""" 

9 

10 @staticmethod 

11 def loads(payload: str | bytes) -> t.Any: 

12 return _json.loads(payload) 

13 

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)