Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.

Commit 2736c09

Browse files
pre-commit-ci[bot]b-rowan
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 615cf81 commit 2736c09

6 files changed

Lines changed: 17 additions & 13 deletions

File tree

pyasic/data/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import time
1818
from collections.abc import Callable
1919
from datetime import datetime, timezone
20-
from typing import Optional, Any
20+
from typing import Any, Optional
2121

2222
from pydantic import BaseModel, Field, computed_field
2323

@@ -140,7 +140,7 @@ def fields(cls) -> set:
140140
all_fields.update(set(cls.model_computed_fields.keys()))
141141
return all_fields
142142

143-
def get(self, __key: str, default: Optional[Any] = None):
143+
def get(self, __key: str, default: Any | None = None):
144144
try:
145145
val = self.__getitem__(__key)
146146
if val is None:

pyasic/data/boards.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from __future__ import annotations
1717

1818
from collections.abc import Callable
19-
from typing import Optional, Any
19+
from typing import Any, Optional
2020

2121
from pydantic import BaseModel
2222

@@ -62,7 +62,7 @@ def fields(cls) -> set:
6262
all_fields.update(set(cls.model_computed_fields.keys()))
6363
return all_fields
6464

65-
def get(self, __key: str, default: Optional[Any] = None):
65+
def get(self, __key: str, default: Any | None = None):
6666
try:
6767
val = self.__getitem__(__key)
6868
if val is None:

pyasic/data/fans.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License. -
1515
# ------------------------------------------------------------------------------
1616

17-
from typing import Optional, Any
17+
from typing import Any, Optional
1818

1919
from pydantic import BaseModel
2020

@@ -28,7 +28,7 @@ class Fan(BaseModel):
2828

2929
speed: int | None = None
3030

31-
def get(self, __key: str, default: Optional[Any] = None):
31+
def get(self, __key: str, default: Any | None = None):
3232
try:
3333
val = self.__getitem__(__key)
3434
if val is None:

pyasic/miners/backends/btminer.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# ------------------------------------------------------------------------------
1616
import asyncio
1717
import logging
18+
from typing import Optional
1819

1920
import aiofiles
2021
import semver
@@ -28,7 +29,6 @@
2829
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, RPCAPICommand
2930
from pyasic.miners.device.firmware import StockFirmware
3031
from pyasic.rpc.btminer import BTMinerRPCAPI, BTMinerV3RPCAPI
31-
from typing import Optional
3232

3333

3434
class BTMiner(StockFirmware):
@@ -629,7 +629,9 @@ async def _get_errors(
629629
pass
630630
return errors # type: ignore[return-value]
631631

632-
async def _get_serial_number(self, rpc_get_miner_info: Optional[dict] = None) -> str | None:
632+
async def _get_serial_number(
633+
self, rpc_get_miner_info: dict | None = None
634+
) -> str | None:
633635
if rpc_get_miner_info is None:
634636
try:
635637
rpc_get_miner_info = await self.rpc.get_miner_info()
@@ -1123,7 +1125,9 @@ async def _get_psu_fans(self, rpc_get_device_info: dict | None = None) -> list[F
11231125
rpm = rpc_get_device_info.get("msg", {}).get("power", {}).get("fanspeed")
11241126
return [Fan(speed=rpm)] if rpm is not None else []
11251127

1126-
async def _get_serial_number(self, rpc_get_device_info: Optional[dict] = None) -> str | None:
1128+
async def _get_serial_number(
1129+
self, rpc_get_device_info: dict | None = None
1130+
) -> str | None:
11271131
if rpc_get_device_info is None:
11281132
try:
11291133
rpc_get_device_info = await self.rpc.get_device_info()

pyasic/rpc/btminer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import typing
2727
import warnings
2828
from collections.abc import AsyncGenerator
29-
from typing import Optional, Any, Literal
29+
from typing import Any, Literal, Optional
3030

3131
import httpx
3232
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
@@ -1178,7 +1178,7 @@ async def multicommand(self, *commands: str, allow_warning: bool = True) -> dict
11781178
async def send_command(
11791179
self,
11801180
command: str,
1181-
parameters: Optional[Any] = None,
1181+
parameters: Any | None = None,
11821182
ignore_errors: bool = False,
11831183
allow_warning: bool = True,
11841184
**kwargs,

pyasic/settings/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License. -
1515
# ------------------------------------------------------------------------------
1616
from ssl import SSLContext
17-
from typing import Optional, Any
17+
from typing import Any, Optional
1818

1919
import httpx
2020
from httpx import AsyncHTTPTransport
@@ -64,7 +64,7 @@ def transport(verify: str | bool | SSLContext = ssl_cxt):
6464
return AsyncHTTPTransport(verify=verify)
6565

6666

67-
def get(key: str, other: Optional[Any] = None) -> Any:
67+
def get(key: str, other: Any | None = None) -> Any:
6868
try:
6969
return getattr(_settings, key)
7070
except AttributeError:

0 commit comments

Comments
 (0)