mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 23:04:21 +01:00
Apply pylint's linting rules to bfxapi/__init__.py, bfxapi/enums.py, bfxapi/exceptions.py, bfxapi/labeler.py, bfxapi/notification.py and bfxapi/urls.py.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import List, Dict, Union, Optional, Any, TypedDict, Generic, TypeVar, cast
|
||||
from typing import List, Optional, Any, Generic, TypeVar, cast
|
||||
from dataclasses import dataclass
|
||||
from .labeler import _Type, _Serializer
|
||||
|
||||
@@ -7,7 +7,7 @@ T = TypeVar("T")
|
||||
@dataclass
|
||||
class Notification(_Type, Generic[T]):
|
||||
mts: int
|
||||
type: str
|
||||
type: str
|
||||
message_id: Optional[int]
|
||||
data: T
|
||||
code: Optional[int]
|
||||
@@ -18,7 +18,7 @@ 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, IGNORE = [ "_PLACEHOLDER" ])
|
||||
super().__init__("Notification", Notification, _Notification.__LABELS, ignore = [ "_PLACEHOLDER" ])
|
||||
|
||||
self.serializer, self.is_iterable = serializer, is_iterable
|
||||
|
||||
@@ -28,11 +28,11 @@ class _Notification(_Serializer, Generic[T]):
|
||||
if isinstance(self.serializer, _Serializer):
|
||||
data = cast(List[Any], notification.data)
|
||||
|
||||
if self.is_iterable == False:
|
||||
if not self.is_iterable:
|
||||
if len(data) == 1 and isinstance(data[0], list):
|
||||
data = data[0]
|
||||
|
||||
notification.data = cast(T, self.serializer.klass(**dict(self.serializer._serialize(*data, skip=skip))))
|
||||
else: notification.data = cast(T, [ self.serializer.klass(**dict(self.serializer._serialize(*sub_data, skip=skip))) for sub_data in data ])
|
||||
notification.data = self.serializer.parse(*data, skip=skip)
|
||||
else: notification.data = cast(T, [ self.serializer.parse(*sub_data, skip=skip) for sub_data in data ])
|
||||
|
||||
return notification
|
||||
return notification
|
||||
|
||||
Reference in New Issue
Block a user