]> git.wh0rd.org - gnudebbugs.git/blob - src/gnudebbugs/pretty.py
initial release
[gnudebbugs.git] / src / gnudebbugs / pretty.py
1 # Copyright (C) 2021 Free Software Foundation, Inc.
2 #
3 # This program is free software: you can redistribute it and/or modify it under
4 # the terms of the GNU Lesser General Public License as published by the Free
5 # Software Foundation, either version 3 of the License, or at your option) any
6 # later version.
7 #
8 # This program is distributed in the hope that it will be useful, but WITHOUT
9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 # details.
12 #
13 # You should have received a copy of the GNU Lesser General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
16 """Helpers for format things for humans."""
17
18 import json as mod_json
19 from typing import Any
20
21
22 def json(obj: Any) -> str:
23 return mod_json.dumps(
24 obj, ensure_ascii=False, indent=2, separators=(",", ": "), sort_keys=True
25 )