diff options
| author | metalgamer | 2020-12-08 17:13:15 +0100 |
|---|---|---|
| committer | metalgamer | 2020-12-08 17:13:15 +0100 |
| commit | c133c11f5816134d95bbcd5bf794bf2b8c3feb97 (patch) | |
| tree | 00b5e8ce4f62169c9192d075df204c586a388b64 | |
| parent | 62bf049c9fa6684c6811f20dac0bc392ab53802b (diff) | |
| download | patternutils-c133c11f5816134d95bbcd5bf794bf2b8c3feb97.tar.gz patternutils-c133c11f5816134d95bbcd5bf794bf2b8c3feb97.zip | |
Use config dict for json.dumps
Diffstat (limited to '')
| -rw-r--r-- | patternutils/utils.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/patternutils/utils.py b/patternutils/utils.py index 9160cfe..d1ccacf 100644 --- a/patternutils/utils.py +++ b/patternutils/utils.py @@ -29,11 +29,11 @@ def edit(data: Dict[str, str]) -> Dict[str, str]: return data -def json_dumps(data: Any, humand_readable: bool = False) -> str: - if humand_readable: - return json.dumps(data, indent=4, sort_keys=True) - else: - return json.dumps(data, separators=(",", ":")) +def json_dumps(data: Any, human_readable: bool = False) -> str: + config = ( + {"indent": 4, sort_keys: True} if human_readable else {"separators": (",", ":")} + ) + return json.dumps(data, **config) def walk( |
