Skip to content

Commit 37470fa

Browse files
format
1 parent d1bb5e7 commit 37470fa

14 files changed

Lines changed: 77 additions & 41 deletions

File tree

src/ipr.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,9 @@ def show_confirmation(self):
918918
else:
919919
confirm = IPRConfirmation()
920920
# IPRConfirmation Signals
921-
confirm.actionOpenBrowser.clicked.connect(lambda: self.open_dashboard(ip, http_port))
921+
confirm.actionOpenBrowser.clicked.connect(
922+
lambda: self.open_dashboard(ip, http_port)
923+
)
922924
confirm.accept.clicked.connect(confirm.hide)
923925
# copy action
924926
confirm.lineIPField.actionCopy = self.create_copy_text_action(

src/mod/api/client.py

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ def get_client(self):
4343
return self.client
4444

4545
def create_bitmain_client(
46-
self, ip_addr: str, passwd: Optional[str] = None, vnish_passwd: Optional[str] = None
46+
self,
47+
ip_addr: str,
48+
passwd: Optional[str] = None,
49+
vnish_passwd: Optional[str] = None,
4750
) -> None:
4851
try:
4952
self.client = BitmainHTTPClient(ip_addr, passwd, vnish_passwd)
@@ -58,50 +61,68 @@ def create_iceriver_client(
5861
except FailedConnectionError as err:
5962
logger.error(err)
6063

61-
def create_whatsminer_client(self, ip_addr: str, passwd: Optional[str] = None) -> None:
64+
def create_whatsminer_client(
65+
self, ip_addr: str, passwd: Optional[str] = None
66+
) -> None:
6267
try:
6368
self.client = WhatsminerRPCClient(ip_addr, passwd)
6469
except FailedConnectionError as err:
6570
logger.error(err)
6671

67-
def create_whatsminerv3_client(self, ip_addr: str, user: Optional[str] = None, passwd: Optional[str] = None) -> None:
72+
def create_whatsminerv3_client(
73+
self, ip_addr: str, user: Optional[str] = None, passwd: Optional[str] = None
74+
) -> None:
6875
try:
6976
self.client = WhatsminerV3Client(ip_addr, user, passwd)
7077
except FailedConnectionError as err:
7178
logger.error(err)
7279

73-
def create_volcminer_client(self, ip_addr: str, passwd: Optional[str] = None) -> None:
80+
def create_volcminer_client(
81+
self, ip_addr: str, passwd: Optional[str] = None
82+
) -> None:
7483
try:
7584
self.client = VolcminerHTTPClient(ip_addr, passwd)
7685
except (FailedConnectionError, AuthenticationError) as err:
7786
logger.error(err)
7887

79-
def create_goldshell_client(self, ip_addr: str, passwd: Optional[str] = None) -> None:
88+
def create_goldshell_client(
89+
self, ip_addr: str, passwd: Optional[str] = None
90+
) -> None:
8091
try:
8192
self.client = GoldshellHTTPClient(ip_addr, passwd)
8293
except (FailedConnectionError, AuthenticationError) as err:
8394
logger.error(err)
8495

85-
def create_sealminer_client(self, ip_addr: str, passwd: Optional[str] = None) -> None:
96+
def create_sealminer_client(
97+
self, ip_addr: str, passwd: Optional[str] = None
98+
) -> None:
8699
try:
87100
self.client = SealminerHTTPClient(ip_addr, passwd)
88101
except (FailedConnectionError, AuthenticationError) as err:
89102
logger.error(err)
90103

91-
def create_elphapex_client(self, ip_addr: str, passwd: Optional[str] = None) -> None:
104+
def create_elphapex_client(
105+
self, ip_addr: str, passwd: Optional[str] = None
106+
) -> None:
92107
try:
93108
self.client = ElphapexHTTPClient(ip_addr, passwd)
94109
except (FailedConnectionError, AuthenticationError) as err:
95110
logger.error(err)
96111

97-
def create_dragonball_client(self, ip_addr: str, passwd: Optional[str] = None) -> None:
112+
def create_dragonball_client(
113+
self, ip_addr: str, passwd: Optional[str] = None
114+
) -> None:
98115
try:
99116
self.client = DragonballHTTPClient(ip_addr, passwd)
100117
except (FailedConnectionError, AuthenticationError) as err:
101118
logger.error(err)
102119

103120
def create_client_from_type(
104-
self, miner_type: str, ip_addr: str, auth: Optional[str] = None, custom_auth: Optional[str] = None
121+
self,
122+
miner_type: str,
123+
ip_addr: str,
124+
auth: Optional[str] = None,
125+
custom_auth: Optional[str] = None,
105126
) -> None:
106127
match miner_type:
107128
case "antminer":
@@ -181,12 +202,14 @@ def is_dragonball(self) -> bool:
181202
return True
182203
return False
183204

184-
def upgrade_whatsminer_client(self, ip: str, user: Optional[str] = None, passwd: Optional[str] = None) -> None:
205+
def upgrade_whatsminer_client(
206+
self, ip: str, user: Optional[str] = None, passwd: Optional[str] = None
207+
) -> None:
185208
if self.client and isinstance(self.client, WhatsminerRPCClient):
186209
ver = self.client.get_version()
187210
if int(ver["Msg"]["fw_ver"][:6]) > 202412:
188-
self.close_client()
189-
self.create_whatsminerv3_client(ip, user, passwd)
211+
self.close_client()
212+
self.create_whatsminerv3_client(ip, user, passwd)
190213

191214
def get_target_info(self, parser: Parser) -> Dict[str, str]:
192215
result = parser.get_target()

src/mod/api/http.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ def __retry_send(self, req: requests.PreparedRequest, **kwargs):
8484
requests.exceptions.ConnectionError,
8585
requests.exceptions.ChunkedEncodingError,
8686
) as e:
87-
if (
88-
isinstance(e, requests.exceptions.ConnectionError) or
89-
isinstance(e, requests.exceptions.ConnectTimeout)
87+
if isinstance(e, requests.exceptions.ConnectionError) or isinstance(
88+
e, requests.exceptions.ConnectTimeout
9089
):
9190
break
9291
else:

src/mod/api/miners/bitmain/client.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@
1515
class BitmainHTTPClient(BaseHTTPClient):
1616
"""Bitmain/Antminer HTTP Client with support for vnish"""
1717

18-
def __init__(self, ip_addr: str, passwd: Optional[str], vnish_passwd: Optional[str]):
18+
def __init__(
19+
self, ip_addr: str, passwd: Optional[str], vnish_passwd: Optional[str]
20+
):
1921
super().__init__(ip_addr)
2022
self.url = f"http://{self.ip}:{self.port}/"
2123
self.username = "root"
2224
self.passwds = [passwd, settings.get("default_bitmain_passwd")]
23-
self.vnish_passwds: List[str] = [vnish_passwd, settings.get("default_vnish_passwd")]
25+
self.vnish_passwds: List[str] = [
26+
vnish_passwd,
27+
settings.get("default_vnish_passwd"),
28+
]
2429
self.command_format = {
2530
"vnish": "api/v1",
2631
"stock": Template("cgi-bin/${cmd}.cgi"),
@@ -66,7 +71,7 @@ def run_command(
6671
command: str,
6772
params: Optional[Dict[str, str]] = None,
6873
payload: Optional[Dict[str, Any]] = None,
69-
data: Optional[Dict[str, Any]] = None
74+
data: Optional[Dict[str, Any]] = None,
7075
) -> Any:
7176
path = self.command_format["stock"].substitute(cmd=command)
7277
if self.is_custom:

src/mod/api/miners/dragonball/parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from ...parser import Parser
44

5+
56
class DragonballParser(Parser):
67
def __init__(self, target: Dict[str, str]):
78
super().__init__(target)

src/mod/api/miners/goldshell/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def run_command(
6060
command: str,
6161
params: Optional[Dict[str, str]] = None,
6262
payload: Optional[Dict[str, Any]] = None,
63-
data: Optional[Dict[str, Any]] = None
63+
data: Optional[Dict[str, Any]] = None,
6464
) -> Any:
6565
path = self.command_format.substitute(cmd=command)
6666
res = self._do_http(method, path, params=params, payload=payload, data=data)

src/mod/api/miners/goldshell/parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from ...parser import Parser
44

5+
56
class GoldshellParser(Parser):
67
def __init__(self, target: Dict[str, str]):
78
super().__init__(target)

src/mod/api/miners/sealminer/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def run_command(
4747
command: str,
4848
params: Optional[Dict[str, str]] = None,
4949
payload: Optional[Dict[str, Any]] = None,
50-
data: Optional[Dict[str, Any]] = None
50+
data: Optional[Dict[str, Any]] = None,
5151
) -> Any:
5252
path = self.command_format.substitute(cmd=command)
5353
res = self._do_http(method, path, params=params, payload=payload, data=data)

src/mod/api/miners/volcminer/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def run_command(
4646
command: str,
4747
params: Optional[Dict[str, str]] = None,
4848
payload: Optional[Dict[str, Any]] = None,
49-
data: Optional[Dict[str, Any]] = None
49+
data: Optional[Dict[str, Any]] = None,
5050
) -> Any:
5151
path = self.command_format.substitute(cmd=command)
5252
res = self._do_http(method, path, params=params, payload=payload, data=data)

src/mod/api/miners/whatsminer/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,6 @@ def blink(
170170
if auto:
171171
self.send_privileged_command("set_led", param="auto")
172172
else:
173-
self.send_privileged_command("set_led", color=color, period=period, duration=duration, start=start)
173+
self.send_privileged_command(
174+
"set_led", color=color, period=period, duration=duration, start=start
175+
)

0 commit comments

Comments
 (0)