From ef8771900062b0b7c4df8acd59c3a7e6ab9e4f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl> Date: Thu, 7 Mar 2024 09:17:46 +0100 Subject: [PATCH] write_json_to_file will warn upon setting its kwargs (which never did anything) --- CHANGELOG.md | 1 + satella/__init__.py | 2 +- satella/json.py | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6efb9ace..0c70abfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * 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 * 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 ============ diff --git a/satella/__init__.py b/satella/__init__.py index 2449a86b..027d2705 100644 --- a/satella/__init__.py +++ b/satella/__init__.py @@ -1 +1 @@ -__version__ = '2.25.0a4' +__version__ = '2.25.0a5' diff --git a/satella/json.py b/satella/json.py index 1975a4f4..1578b291 100644 --- a/satella/json.py +++ b/satella/json.py @@ -1,6 +1,7 @@ import enum import json import typing as tp +import warnings from abc import ABCMeta, abstractmethod from satella.coding.typing import NoneType @@ -73,8 +74,10 @@ def write_json_to_file(path: str, value: JSONAble, **kwargs) -> None: :param path: path to the file :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: f_out.write(JSONEncoder().encode(value)) -- GitLab