Skip to content

Commit

Permalink
Fix Indent problem for auto_save_json
Browse files Browse the repository at this point in the history
  • Loading branch information
xhluca authored Mar 8, 2024
1 parent 5c9bc00 commit 9fff319
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions weblinx/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,13 @@ def auto_read_json(path, backend="auto"):
return data


def auto_save_json(data, path, backend="auto", indent=None):

def auto_save_json(data, path, backend="auto", indent=0):
if indent is None:
indent = 0

path = str(path)
if (
backend in ["auto", "orjson"]
and find_spec("orjson")
and indent not in [2, None]
):
if backend in ["auto", "orjson"] and find_spec("orjson") and indent not in [2, 0]:
import orjson

backend = "orjson"
Expand All @@ -236,7 +236,7 @@ def auto_save_json(data, path, backend="auto", indent=None):
elif backend == "orjson":
if indent == 2:
option = orjson.OPT_INDENT_2
elif indent is None:
elif indent == 0:
option = None
else:
raise ValueError(
Expand Down

0 comments on commit 9fff319

Please sign in to comment.