2 Commits

Author SHA1 Message Date
azalea df16f90a8f [U] Release 1.0.19 2023-07-28 20:52:27 -07:00
azalea 25aecabd34 [+] SafeNamespace 2023-07-28 20:49:51 -07:00
3 changed files with 12 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
from __future__ import annotations
__version__ = "1.0.18"
__version__ = "1.0.19"
import time
from typing import Callable
+10 -2
View File
@@ -119,8 +119,16 @@ def json_stringify(obj: object, forced: bool = True, **kwargs) -> str:
return json.dumps(obj, **args)
def jsn(s: str) -> SimpleNamespace:
return json.loads(s, object_hook=lambda d: SimpleNamespace(**d))
class SafeNamespace(SimpleNamespace):
def __getattr__(self, attr):
try:
return super().__getattr__(attr)
except AttributeError:
return None
def jsn(s: str) -> SafeNamespace:
return json.loads(s, object_hook=lambda d: SafeNamespace(**d))
def ensure_dir(path: Path | str) -> Path:
+1
View File
@@ -26,6 +26,7 @@ setup(
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
packages=find_packages(exclude=("tests",)),
include_package_data=True,