Remove all old '# pylint:' comments from all python files.

This commit is contained in:
Davide Casale
2024-02-26 20:04:09 +01:00
parent 6a700690d7
commit 2344d44aa0
10 changed files with 0 additions and 28 deletions

View File

@@ -1,7 +1,6 @@
import sys import sys
from copy import copy from copy import copy
# pylint: disable-next=wildcard-import,unused-wildcard-import
from logging import * from logging import *
from typing import TYPE_CHECKING, Literal, Optional from typing import TYPE_CHECKING, Literal, Optional
@@ -42,7 +41,6 @@ class _ColorFormatter(Formatter):
return super().format(_record) return super().format(_record)
# pylint: disable-next=invalid-name
def formatTime(self, record: LogRecord, datefmt: Optional[str] = None) -> str: def formatTime(self, record: LogRecord, datefmt: Optional[str] = None) -> str:
return _GREEN + super().formatTime(record, datefmt) + _NC return _GREEN + super().formatTime(record, datefmt) + _NC

View File

@@ -39,7 +39,6 @@ from ...types.serializers import _Notification
from ..middleware import Middleware from ..middleware import Middleware
# pylint: disable-next=too-many-public-methods
class RestAuthEndpoints(Middleware): class RestAuthEndpoints(Middleware):
def get_user_info(self) -> UserInfo: def get_user_info(self) -> UserInfo:
return serializers.UserInfo.parse(*self._post("auth/r/info/user")) return serializers.UserInfo.parse(*self._post("auth/r/info/user"))
@@ -368,7 +367,6 @@ class RestAuthEndpoints(Middleware):
for sub_data in self._post(endpoint) for sub_data in self._post(endpoint)
] ]
# pylint: disable-next=too-many-arguments
def submit_funding_offer( def submit_funding_offer(
self, self,
type: str, type: str,
@@ -552,7 +550,6 @@ class RestAuthEndpoints(Middleware):
*(self._post(f"auth/r/info/funding/{key}")[2]) *(self._post(f"auth/r/info/funding/{key}")[2])
) )
# pylint: disable-next=too-many-arguments
def transfer_between_wallets( def transfer_between_wallets(
self, self,
from_wallet: str, from_wallet: str,

View File

@@ -28,7 +28,6 @@ _CustomerInfo = TypedDict(
class RestMerchantEndpoints(Middleware): class RestMerchantEndpoints(Middleware):
# pylint: disable-next=too-many-arguments
def submit_invoice( def submit_invoice(
self, self,
amount: Union[str, float, Decimal], amount: Union[str, float, Decimal],
@@ -179,7 +178,6 @@ class RestMerchantEndpoints(Middleware):
def get_merchant_settings(self, key: str) -> Any: def get_merchant_settings(self, key: str) -> Any:
return self._post("auth/r/ext/pay/settings/get", body={"key": key}) return self._post("auth/r/ext/pay/settings/get", body={"key": key})
# pylint: disable-next=dangerous-default-value
def list_merchant_settings(self, keys: List[str] = []) -> Dict[str, Any]: def list_merchant_settings(self, keys: List[str] = []) -> Dict[str, Any]:
return self._post("auth/r/ext/pay/settings/list", body={"keys": keys}) return self._post("auth/r/ext/pay/settings/list", body={"keys": keys})

View File

@@ -28,7 +28,6 @@ from ...types import (
from ..middleware import Middleware from ..middleware import Middleware
# pylint: disable-next=too-many-public-methods
class RestPublicEndpoints(Middleware): class RestPublicEndpoints(Middleware):
def conf(self, config: str) -> Any: def conf(self, config: str) -> Any:
return self._get(f"conf/{config}")[0] return self._get(f"conf/{config}")[0]

View File

@@ -1,13 +1,11 @@
from . import dataclasses from . import dataclasses
# pylint: disable-next=unused-import
from .labeler import ( from .labeler import (
_Serializer, _Serializer,
generate_labeler_serializer, generate_labeler_serializer,
generate_recursive_serializer, generate_recursive_serializer,
) )
# pylint: disable-next=unused-import
from .notification import _Notification from .notification import _Notification
__serializers__ = [ __serializers__ = [

View File

@@ -67,7 +67,6 @@ class _Delay:
self.__backoff_delay = _Delay.__BACKOFF_MIN self.__backoff_delay = _Delay.__BACKOFF_MIN
# pylint: disable-next=too-many-instance-attributes
class BfxWebSocketClient(Connection): class BfxWebSocketClient(Connection):
def __init__( def __init__(
self, self,
@@ -101,7 +100,6 @@ class BfxWebSocketClient(Connection):
type(exception), exception, exception.__traceback__ type(exception), exception, exception.__traceback__
) )
# pylint: disable-next=logging-not-lazy
self.__logger.critical(header + "\n" + str().join(stack_trace)[:-1]) self.__logger.critical(header + "\n" + str().join(stack_trace)[:-1])
@property @property
@@ -111,7 +109,6 @@ class BfxWebSocketClient(Connection):
def run(self) -> None: def run(self) -> None:
return asyncio.get_event_loop().run_until_complete(self.start()) return asyncio.get_event_loop().run_until_complete(self.start())
# pylint: disable-next=too-many-branches
async def start(self) -> None: async def start(self) -> None:
_delay = _Delay(backoff_factor=1.618) _delay = _Delay(backoff_factor=1.618)
@@ -149,7 +146,6 @@ class BfxWebSocketClient(Connection):
except asyncio.CancelledError: except asyncio.CancelledError:
pass pass
# pylint: disable-next=consider-using-dict-items
for bucket in self.__buckets: for bucket in self.__buckets:
if task := self.__buckets[bucket]: if task := self.__buckets[bucket]:
self.__buckets[bucket] = None self.__buckets[bucket] = None
@@ -185,14 +181,12 @@ class BfxWebSocketClient(Connection):
(isinstance(error, InvalidStatusCode) and error.status_code == 408) (isinstance(error, InvalidStatusCode) and error.status_code == 408)
or isinstance(error, gaierror) or isinstance(error, gaierror)
) and self.__reconnection: ) and self.__reconnection:
# pylint: disable-next=logging-fstring-interpolation
self.__logger.warning( self.__logger.warning(
"Reconnection attempt unsuccessful (no." "Reconnection attempt unsuccessful (no."
f"{self.__reconnection['attempts']}): next attempt in " f"{self.__reconnection['attempts']}): next attempt in "
f"~{int(_delay.peek())}.0s." f"~{int(_delay.peek())}.0s."
) )
# pylint: disable-next=logging-fstring-interpolation
self.__logger.info( self.__logger.info(
f"The client has been offline for " f"The client has been offline for "
f"{datetime.now() - self.__reconnection['timestamp']}." f"{datetime.now() - self.__reconnection['timestamp']}."
@@ -214,7 +208,6 @@ class BfxWebSocketClient(Connection):
async def __connect(self) -> None: async def __connect(self) -> None:
async with websockets.client.connect(self._host) as websocket: async with websockets.client.connect(self._host) as websocket:
if self.__reconnection: if self.__reconnection:
# pylint: disable-next=logging-fstring-interpolation
self.__logger.warning( self.__logger.warning(
"Reconnection attempt successful (no." "Reconnection attempt successful (no."
f"{self.__reconnection['attempts']}): recovering " f"{self.__reconnection['attempts']}): recovering "
@@ -307,7 +300,6 @@ class BfxWebSocketClient(Connection):
@Connection._require_websocket_connection @Connection._require_websocket_connection
async def unsubscribe(self, sub_id: str) -> None: async def unsubscribe(self, sub_id: str) -> None:
# pylint: disable-next=consider-using-dict-items
for bucket in self.__buckets: for bucket in self.__buckets:
if bucket.has(sub_id): if bucket.has(sub_id):
if bucket.count == 1: if bucket.count == 1:

View File

@@ -99,7 +99,6 @@ class BfxWebSocketInputs:
"oc_multi", {"id": id, "cid": cid, "gid": gid, "all": all} "oc_multi", {"id": id, "cid": cid, "gid": gid, "all": all}
) )
# pylint: disable-next=too-many-arguments
async def submit_funding_offer( async def submit_funding_offer(
self, self,
type: str, type: str,

View File

@@ -6,7 +6,6 @@ from datetime import datetime
from functools import wraps from functools import wraps
from typing import Any, Awaitable, Callable, Dict, List, Optional, TypeVar, cast from typing import Any, Awaitable, Callable, Dict, List, Optional, TypeVar, cast
# pylint: disable-next=wrong-import-order
from typing_extensions import Concatenate, ParamSpec from typing_extensions import Concatenate, ParamSpec
from websockets.client import WebSocketClientProtocol from websockets.client import WebSocketClientProtocol

View File

@@ -39,7 +39,6 @@ class PublicChannelsHandler:
elif subscription["channel"] == "status": elif subscription["channel"] == "status":
self.__status_channel_handler(cast(Status, subscription), stream) self.__status_channel_handler(cast(Status, subscription), stream)
# pylint: disable-next=inconsistent-return-statements
def __ticker_channel_handler(self, subscription: Ticker, stream: List[Any]): def __ticker_channel_handler(self, subscription: Ticker, stream: List[Any]):
if subscription["symbol"].startswith("t"): if subscription["symbol"].startswith("t"):
return self.__event_emitter.emit( return self.__event_emitter.emit(
@@ -55,7 +54,6 @@ class PublicChannelsHandler:
serializers.FundingCurrencyTicker.parse(*stream[0]), serializers.FundingCurrencyTicker.parse(*stream[0]),
) )
# pylint: disable-next=inconsistent-return-statements
def __trades_channel_handler(self, subscription: Trades, stream: List[Any]): def __trades_channel_handler(self, subscription: Trades, stream: List[Any]):
if (event := stream[0]) and event in ["te", "tu", "fte", "ftu"]: if (event := stream[0]) and event in ["te", "tu", "fte", "ftu"]:
events = { events = {
@@ -99,7 +97,6 @@ class PublicChannelsHandler:
], ],
) )
# pylint: disable-next=inconsistent-return-statements
def __book_channel_handler(self, subscription: Book, stream: List[Any]): def __book_channel_handler(self, subscription: Book, stream: List[Any]):
if subscription["symbol"].startswith("t"): if subscription["symbol"].startswith("t"):
if all(isinstance(sub_stream, list) for sub_stream in stream[0]): if all(isinstance(sub_stream, list) for sub_stream in stream[0]):
@@ -135,7 +132,6 @@ class PublicChannelsHandler:
serializers.FundingCurrencyBook.parse(*stream[0]), serializers.FundingCurrencyBook.parse(*stream[0]),
) )
# pylint: disable-next=inconsistent-return-statements
def __raw_book_channel_handler(self, subscription: Book, stream: List[Any]): def __raw_book_channel_handler(self, subscription: Book, stream: List[Any]):
if subscription["symbol"].startswith("t"): if subscription["symbol"].startswith("t"):
if all(isinstance(sub_stream, list) for sub_stream in stream[0]): if all(isinstance(sub_stream, list) for sub_stream in stream[0]):
@@ -171,7 +167,6 @@ class PublicChannelsHandler:
serializers.FundingCurrencyRawBook.parse(*stream[0]), serializers.FundingCurrencyRawBook.parse(*stream[0]),
) )
# pylint: disable-next=inconsistent-return-statements
def __candles_channel_handler(self, subscription: Candles, stream: List[Any]): def __candles_channel_handler(self, subscription: Candles, stream: List[Any]):
if all(isinstance(sub_stream, list) for sub_stream in stream[0]): if all(isinstance(sub_stream, list) for sub_stream in stream[0]):
return self.__event_emitter.emit( return self.__event_emitter.emit(
@@ -184,7 +179,6 @@ class PublicChannelsHandler:
"candles_update", subscription, serializers.Candle.parse(*stream[0]) "candles_update", subscription, serializers.Candle.parse(*stream[0])
) )
# pylint: disable-next=inconsistent-return-statements
def __status_channel_handler(self, subscription: Status, stream: List[Any]): def __status_channel_handler(self, subscription: Status, stream: List[Any]):
if subscription["key"].startswith("deriv:"): if subscription["key"].startswith("deriv:"):
return self.__event_emitter.emit( return self.__event_emitter.emit(
@@ -200,6 +194,5 @@ class PublicChannelsHandler:
serializers.Liquidation.parse(*stream[0][0]), serializers.Liquidation.parse(*stream[0][0]),
) )
# pylint: disable-next=inconsistent-return-statements
def __checksum_handler(self, subscription: Book, value: int): def __checksum_handler(self, subscription: Book, value: int):
return self.__event_emitter.emit("checksum", subscription, value & 0xFFFFFFFF) return self.__event_emitter.emit("checksum", subscription, value & 0xFFFFFFFF)

View File

@@ -3,7 +3,6 @@ from distutils.core import setup
_version = { } _version = { }
with open("bfxapi/_version.py", encoding="utf-8") as f: with open("bfxapi/_version.py", encoding="utf-8") as f:
#pylint: disable-next=exec-used
exec(f.read(), _version) exec(f.read(), _version)
setup( setup(