Fixed escape_forward_slashes error
This commit is contained in:
parent
dc107ebdb3
commit
11d49fd476
@ -35,6 +35,8 @@ async def json_write(data: Any, path: Union[str, Path]) -> None:
|
|||||||
async with aiofiles.open(str(path), mode="w", encoding="utf-8") as f:
|
async with aiofiles.open(str(path), mode="w", encoding="utf-8") as f:
|
||||||
await f.write(
|
await f.write(
|
||||||
dumps(data, ensure_ascii=False, escape_forward_slashes=False, indent=4)
|
dumps(data, ensure_ascii=False, escape_forward_slashes=False, indent=4)
|
||||||
|
if hasattr(dumps, "escape_forward_slashes")
|
||||||
|
else dumps(data, ensure_ascii=False, indent=4)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,7 +29,11 @@ def json_write(data: Any, path: Union[str, Path]) -> None:
|
|||||||
* path (`Union[str, Path]`): Path-like object or path as a string of a destination
|
* path (`Union[str, Path]`): Path-like object or path as a string of a destination
|
||||||
"""
|
"""
|
||||||
with open(str(path), mode="w", encoding="utf-8") as f:
|
with open(str(path), mode="w", encoding="utf-8") as f:
|
||||||
f.write(dumps(data, ensure_ascii=False, escape_forward_slashes=False, indent=4))
|
f.write(
|
||||||
|
dumps(data, ensure_ascii=False, escape_forward_slashes=False, indent=4)
|
||||||
|
if hasattr(dumps, "escape_forward_slashes")
|
||||||
|
else dumps(data, ensure_ascii=False, indent=4)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def nested_set(target: dict, value: Any, *path: str, create_missing=True) -> dict:
|
def nested_set(target: dict, value: Any, *path: str, create_missing=True) -> dict:
|
||||||
|
Loading…
Reference in New Issue
Block a user