Revert file mode write_json (#16897)
This commit is contained in:
parent
9ab8f78b19
commit
d0ddc28f96
1 changed files with 1 additions and 3 deletions
|
@ -47,9 +47,7 @@ def save_json(filename: str, data: Union[List, Dict],
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
json_data = json.dumps(data, sort_keys=True, indent=4)
|
json_data = json.dumps(data, sort_keys=True, indent=4)
|
||||||
mode = 0o600 if private else 0o644
|
with open(filename, 'w', encoding='utf-8') as fdesc:
|
||||||
with open(os.open(filename, os.O_WRONLY | os.O_CREAT, mode),
|
|
||||||
'w', encoding='utf-8') as fdesc:
|
|
||||||
fdesc.write(json_data)
|
fdesc.write(json_data)
|
||||||
except TypeError as error:
|
except TypeError as error:
|
||||||
_LOGGER.exception('Failed to serialize to JSON: %s',
|
_LOGGER.exception('Failed to serialize to JSON: %s',
|
||||||
|
|
Loading…
Add table
Reference in a new issue