m2m模型翻译
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
450 B

6 months ago
  1. import json as _json
  2. import typing as _t
  3. class _CompactJSON:
  4. """Wrapper around json module that strips whitespace."""
  5. @staticmethod
  6. def loads(payload: _t.Union[str, bytes]) -> _t.Any:
  7. return _json.loads(payload)
  8. @staticmethod
  9. def dumps(obj: _t.Any, **kwargs: _t.Any) -> str:
  10. kwargs.setdefault("ensure_ascii", False)
  11. kwargs.setdefault("separators", (",", ":"))
  12. return _json.dumps(obj, **kwargs)