utils: add support for msgspec with stdlib json fallback

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan
2023-06-26 19:59:04 -04:00
parent 3ccf02c156
commit f99e5b0bea
23 changed files with 137 additions and 100 deletions

View File

@@ -7,7 +7,7 @@ from __future__ import annotations
import pathlib
import logging
import configparser
import json
from ..utils import json_wrapper as jsonw
from typing import (
TYPE_CHECKING,
Dict,
@@ -73,8 +73,8 @@ class Secrets:
def _parse_json(self, data: str) -> Optional[Dict[str, Any]]:
try:
return json.loads(data)
except json.JSONDecodeError:
return jsonw.loads(data)
except jsonw.JSONDecodeError:
return None
def get_type(self) -> str: