From 06e3944694519b5772fd561b808e8a6ec2d3f394 Mon Sep 17 00:00:00 2001 From: sed-i <82407168+sed-i@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:44:45 -0500 Subject: [PATCH] Add deprecation warnings --- src/cosl/grafana_dashboard.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cosl/grafana_dashboard.py b/src/cosl/grafana_dashboard.py index a14f006..ca41e62 100644 --- a/src/cosl/grafana_dashboard.py +++ b/src/cosl/grafana_dashboard.py @@ -9,6 +9,7 @@ import logging import lzma from typing import Any, Dict, Union +import warnings logger = logging.getLogger(__name__) @@ -22,9 +23,11 @@ class GrafanaDashboard(str): @staticmethod def _serialize(raw_json: Union[str, bytes]) -> "GrafanaDashboard": + warnings.warn("GrafanaDashboard._serialize is deprecated; use LZMABase64.compress(json.dumps(...)) instead.", category=DeprecationWarning) return GrafanaDashboard(LZMABase64.compress(raw_json)) def _deserialize(self) -> Dict[str, Any]: + warnings.warn("GrafanaDashboard._deserialize is deprecated; use json.loads(LZMABase64.decompress(...)) instead.", category=DeprecationWarning) try: return json.loads(LZMABase64.decompress(self)) except json.decoder.JSONDecodeError as e: