-
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
154 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
from __future__ import annotations | ||
|
||
import json as _json | ||
import typing as _t | ||
import typing as t | ||
|
||
|
||
class _CompactJSON: | ||
"""Wrapper around json module that strips whitespace.""" | ||
|
||
@staticmethod | ||
def loads(payload: _t.Union[str, bytes]) -> _t.Any: | ||
def loads(payload: str | bytes) -> t.Any: | ||
return _json.loads(payload) | ||
|
||
@staticmethod | ||
def dumps(obj: _t.Any, **kwargs: _t.Any) -> str: | ||
def dumps(obj: t.Any, **kwargs: t.Any) -> str: | ||
kwargs.setdefault("ensure_ascii", False) | ||
kwargs.setdefault("separators", (",", ":")) | ||
return _json.dumps(obj, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.