fixed formatting issues

This commit is contained in:
UpstreamData
2022-05-26 13:23:32 -06:00
parent 942f2a1c8d
commit c35b30e949
78 changed files with 177 additions and 173 deletions

View File

@@ -79,7 +79,7 @@ If you are sure you want to use this command please use API.send_command("{item}
data = None data = None
try: try:
data = await self.send_command(command) data = await self.send_command(command)
except APIError as e: except APIError:
try: try:
data = {} data = {}
# S19 handler, try again # S19 handler, try again

View File

@@ -434,7 +434,7 @@ class BTMinerAPI(BaseMinerAPI):
enc_command = create_privileged_cmd(token_data, command) enc_command = create_privileged_cmd(token_data, command)
return await self.send_command(enc_command) return await self.send_command(enc_command)
async def update_firmware(self): async def update_firmware(self): # noqa - static
# to be determined if this will be added later # to be determined if this will be added later
# requires a file stream in bytes # requires a file stream in bytes
return NotImplementedError return NotImplementedError

View File

@@ -1,6 +1,6 @@
import time import time
import yaml import yaml
import toml
def bos_config_convert(config: dict): def bos_config_convert(config: dict):

View File

@@ -67,7 +67,7 @@ class BMMiner(BaseMiner):
# return ? if we fail to get hostname with no ssh connection # return ? if we fail to get hostname with no ssh connection
logging.warning(f"Failed to get hostname for miner: {self}") logging.warning(f"Failed to get hostname for miner: {self}")
return "?" return "?"
except Exception as e: except Exception:
# return ? if we fail to get hostname with an exception # return ? if we fail to get hostname with an exception
logging.warning(f"Failed to get hostname for miner: {self}") logging.warning(f"Failed to get hostname for miner: {self}")
return "?" return "?"

View File

@@ -23,6 +23,7 @@ class BOSMiner(BaseMiner):
self.api_type = "BOSMiner" self.api_type = "BOSMiner"
self.uname = "root" self.uname = "root"
self.pwd = "admin" self.pwd = "admin"
self.config = None
async def send_ssh_command(self, cmd: str) -> str or None: async def send_ssh_command(self, cmd: str) -> str or None:
"""Send a command to the miner over ssh. """Send a command to the miner over ssh.
@@ -121,7 +122,7 @@ class BOSMiner(BaseMiner):
else: else:
logging.warning(f"Failed to get hostname for miner: {self}") logging.warning(f"Failed to get hostname for miner: {self}")
return "?" return "?"
except Exception as e: except Exception:
logging.warning(f"Failed to get hostname for miner: {self}") logging.warning(f"Failed to get hostname for miner: {self}")
return "?" return "?"
@@ -167,7 +168,7 @@ class BOSMiner(BaseMiner):
# if we get the version data, parse it # if we get the version data, parse it
if version_data: if version_data:
self.version = version_data.stdout.split("-")[5] self.version = version_data.split("-")[5]
logging.debug(f"Found version for {self.ip}: {self.version}") logging.debug(f"Found version for {self.ip}: {self.version}")
return self.version return self.version
@@ -206,10 +207,6 @@ class BOSMiner(BaseMiner):
offset = devs[0]["ID"] offset = devs[0]["ID"]
for board in devs: for board in devs:
boards[board["ID"] - offset] = [] boards[board["ID"] - offset] = []
if not board["Chips"] == self.nominal_chips:
nominal = False
else:
nominal = True
if not board["Chips"] == self.nominal_chips: if not board["Chips"] == self.nominal_chips:
nominal = False nominal = False
else: else:
@@ -290,11 +287,11 @@ class BOSMiner(BaseMiner):
board_map = {0: "left_board", 1: "center_board", 2: "right_board"} board_map = {0: "left_board", 1: "center_board", 2: "right_board"}
offset = temp[0]["ID"] offset = temp[0]["ID"]
for board in temp: for board in temp:
id = board["ID"] - offset _id = board["ID"] - offset
chip_temp = round(board["Chip"]) chip_temp = round(board["Chip"])
board_temp = round(board["Board"]) board_temp = round(board["Board"])
setattr(data, f"{board_map[id]}_chip_temp", chip_temp) setattr(data, f"{board_map[_id]}_chip_temp", chip_temp)
setattr(data, f"{board_map[id]}_temp", board_temp) setattr(data, f"{board_map[_id]}_temp", board_temp)
if fans: if fans:
fan_data = fans.get("FANS") fan_data = fans.get("FANS")
@@ -363,9 +360,9 @@ class BOSMiner(BaseMiner):
board_map = {0: "left_chips", 1: "center_chips", 2: "right_chips"} board_map = {0: "left_chips", 1: "center_chips", 2: "right_chips"}
offset = boards[0]["ID"] offset = boards[0]["ID"]
for board in boards: for board in boards:
id = board["ID"] - offset _id = board["ID"] - offset
chips = board["Chips"] chips = board["Chips"]
setattr(data, board_map[id], chips) setattr(data, board_map[_id], chips)
return data return data

View File

@@ -1,11 +1,10 @@
from miners import BaseMiner
from API.bosminer import BOSMinerAPI
import toml
from config.bos import bos_config_convert, general_config_convert_bos
import logging import logging
from settings import MINER_FACTORY_GET_VERSION_RETRIES as DATA_RETRIES
import asyncssh import asyncssh
from API.bosminer import BOSMinerAPI
from miners import BaseMiner
class BOSMinerOld(BaseMiner): class BOSMinerOld(BaseMiner):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -43,7 +43,7 @@ class BTMiner(BaseMiner):
except APIError: except APIError:
logging.warning(f"Failed to get hostname for miner: {self}") logging.warning(f"Failed to get hostname for miner: {self}")
return "?" return "?"
except Exception as e: except Exception:
logging.warning(f"Failed to get hostname for miner: {self}") logging.warning(f"Failed to get hostname for miner: {self}")
return "?" return "?"
@@ -141,11 +141,11 @@ class BTMiner(BaseMiner):
board_map = {0: "left_board", 1: "center_board", 2: "right_board"} board_map = {0: "left_board", 1: "center_board", 2: "right_board"}
for board in temp_data: for board in temp_data:
id = board["ID"] _id = board["ID"]
chip_temp = round(board["Chip Temp Avg"]) chip_temp = round(board["Chip Temp Avg"])
board_temp = round(board["Temperature"]) board_temp = round(board["Temperature"])
setattr(data, f"{board_map[id]}_chip_temp", chip_temp) setattr(data, f"{board_map[_id]}_chip_temp", chip_temp)
setattr(data, f"{board_map[id]}_temp", board_temp) setattr(data, f"{board_map[_id]}_temp", board_temp)
if devs: if devs:
boards = devs.get("DEVS") boards = devs.get("DEVS")
@@ -158,9 +158,9 @@ class BTMiner(BaseMiner):
id_key = "ASC" id_key = "ASC"
offset = boards[0][id_key] offset = boards[0][id_key]
for board in boards: for board in boards:
id = board[id_key] - offset _id = board[id_key] - offset
chips = board["Effective Chips"] chips = board["Effective Chips"]
setattr(data, board_map[id], chips) setattr(data, board_map[_id], chips)
if pools: if pools:
pool_1 = None pool_1 = None

View File

@@ -19,6 +19,7 @@ class CGMiner(BaseMiner):
self.api_type = "CGMiner" self.api_type = "CGMiner"
self.uname = "root" self.uname = "root"
self.pwd = "admin" self.pwd = "admin"
self.config = None
async def get_model(self): async def get_model(self):
if self.model: if self.model:

View File

@@ -1,5 +1,5 @@
from miners._backends import BMMiner from miners._backends import BMMiner # noqa - Ignore access to _module
from miners._types import S17 from miners._types import S17 # noqa - Ignore access to _module
class BMMinerS17(BMMiner, S17): class BMMinerS17(BMMiner, S17):

View File

@@ -1,5 +1,5 @@
from miners._backends import BMMiner from miners._backends import BMMiner # noqa - Ignore access to _module
from miners._types import S17Plus from miners._types import S17Plus # noqa - Ignore access to _module
class BMMinerS17Plus(BMMiner, S17Plus): class BMMinerS17Plus(BMMiner, S17Plus):

View File

@@ -1,5 +1,5 @@
from miners._backends import BMMiner from miners._backends import BMMiner # noqa - Ignore access to _module
from miners._types import S17Pro from miners._types import S17Pro # noqa - Ignore access to _module
class BMMinerS17Pro(BMMiner, S17Pro): class BMMinerS17Pro(BMMiner, S17Pro):

View File

@@ -1,5 +1,5 @@
from miners._backends import BMMiner from miners._backends import BMMiner # noqa - Ignore access to _module
from miners._types import S17e from miners._types import S17e # noqa - Ignore access to _module
class BMMinerS17e(BMMiner, S17e): class BMMinerS17e(BMMiner, S17e):

View File

@@ -1,5 +1,5 @@
from miners._backends import BMMiner from miners._backends import BMMiner # noqa - Ignore access to _module
from miners._types import T17 from miners._types import T17 # noqa - Ignore access to _module
class BMMinerT17(BMMiner, T17): class BMMinerT17(BMMiner, T17):

View File

@@ -1,5 +1,5 @@
from miners._backends import BMMiner from miners._backends import BMMiner # noqa - Ignore access to _module
from miners._types import T17Plus from miners._types import T17Plus # noqa - Ignore access to _module
class BMMinerT17Plus(BMMiner, T17Plus): class BMMinerT17Plus(BMMiner, T17Plus):

View File

@@ -1,5 +1,5 @@
from miners._backends import BMMiner from miners._backends import BMMiner # noqa - Ignore access to _module
from miners._types import T17e from miners._types import T17e # noqa - Ignore access to _module
class BMMinerT17e(BMMiner, T17e): class BMMinerT17e(BMMiner, T17e):

View File

@@ -1,5 +1,5 @@
from miners._backends import BMMiner from miners._backends import BMMiner # noqa - Ignore access to _module
from miners._types import S19 from miners._types import S19 # noqa - Ignore access to _module
class BMMinerS19(BMMiner, S19): class BMMinerS19(BMMiner, S19):

View File

@@ -1,5 +1,5 @@
from miners._backends import BMMiner from miners._backends import BMMiner # noqa - Ignore access to _module
from miners._types import S19Pro from miners._types import S19Pro # noqa - Ignore access to _module
class BMMinerS19Pro(BMMiner, S19Pro): class BMMinerS19Pro(BMMiner, S19Pro):

View File

@@ -1,5 +1,5 @@
from miners._backends import BMMiner from miners._backends import BMMiner # noqa - Ignore access to _module
from miners._types import S19a from miners._types import S19a # noqa - Ignore access to _module
class BMMinerS19a(BMMiner, S19a): class BMMinerS19a(BMMiner, S19a):

View File

@@ -1,5 +1,5 @@
from miners._backends import BMMiner from miners._backends import BMMiner # noqa - Ignore access to _module
from miners._types import S19j from miners._types import S19j # noqa - Ignore access to _module
class BMMinerS19j(BMMiner, S19j): class BMMinerS19j(BMMiner, S19j):

View File

@@ -1,5 +1,5 @@
from miners._backends import BMMiner from miners._backends import BMMiner # noqa - Ignore access to _module
from miners._types import S19jPro from miners._types import S19jPro # noqa - Ignore access to _module
class BMMinerS19jPro(BMMiner, S19jPro): class BMMinerS19jPro(BMMiner, S19jPro):

View File

@@ -1,5 +1,5 @@
from miners._backends import BMMiner from miners._backends import BMMiner # noqa - Ignore access to _module
from miners._types import T19 from miners._types import T19 # noqa - Ignore access to _module
class BMMinerT19(BMMiner, T19): class BMMinerT19(BMMiner, T19):

View File

@@ -1,5 +1,5 @@
from miners._backends import BMMiner from miners._backends import BMMiner # noqa - Ignore access to _module
from miners._types import S9 from miners._types import S9 # noqa - Ignore access to _module
class BMMinerS9(BMMiner, S9): class BMMinerS9(BMMiner, S9):

View File

@@ -1,5 +1,5 @@
from miners._backends import BMMiner from miners._backends import BMMiner # noqa - Ignore access to _module
from miners._types import S9i from miners._types import S9i # noqa - Ignore access to _module
class BMMinerS9i(BMMiner, S9i): class BMMinerS9i(BMMiner, S9i):

View File

@@ -1,5 +1,5 @@
from miners._backends import BMMiner from miners._backends import BMMiner # noqa - Ignore access to _module
from miners._types import T9 from miners._types import T9 # noqa - Ignore access to _module
class BMMinerT9(BMMiner, T9): class BMMinerT9(BMMiner, T9):

View File

@@ -1,5 +1,5 @@
from miners._backends import BOSMiner from miners._backends import BOSMiner # noqa - Ignore access to _module
from miners._types import S17 from miners._types import S17 # noqa - Ignore access to _module
class BOSMinerS17(BOSMiner, S17): class BOSMinerS17(BOSMiner, S17):

View File

@@ -1,5 +1,5 @@
from miners._backends import BOSMiner from miners._backends import BOSMiner # noqa - Ignore access to _module
from miners._types import S17Plus from miners._types import S17Plus # noqa - Ignore access to _module
class BOSMinerS17Plus(BOSMiner, S17Plus): class BOSMinerS17Plus(BOSMiner, S17Plus):

View File

@@ -1,5 +1,5 @@
from miners._backends import BOSMiner from miners._backends import BOSMiner # noqa - Ignore access to _module
from miners._types import S17Pro from miners._types import S17Pro # noqa - Ignore access to _module
class BOSMinerS17Pro(BOSMiner, S17Pro): class BOSMinerS17Pro(BOSMiner, S17Pro):

View File

@@ -1,5 +1,5 @@
from miners._backends import BOSMiner from miners._backends import BOSMiner # noqa - Ignore access to _module
from miners._types import S17e from miners._types import S17e # noqa - Ignore access to _module
class BOSMinerS17e(BOSMiner, S17e): class BOSMinerS17e(BOSMiner, S17e):

View File

@@ -1,5 +1,5 @@
from miners._backends import BOSMiner from miners._backends import BOSMiner # noqa - Ignore access to _module
from miners._types import T17 from miners._types import T17 # noqa - Ignore access to _module
class BOSMinerT17(BOSMiner, T17): class BOSMinerT17(BOSMiner, T17):

View File

@@ -1,5 +1,5 @@
from miners._backends import BOSMiner from miners._backends import BOSMiner # noqa - Ignore access to _module
from miners._types import T17Plus from miners._types import T17Plus # noqa - Ignore access to _module
class BOSMinerT17Plus(BOSMiner, T17Plus): class BOSMinerT17Plus(BOSMiner, T17Plus):

View File

@@ -1,5 +1,5 @@
from miners._backends import BOSMiner from miners._backends import BOSMiner # noqa - Ignore access to _module
from miners._types import T17e from miners._types import T17e # noqa - Ignore access to _module
class BOSMinerT17e(BOSMiner, T17e): class BOSMinerT17e(BOSMiner, T17e):

View File

@@ -1,5 +1,5 @@
from miners._backends import BOSMiner from miners._backends import BOSMiner # noqa - Ignore access to _module
from miners._types import S19 from miners._types import S19 # noqa - Ignore access to _module
class BOSMinerS19(BOSMiner, S19): class BOSMinerS19(BOSMiner, S19):

View File

@@ -1,5 +1,5 @@
from miners._backends import BOSMiner from miners._backends import BOSMiner # noqa - Ignore access to _module
from miners._types import S19Pro from miners._types import S19Pro # noqa - Ignore access to _module
class BOSMinerS19Pro(BOSMiner, S19Pro): class BOSMinerS19Pro(BOSMiner, S19Pro):

View File

@@ -1,5 +1,5 @@
from miners._backends import BOSMiner from miners._backends import BOSMiner # noqa - Ignore access to _module
from miners._types import S19j from miners._types import S19j # noqa - Ignore access to _module
class BOSMinerS19j(BOSMiner, S19j): class BOSMinerS19j(BOSMiner, S19j):

View File

@@ -1,5 +1,5 @@
from miners._backends import BOSMiner from miners._backends import BOSMiner # noqa - Ignore access to _module
from miners._types import S19jPro from miners._types import S19jPro # noqa - Ignore access to _module
class BOSMinerS19jPro(BOSMiner, S19jPro): class BOSMinerS19jPro(BOSMiner, S19jPro):

View File

@@ -1,5 +1,5 @@
from miners._backends import BOSMiner from miners._backends import BOSMiner # noqa - Ignore access to _module
from miners._types import T19 from miners._types import T19 # noqa - Ignore access to _module
class BOSMinerT19(BOSMiner, T19): class BOSMinerT19(BOSMiner, T19):

View File

@@ -1,5 +1,5 @@
from miners._backends import BOSMiner from miners._backends import BOSMiner # noqa - Ignore access to _module
from miners._types import S9 from miners._types import S9 # noqa - Ignore access to _module
class BOSMinerS9(BOSMiner, S9): class BOSMinerS9(BOSMiner, S9):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import S17 from miners._types import S17 # noqa - Ignore access to _module
class CGMinerS17(CGMiner, S17): class CGMinerS17(CGMiner, S17):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import S17Plus from miners._types import S17Plus # noqa - Ignore access to _module
class CGMinerS17Plus(CGMiner, S17Plus): class CGMinerS17Plus(CGMiner, S17Plus):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import S17Pro from miners._types import S17Pro # noqa - Ignore access to _module
class CGMinerS17Pro(CGMiner, S17Pro): class CGMinerS17Pro(CGMiner, S17Pro):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import S17e from miners._types import S17e # noqa - Ignore access to _module
class CGMinerS17e(CGMiner, S17e): class CGMinerS17e(CGMiner, S17e):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import T17 from miners._types import T17 # noqa - Ignore access to _module
class CGMinerT17(CGMiner, T17): class CGMinerT17(CGMiner, T17):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import T17Plus from miners._types import T17Plus # noqa - Ignore access to _module
class CGMinerT17Plus(CGMiner, T17Plus): class CGMinerT17Plus(CGMiner, T17Plus):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import T17e from miners._types import T17e # noqa - Ignore access to _module
class CGMinerT17e(CGMiner, T17e): class CGMinerT17e(CGMiner, T17e):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import S19 from miners._types import S19 # noqa - Ignore access to _module
class CGMinerS19(CGMiner, S19): class CGMinerS19(CGMiner, S19):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import S19Pro from miners._types import S19Pro # noqa - Ignore access to _module
class CGMinerS19Pro(CGMiner, S19Pro): class CGMinerS19Pro(CGMiner, S19Pro):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import S19j from miners._types import S19j # noqa - Ignore access to _module
class CGMinerS19j(CGMiner, S19j): class CGMinerS19j(CGMiner, S19j):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import S19jPro from miners._types import S19jPro # noqa - Ignore access to _module
class CGMinerS19jPro(CGMiner, S19jPro): class CGMinerS19jPro(CGMiner, S19jPro):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import T19 from miners._types import T19 # noqa - Ignore access to _module
class CGMinerT19(CGMiner, T19): class CGMinerT19(CGMiner, T19):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import S9 from miners._types import S9 # noqa - Ignore access to _module
class CGMinerS9(CGMiner, S9): class CGMinerS9(CGMiner, S9):

View File

@@ -1,11 +1,9 @@
from miners._backends.cgminer import CGMiner from miners._backends.cgminer import CGMiner # noqa - Ignore access to _module
from miners._types.antminer import T9 # noqa - Ignore access to _module
class CGMinerT9(CGMiner): class CGMinerT9(CGMiner, T9):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:
super().__init__(ip) super().__init__(ip)
self.model = "T9" self.model = "T9"
self.api_type = "CGMiner" self.api_type = "CGMiner"
def __repr__(self) -> str:
return f"CGMinerT9: {str(self.ip)}"

View File

@@ -1,5 +1,5 @@
from miners._backends import Hiveon from miners._backends import Hiveon # noqa - Ignore access to _module
from miners._types import T9 from miners._types import T9 # noqa - Ignore access to _module
class HiveonT9(Hiveon, T9): class HiveonT9(Hiveon, T9):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import Avalon1047 from miners._types import Avalon1047 # noqa - Ignore access to _module
class CGMinerAvalon1047(CGMiner, Avalon1047): class CGMinerAvalon1047(CGMiner, Avalon1047):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import Avalon1066 from miners._types import Avalon1066 # noqa - Ignore access to _module
class CGMinerAvalon1066(CGMiner, Avalon1066): class CGMinerAvalon1066(CGMiner, Avalon1066):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import Avalon821 from miners._types import Avalon821 # noqa - Ignore access to _module
class CGMinerAvalon821(CGMiner, Avalon821): class CGMinerAvalon821(CGMiner, Avalon821):

View File

@@ -1,5 +1,5 @@
from miners._backends import CGMiner from miners._backends import CGMiner # noqa - Ignore access to _module
from miners._types import Avalon841 from miners._types import Avalon841 # noqa - Ignore access to _module
class CGMinerAvalon841(CGMiner, Avalon841): class CGMinerAvalon841(CGMiner, Avalon841):

View File

@@ -13,11 +13,12 @@ class Singleton(type):
class _MinerListener: class _MinerListener:
def __init__(self): def __init__(self):
self.responses = {} self.responses = {}
self.transport = None
def connection_made(self, transport): def connection_made(self, transport):
self.transport = transport self.transport = transport
def datagram_received(self, data, addr): def datagram_received(self, data, _addr):
m = data.decode() m = data.decode()
ip, mac = m.split(",") ip, mac = m.split(",")
new_miner = {"IP": ip, "MAC": mac.upper()} new_miner = {"IP": ip, "MAC": mac.upper()}

View File

@@ -1,5 +1,5 @@
from miners._backends import BTMiner from miners._backends import BTMiner # noqa - Ignore access to _module
from miners._types import M20S from miners._types import M20S # noqa - Ignore access to _module
class BTMinerM20S(BTMiner, M20S): class BTMinerM20S(BTMiner, M20S):

View File

@@ -1,5 +1,5 @@
from miners._backends import BTMiner from miners._backends import BTMiner # noqa - Ignore access to _module
from miners._types import M20SPlus from miners._types import M20SPlus # noqa - Ignore access to _module
class BTMinerM20SPlus(BTMiner, M20SPlus): class BTMinerM20SPlus(BTMiner, M20SPlus):

View File

@@ -1,5 +1,5 @@
from miners._backends import BTMiner from miners._backends import BTMiner # noqa - Ignore access to _module
from miners._types import M21 from miners._types import M21 # noqa - Ignore access to _module
class BTMinerM21(BTMiner, M21): class BTMinerM21(BTMiner, M21):

View File

@@ -1,5 +1,5 @@
from miners._backends import BTMiner from miners._backends import BTMiner # noqa - Ignore access to _module
from miners._types import M21S from miners._types import M21S # noqa - Ignore access to _module
class BTMinerM21S(BTMiner, M21S): class BTMinerM21S(BTMiner, M21S):

View File

@@ -1,5 +1,5 @@
from miners._backends import BTMiner from miners._backends import BTMiner # noqa - Ignore access to _module
from miners._types import M21SPlus from miners._types import M21SPlus # noqa - Ignore access to _module
class BTMinerM21SPlus(BTMiner, M21SPlus): class BTMinerM21SPlus(BTMiner, M21SPlus):

View File

@@ -1,5 +1,5 @@
from miners._backends import BTMiner from miners._backends import BTMiner # noqa - Ignore access to _module
from miners._types import M30S from miners._types import M30S # noqa - Ignore access to _module
class BTMinerM30S(BTMiner, M30S): class BTMinerM30S(BTMiner, M30S):

View File

@@ -1,5 +1,5 @@
from miners._backends import BTMiner from miners._backends import BTMiner # noqa - Ignore access to _module
from miners._types import M30SPlus from miners._types import M30SPlus # noqa - Ignore access to _module
class BTMinerM30SPlus(BTMiner, M30SPlus): class BTMinerM30SPlus(BTMiner, M30SPlus):

View File

@@ -1,5 +1,5 @@
from miners._backends import BTMiner from miners._backends import BTMiner # noqa - Ignore access to _module
from miners._types import M30SPlusPlus from miners._types import M30SPlusPlus # noqa - Ignore access to _module
class BTMinerM30SPlusPlus(BTMiner, M30SPlusPlus): class BTMinerM30SPlusPlus(BTMiner, M30SPlusPlus):

View File

@@ -1,5 +1,5 @@
from miners._backends import BTMiner from miners._backends import BTMiner # noqa - Ignore access to _module
from miners._types import M31S from miners._types import M31S # noqa - Ignore access to _module
class BTMinerM31S(BTMiner, M31S): class BTMinerM31S(BTMiner, M31S):

View File

@@ -1,5 +1,5 @@
from miners._backends import BTMiner from miners._backends import BTMiner # noqa - Ignore access to _module
from miners._types import M31SPlus from miners._types import M31SPlus # noqa - Ignore access to _module
class BTMinerM31SPlus(BTMiner, M31SPlus): class BTMinerM31SPlus(BTMiner, M31SPlus):

View File

@@ -1,5 +1,5 @@
from miners._backends import BTMiner from miners._backends import BTMiner # noqa - Ignore access to _module
from miners._types import M32S from miners._types import M32S # noqa - Ignore access to _module
class BTMinerM32S(BTMiner, M32S): class BTMinerM32S(BTMiner, M32S):

View File

@@ -1,6 +1,6 @@
import asyncio import asyncio
from network import MinerNetwork from network import MinerNetwork
from miners._backends.bosminer import BOSMiner from miners._backends.bosminer import BOSMiner # noqa - Ignore access to _module
async def get_bos_bad_tuners(ip: str = "192.168.1.0", mask: int = 24): async def get_bos_bad_tuners(ip: str = "192.168.1.0", mask: int = 24):

View File

@@ -8,7 +8,10 @@ from matplotlib.figure import Figure
import numpy as np import numpy as np
from reportlab.lib import colors from reportlab.lib import colors
from reportlab.lib.pagesizes import letter, inch from reportlab.lib.pagesizes import letter, inch
from reportlab.lib.styles import ParagraphStyle, TA_CENTER from reportlab.lib.styles import (
ParagraphStyle,
TA_CENTER, # noqa - not declared in __all__
)
from reportlab.lib.utils import ImageReader from reportlab.lib.utils import ImageReader
from reportlab.platypus import ( from reportlab.platypus import (
SimpleDocTemplate, SimpleDocTemplate,

View File

@@ -37,10 +37,8 @@ for table in TABLE_HEADERS:
async def btn_all(): async def btn_all():
table = "scan_table" tbl = "scan_table"
window[table].update( window[tbl].update(select_rows=([row for row in range(len(window[tbl].Values))]))
select_rows=([row for row in range(len(window[table].Values))])
)
async def btn_scan(scan_ip: str): async def btn_scan(scan_ip: str):

View File

@@ -47,7 +47,7 @@ def _table_copy(table):
for item in value: for item in value:
values.append(str(item).strip()) values.append(str(item).strip())
_copy_values.append(values) _copy_values.append(values)
except Exception as E: except Exception:
pass pass
copy_values = [] copy_values = []
@@ -88,7 +88,7 @@ async def ui():
bind_ctrl_a(key) bind_ctrl_a(key)
# create images used in the table, they will not show if not saved here # create images used in the table, they will not show if not saved here
tk_imgs = TkImages() tk_imgs = TkImages() # noqa - need to save this in memory to hold images
# left justify hostnames # left justify hostnames
window["scan_table"].Widget.column(2, anchor=tk.W) window["scan_table"].Widget.column(2, anchor=tk.W)

View File

@@ -8,7 +8,9 @@ from fastapi.staticfiles import StaticFiles
from tools.web_monitor.dashboard import router as dashboard_router from tools.web_monitor.dashboard import router as dashboard_router
from tools.web_monitor.miner import router as miner_router from tools.web_monitor.miner import router as miner_router
from tools.web_monitor.scan import router as scan_router from tools.web_monitor.scan import router as scan_router
from tools.web_monitor._settings import router as settings_router from tools.web_monitor._settings import ( # noqa - Ignore access to _module
router as settings_router,
)
app = FastAPI() app = FastAPI()

View File

@@ -1,7 +1,9 @@
import asyncio import asyncio
from miners.miner_factory import MinerFactory from miners.miner_factory import MinerFactory
from tools.web_monitor._settings.func import get_current_settings from tools.web_monitor._settings.func import ( # noqa - Ignore access to _module
get_current_settings,
)
async def get_miner_data_dashboard(miner_ip): async def get_miner_data_dashboard(miner_ip):

View File

@@ -5,7 +5,9 @@ import websockets.exceptions
from fastapi import WebSocket, WebSocketDisconnect, APIRouter from fastapi import WebSocket, WebSocketDisconnect, APIRouter
from tools.web_monitor.func import get_current_miner_list from tools.web_monitor.func import get_current_miner_list
from tools.web_monitor._settings.func import get_current_settings from tools.web_monitor._settings.func import ( # noqa - Ignore access to _module
get_current_settings,
)
from tools.web_monitor.dashboard.func import get_miner_data_dashboard from tools.web_monitor.dashboard.func import get_miner_data_dashboard

View File

@@ -5,7 +5,9 @@ import websockets.exceptions
from fastapi import WebSocket, WebSocketDisconnect, APIRouter from fastapi import WebSocket, WebSocketDisconnect, APIRouter
from miners.miner_factory import MinerFactory from miners.miner_factory import MinerFactory
from tools.web_monitor._settings.func import get_current_settings from tools.web_monitor._settings.func import ( # noqa - Ignore access to _module
get_current_settings,
)
router = APIRouter() router = APIRouter()
@@ -24,9 +26,7 @@ async def miner_websocket(websocket: WebSocket, miner_ip):
cur_miner = await asyncio.wait_for( cur_miner = await asyncio.wait_for(
MinerFactory().get_miner(str(miner_ip)), miner_identify_timeout MinerFactory().get_miner(str(miner_ip)), miner_identify_timeout
) )
data = await asyncio.wait_for( data = await asyncio.wait_for(cur_miner.get_data(), miner_data_timeout)
cur_miner.get_data(), miner_identify_timeout
)
fan_speeds = [ fan_speeds = [
fan if not fan == -1 else 0 fan if not fan == -1 else 0

View File

@@ -7,7 +7,7 @@ import datetime
from network import ping_miner from network import ping_miner
from miners.miner_factory import MinerFactory from miners.miner_factory import MinerFactory
from miners.antminer import BOSMinerS9 from miners.antminer import BOSMinerS9
from miners._backends.bosminer_old import BOSMinerOld from miners._backends.bosminer_old import BOSMinerOld # noqa - Ignore access to _module
from miners.unknown import UnknownMiner from miners.unknown import UnknownMiner
from tools.web_testbench.connections import ConnectionManager from tools.web_testbench.connections import ConnectionManager
from tools.web_testbench.feeds import get_local_versions from tools.web_testbench.feeds import get_local_versions
@@ -54,7 +54,6 @@ class Miners(metaclass=Singleton):
self.miners.remove(other) self.miners.remove(other)
class TestbenchMiner: class TestbenchMiner:
def __init__(self, host: ip_address): def __init__(self, host: ip_address):
self.host = host self.host = host
@@ -146,7 +145,9 @@ class TestbenchMiner:
elif isinstance(miner, UnknownMiner): elif isinstance(miner, UnknownMiner):
await self.add_to_output("Unknown Miner found, attempting to fix.") await self.add_to_output("Unknown Miner found, attempting to fix.")
try: try:
async with (await miner._get_ssh_connection()) as conn: async with (
await miner._get_ssh_connection() # noqa - Ignore access to _function
) as conn:
result = await conn.run("opkg update && opkg upgrade firmware") result = await conn.run("opkg update && opkg upgrade firmware")
except: except:
await self.add_to_output("Fix failed, please manually reset miner.") await self.add_to_output("Fix failed, please manually reset miner.")
@@ -271,7 +272,7 @@ class TestbenchMiner:
await miner.send_ssh_command( await miner.send_ssh_command(
"opkg install /tmp/referral.ipk && /etc/init.d/bosminer restart" "opkg install /tmp/referral.ipk && /etc/init.d/bosminer restart"
) )
except Exception as e: except Exception:
await self.add_to_output( await self.add_to_output(
"Failed to add referral and configure, restarting." "Failed to add referral and configure, restarting."
) )
@@ -370,7 +371,7 @@ class TestbenchMiner:
"Temps": temps_data, "Temps": temps_data,
"online": self.get_online_time(), "online": self.get_online_time(),
"Tuner": tuner_data, "Tuner": tuner_data,
"Count": Miners().get_count() "Count": Miners().get_count(),
} }
# return stats # return stats
@@ -401,7 +402,7 @@ class TestbenchMiner:
"board_7": {"power_limit": 275, "real_power": 0, "status": "None"}, "board_7": {"power_limit": 275, "real_power": 0, "status": "None"},
"board_8": {"power_limit": 275, "real_power": 0, "status": "None"}, "board_8": {"power_limit": 275, "real_power": 0, "status": "None"},
}, },
"Count": Miners().get_count() "Count": Miners().get_count(),
} }
async def install_done(self): async def install_done(self):
@@ -418,7 +419,7 @@ class TestbenchMiner:
"IP": str(self.host), "IP": str(self.host),
"Light": "show", "Light": "show",
"online": self.get_online_time(), "online": self.get_online_time(),
"Count": Miners().get_count() "Count": Miners().get_count(),
} }
print(f"Getting data failed: {self.host}") print(f"Getting data failed: {self.host}")

View File

@@ -1,7 +1,7 @@
from fastapi import WebSocket
import logging import logging
from miners.miner_factory import MinerFactory from fastapi import WebSocket
from tools.web_testbench._network import miner_network from tools.web_testbench._network import miner_network
@@ -39,5 +39,5 @@ class ConnectionManager:
for connection in ConnectionManager._connections: for connection in ConnectionManager._connections:
try: try:
await connection.send_json(data) await connection.send_json(data)
except Exception as e: except Exception:
self.disconnect(connection) self.disconnect(connection)