Skip to content
Snippets Groups Projects
Commit ef877190 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

write_json_to_file will warn upon setting its kwargs (which never did anything)

parent 0b6135b3
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* fixed a bug occurring in Python 3.10 with whereis * fixed a bug occurring in Python 3.10 with whereis
* DirectorySource will raise an exception if directory does not exist and on_fail is set to RAISE * DirectorySource will raise an exception if directory does not exist and on_fail is set to RAISE
* JSONEncoder will behave correctly on weird classes (no __slots and no __dict__) * JSONEncoder will behave correctly on weird classes (no __slots and no __dict__)
* write_json_to_file will warn upon setting its kwargs (which never did anything)
Build system Build system
============ ============
......
__version__ = '2.25.0a4' __version__ = '2.25.0a5'
import enum import enum
import json import json
import typing as tp import typing as tp
import warnings
from abc import ABCMeta, abstractmethod from abc import ABCMeta, abstractmethod
from satella.coding.typing import NoneType from satella.coding.typing import NoneType
...@@ -73,8 +74,10 @@ def write_json_to_file(path: str, value: JSONAble, **kwargs) -> None: ...@@ -73,8 +74,10 @@ def write_json_to_file(path: str, value: JSONAble, **kwargs) -> None:
:param path: path to the file :param path: path to the file
:param value: JSON-able content :param value: JSON-able content
:param kwargs: will be passed to ujson/json's dump :param kwargs: Legacy argument do not use it, will raise a warning upon non-empty. This never did anything.
""" """
if kwargs:
warnings.warn('Do not use kwargs, it has no effect', DeprecationWarning)
with open(path, 'w') as f_out: with open(path, 'w') as f_out:
f_out.write(JSONEncoder().encode(value)) f_out.write(JSONEncoder().encode(value))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment