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

@@ -8,7 +8,10 @@ from matplotlib.figure import Figure
import numpy as np
from reportlab.lib import colors
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.platypus import (
SimpleDocTemplate,

View File

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

View File

@@ -47,7 +47,7 @@ def _table_copy(table):
for item in value:
values.append(str(item).strip())
_copy_values.append(values)
except Exception as E:
except Exception:
pass
copy_values = []
@@ -88,7 +88,7 @@ async def ui():
bind_ctrl_a(key)
# 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
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.miner import router as miner_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()

View File

@@ -1,7 +1,9 @@
import asyncio
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):

View File

@@ -5,7 +5,9 @@ import websockets.exceptions
from fastapi import WebSocket, WebSocketDisconnect, APIRouter
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

View File

@@ -5,7 +5,9 @@ import websockets.exceptions
from fastapi import WebSocket, WebSocketDisconnect, APIRouter
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()
@@ -24,9 +26,7 @@ async def miner_websocket(websocket: WebSocket, miner_ip):
cur_miner = await asyncio.wait_for(
MinerFactory().get_miner(str(miner_ip)), miner_identify_timeout
)
data = await asyncio.wait_for(
cur_miner.get_data(), miner_identify_timeout
)
data = await asyncio.wait_for(cur_miner.get_data(), miner_data_timeout)
fan_speeds = [
fan if not fan == -1 else 0

View File

@@ -7,7 +7,7 @@ import datetime
from network import ping_miner
from miners.miner_factory import MinerFactory
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 tools.web_testbench.connections import ConnectionManager
from tools.web_testbench.feeds import get_local_versions
@@ -54,7 +54,6 @@ class Miners(metaclass=Singleton):
self.miners.remove(other)
class TestbenchMiner:
def __init__(self, host: ip_address):
self.host = host
@@ -146,7 +145,9 @@ class TestbenchMiner:
elif isinstance(miner, UnknownMiner):
await self.add_to_output("Unknown Miner found, attempting to fix.")
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")
except:
await self.add_to_output("Fix failed, please manually reset miner.")
@@ -271,7 +272,7 @@ class TestbenchMiner:
await miner.send_ssh_command(
"opkg install /tmp/referral.ipk && /etc/init.d/bosminer restart"
)
except Exception as e:
except Exception:
await self.add_to_output(
"Failed to add referral and configure, restarting."
)
@@ -370,7 +371,7 @@ class TestbenchMiner:
"Temps": temps_data,
"online": self.get_online_time(),
"Tuner": tuner_data,
"Count": Miners().get_count()
"Count": Miners().get_count(),
}
# return stats
@@ -401,7 +402,7 @@ class TestbenchMiner:
"board_7": {"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):
@@ -418,7 +419,7 @@ class TestbenchMiner:
"IP": str(self.host),
"Light": "show",
"online": self.get_online_time(),
"Count": Miners().get_count()
"Count": Miners().get_count(),
}
print(f"Getting data failed: {self.host}")

View File

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