mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
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:
@@ -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))))
|
||||
Reference in New Issue
Block a user