Add support for SimpleNamespace (instead of TypedDict) in bfxapi/labeler.py and bfxapi/notifications.py. Add generics Notification type in notifications.py. Add support for new changes in bfxapi/rest/BfxRestInterface.py.

This commit is contained in:
Davide Casale
2023-01-13 18:15:29 +01:00
parent b5b3e7718a
commit 903f68c6e3
4 changed files with 59 additions and 51 deletions

View File

@@ -2,6 +2,8 @@ from .exceptions import LabelerSerializerException
from typing import Generic, TypeVar, Iterable, Optional, List, Tuple, Any, cast
from types import SimpleNamespace
T = TypeVar("T")
class _Serializer(Generic[T]):
@@ -19,4 +21,4 @@ class _Serializer(Generic[T]):
yield label, args[index]
def parse(self, *values: Any, skip: Optional[List[str]] = None) -> T:
return cast(T, dict(self._serialize(*values, skip=skip)))
return cast(T, SimpleNamespace(**dict(self._serialize(*values, skip=skip))))