Skip to content

Commit 0a18807

Browse files
Update and apply pre-commit hooks
1 parent 4b2894d commit 0a18807

File tree

17 files changed

+33
-58
lines changed

17 files changed

+33
-58
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77

88
repos:
99
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: v0.8.0
10+
rev: v0.12.7
1111
hooks:
1212
- id: ruff
1313
args:
1414
- --preview
1515
- --fix
1616
- --exit-non-zero-on-fix
1717
- repo: https://github.com/pre-commit/mirrors-mypy
18-
rev: v1.13.0
18+
rev: v1.17.1
1919
hooks:
2020
- id: mypy
2121
name: mypy
@@ -26,11 +26,11 @@ repos:
2626
- --install-types
2727
- --non-interactive
2828
- repo: https://github.com/gitleaks/gitleaks
29-
rev: v8.21.2
29+
rev: v8.28.0
3030
hooks:
3131
- id: gitleaks
3232
- repo: https://github.com/codespell-project/codespell
33-
rev: v2.3.0
33+
rev: v2.4.1
3434
hooks:
3535
- id: codespell
3636
additional_dependencies: [tomli]
@@ -67,21 +67,21 @@ repos:
6767
- id: rst-inline-touching-normal
6868
- id: text-unicode-replacement-char
6969
- repo: https://github.com/psf/black
70-
rev: 24.10.0
70+
rev: 25.1.0
7171
hooks:
7272
- id: black
7373
- repo: https://github.com/rbubley/mirrors-prettier
74-
rev: v3.3.3
74+
rev: v3.6.2
7575
hooks:
7676
- id: prettier
7777
- repo: https://github.com/PyCQA/isort # TODO: remove as soon as ruff is stable
78-
rev: 5.13.2
78+
rev: 6.0.1
7979
hooks:
8080
- id: isort
8181
args:
8282
- --profile=black
8383
- repo: https://github.com/PyCQA/bandit
84-
rev: 1.7.10
84+
rev: 1.8.6
8585
hooks:
8686
- id: bandit
8787
exclude: "^tests/.*|examples/.*"

examples/spot_trading_bot_template.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# All rights reserved.
66
# https://github.com/btschwertfeger
77
#
8-
# ruff: noqa: RUF027
98

109
"""
1110
Module that provides a template to build a Spot trading algorithm using the

src/kraken/base_api/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import json
2727
import time
2828
from functools import wraps
29-
from typing import TYPE_CHECKING, Any, TypeVar
29+
from typing import TYPE_CHECKING, Any, Self
3030
from urllib.parse import urlencode, urljoin
3131
from uuid import uuid1
3232

@@ -41,8 +41,6 @@
4141

4242
from kraken.utils.utils import deprecated
4343

44-
Self = TypeVar("Self")
45-
4644

4745
def defined(value: Any) -> bool: # noqa: ANN401
4846
"""Returns ``True`` if ``value`` is not ``None``"""

src/kraken/futures/funding.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@
2020

2121
from __future__ import annotations
2222

23-
from typing import TypeVar
23+
from typing import Self
2424

2525
from kraken.base_api import FuturesClient
2626

27-
Self = TypeVar("Self")
28-
2927

3028
class Funding(FuturesClient):
3129
"""

src/kraken/futures/market.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@
2222
from __future__ import annotations
2323

2424
from functools import lru_cache
25-
from typing import TypeVar
25+
from typing import Self
2626

2727
from kraken.base_api import FuturesClient, defined, ensure_string
2828

29-
Self = TypeVar("Self")
30-
3129

3230
class Market(FuturesClient):
3331
"""

src/kraken/futures/trade.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@
2020

2121
from __future__ import annotations
2222

23-
from typing import TypeVar
23+
from typing import Self
2424

2525
from kraken.base_api import FuturesClient, defined
2626

27-
Self = TypeVar("Self")
28-
2927

3028
class Trade(FuturesClient):
3129
"""

src/kraken/futures/user.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@
2020

2121
from __future__ import annotations
2222

23-
from typing import TYPE_CHECKING, TypeVar
23+
from typing import TYPE_CHECKING, Self
2424

2525
from kraken.base_api import FuturesClient, defined
2626

2727
if TYPE_CHECKING:
2828
import requests
2929

30-
Self = TypeVar("Self")
31-
3230

3331
class User(FuturesClient):
3432
"""

src/kraken/futures/websocket/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ async def __run( # noqa: C901
129129

130130
while self.keep_alive:
131131
try:
132-
_message = await asyncio.wait_for(self.socket.recv(), timeout=10)
132+
data: str = await asyncio.wait_for(self.socket.recv(), timeout=10)
133133
except TimeoutError:
134134
LOG.debug( # important
135135
"Timeout error in %s",
@@ -140,19 +140,19 @@ async def __run( # noqa: C901
140140
self.keep_alive = False
141141
else:
142142
try:
143-
message: dict = json.loads(_message)
143+
message: dict = json.loads(data)
144144
except ValueError:
145-
LOG.warning(_message)
145+
LOG.warning(data)
146146
else:
147147
forward: bool = True
148148
if "event" in message:
149-
_event: str = message["event"]
150-
if _event == "challenge" and "message" in message:
149+
msg_event: str = message["event"]
150+
if msg_event == "challenge" and "message" in message:
151151
forward = False
152152
self.__handle_new_challenge(message)
153-
elif _event == "subscribed":
153+
elif msg_event == "subscribed":
154154
self.__append_subscription(message)
155-
elif _event == "unsubscribed":
155+
elif msg_event == "unsubscribed":
156156
self.__remove_subscription(message)
157157
if forward:
158158
await self.__callback(message)

src/kraken/futures/ws_client.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import logging
2727
from asyncio import sleep as async_sleep
2828
from copy import deepcopy
29-
from typing import TYPE_CHECKING, TypeVar
29+
from typing import TYPE_CHECKING, Self
3030

3131
from kraken.base_api import FuturesAsyncClient
3232
from kraken.exceptions import KrakenAuthenticationError
@@ -37,8 +37,6 @@
3737
from typing import Any
3838
from kraken.utils.utils import deprecated
3939

40-
Self = TypeVar("Self")
41-
4240
LOG: logging.Logger = logging.getLogger(__name__)
4341

4442

@@ -458,7 +456,7 @@ def get_active_subscriptions(self: FuturesWSClient) -> list[dict]:
458456
async def __aenter__(self: Self) -> Self:
459457
"""Entrypoint for use as context manager"""
460458
await super().__aenter__()
461-
await self.start() # type: ignore[attr-defined]
459+
await self.start()
462460
return self
463461

464462
async def __aexit__(

src/kraken/spot/earn.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@
2020

2121
from __future__ import annotations
2222

23-
from typing import TypeVar
23+
from typing import Self
2424

2525
from kraken.base_api import SpotClient, defined
2626

27-
Self = TypeVar("Self")
28-
2927

3028
class Earn(SpotClient):
3129
"""

0 commit comments

Comments
 (0)