mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 06:44:22 +01:00
Apply black to all python files (bfxapi/**/*.py).
This commit is contained in:
@@ -5,6 +5,7 @@ from .labeler import _Serializer, _Type
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
@dataclass
|
||||
class Notification(_Type, Generic[T]):
|
||||
mts: int
|
||||
@@ -15,16 +16,30 @@ class Notification(_Type, Generic[T]):
|
||||
status: str
|
||||
text: str
|
||||
|
||||
class _Notification(_Serializer, Generic[T]):
|
||||
__LABELS = [ "mts", "type", "message_id", "_PLACEHOLDER", "data", "code", "status", "text" ]
|
||||
|
||||
def __init__(self, serializer: Optional[_Serializer] = None, is_iterable: bool = False):
|
||||
class _Notification(_Serializer, Generic[T]):
|
||||
__LABELS = [
|
||||
"mts",
|
||||
"type",
|
||||
"message_id",
|
||||
"_PLACEHOLDER",
|
||||
"data",
|
||||
"code",
|
||||
"status",
|
||||
"text",
|
||||
]
|
||||
|
||||
def __init__(
|
||||
self, serializer: Optional[_Serializer] = None, is_iterable: bool = False
|
||||
):
|
||||
super().__init__("Notification", Notification, _Notification.__LABELS)
|
||||
|
||||
self.serializer, self.is_iterable = serializer, is_iterable
|
||||
|
||||
def parse(self, *values: Any) -> Notification[T]:
|
||||
notification = cast(Notification[T], Notification(**dict(self._serialize(*values))))
|
||||
notification = cast(
|
||||
Notification[T], Notification(**dict(self._serialize(*values)))
|
||||
)
|
||||
|
||||
if isinstance(self.serializer, _Serializer):
|
||||
data = cast(List[Any], notification.data)
|
||||
@@ -34,6 +49,9 @@ class _Notification(_Serializer, Generic[T]):
|
||||
data = data[0]
|
||||
|
||||
notification.data = self.serializer.parse(*data)
|
||||
else: notification.data = cast(T, [ self.serializer.parse(*sub_data) for sub_data in data ])
|
||||
else:
|
||||
notification.data = cast(
|
||||
T, [self.serializer.parse(*sub_data) for sub_data in data]
|
||||
)
|
||||
|
||||
return notification
|
||||
|
||||
Reference in New Issue
Block a user