Skip to content

Commit

Permalink
Add deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sed-i committed Dec 17, 2024
1 parent 1b42090 commit 06e3944
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cosl/grafana_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import logging
import lzma
from typing import Any, Dict, Union
import warnings

logger = logging.getLogger(__name__)

Expand All @@ -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:
Expand Down

0 comments on commit 06e3944

Please sign in to comment.