refactor: fix some not x in y and not x not in y
This commit is contained in:
@@ -149,10 +149,10 @@ class _MinerPhaseBalancer:
|
||||
not self.miners[data_point.ip]["shutdown"]
|
||||
):
|
||||
# cant do anything with it so need to find a semi-accurate power limit
|
||||
if not data_point.wattage_limit == None:
|
||||
if not data_point.wattage_limit is None:
|
||||
self.miners[data_point.ip]["max"] = int(data_point.wattage_limit)
|
||||
self.miners[data_point.ip]["min"] = int(data_point.wattage_limit)
|
||||
elif not data_point.wattage == None:
|
||||
elif not data_point.wattage is None:
|
||||
self.miners[data_point.ip]["max"] = int(data_point.wattage)
|
||||
self.miners[data_point.ip]["min"] = int(data_point.wattage)
|
||||
|
||||
@@ -183,13 +183,19 @@ class _MinerPhaseBalancer:
|
||||
if (not miner["tune"]) and (miner["shutdown"])
|
||||
]
|
||||
)
|
||||
# min_other_wattage = sum([miner["min"] for miner in self.miners.values() if (not miner["tune"]) and (not miner["shutdown"])])
|
||||
# min_other_wattage = sum(
|
||||
# [
|
||||
# miner["min"]
|
||||
# for miner in self.miners.values()
|
||||
# if (not miner["tune"]) and (not miner["shutdown"])
|
||||
# ]
|
||||
# )
|
||||
|
||||
# make sure wattage isnt set too high
|
||||
if wattage > (max_tune_wattage + max_shutdown_wattage + max_other_wattage):
|
||||
raise APIError(
|
||||
f"Wattage setpoint is too high, setpoint: {wattage}W, max: {max_tune_wattage + max_shutdown_wattage + max_other_wattage}W"
|
||||
) # PhaseBalancingError(f"Wattage setpoint is too high, setpoint: {wattage}W, max: {max_tune_wattage + max_shutdown_wattage + max_other_wattage}W")
|
||||
)
|
||||
|
||||
# should now know wattage limits and which can be tuned/shutdown
|
||||
# check if 1/2 max of the miners which can be tuned is low enough
|
||||
|
||||
@@ -474,7 +474,7 @@ class AntminerOld(CGMiner):
|
||||
pass
|
||||
|
||||
async def _get_fans(self, api_stats: dict = None) -> List[Fan]:
|
||||
if not api_stats is None:
|
||||
if api_stats is None:
|
||||
try:
|
||||
api_stats = await self.api.stats()
|
||||
except APIError:
|
||||
|
||||
@@ -302,8 +302,8 @@ class BOSMiner(BaseMiner):
|
||||
data = await self.send_ssh_command("cat /etc/config/network")
|
||||
|
||||
split_data = data.split("\n\n")
|
||||
for idx in range(len(split_data)):
|
||||
if "config interface 'lan'" in split_data[idx]:
|
||||
for idx, val in enumerate(split_data):
|
||||
if "config interface 'lan'" in val:
|
||||
split_data[idx] = cfg_data_lan
|
||||
config = "\n\n".join(split_data)
|
||||
|
||||
@@ -324,8 +324,8 @@ class BOSMiner(BaseMiner):
|
||||
data = await self.send_ssh_command("cat /etc/config/network")
|
||||
|
||||
split_data = data.split("\n\n")
|
||||
for idx in range(len(split_data)):
|
||||
if "config interface 'lan'" in split_data[idx]:
|
||||
for idx, val in enumerate(split_data):
|
||||
if "config interface 'lan'" in val:
|
||||
split_data[idx] = cfg_data_lan
|
||||
config = "\n\n".join(split_data)
|
||||
|
||||
|
||||
@@ -142,9 +142,9 @@ class CGMinerAvalon(CGMiner):
|
||||
# --avalon args
|
||||
for arg_item in data_list:
|
||||
item_data = arg_item[0].split(" ")
|
||||
for idx in range(len(item_data)):
|
||||
for idx, val in enumerate(item_data):
|
||||
if idx % 2 == 0 or idx == 0:
|
||||
data_dict[item_data[idx]] = item_data[idx + 1]
|
||||
data_dict[val] = item_data[idx + 1]
|
||||
|
||||
raw_data = [data[0].strip(), data_dict]
|
||||
else:
|
||||
|
||||
@@ -268,7 +268,7 @@ class ePIC(BaseMiner):
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
if not web_hashrate is not None:
|
||||
if web_hashrate is not None:
|
||||
try:
|
||||
web_hashrate = await self.web.hashrate()
|
||||
except APIError:
|
||||
|
||||
@@ -654,7 +654,7 @@ class MinerFactory:
|
||||
return MinerTypes.HIVEON
|
||||
if "LUXMINER" in upper_data:
|
||||
return MinerTypes.LUX_OS
|
||||
if "ANTMINER" in upper_data and not "DEVDETAILS" in upper_data:
|
||||
if "ANTMINER" in upper_data and "DEVDETAILS" not in upper_data:
|
||||
return MinerTypes.ANTMINER
|
||||
if "INTCHAINS_QOMO" in upper_data:
|
||||
return MinerTypes.GOLDSHELL
|
||||
|
||||
@@ -132,7 +132,7 @@ class BaseMinerRPCAPI:
|
||||
async def _handle_multicommand(self, command: str, allow_warning: bool = True):
|
||||
try:
|
||||
data = await self.send_command(command, allow_warning=allow_warning)
|
||||
if not "+" in command:
|
||||
if "+" not in command:
|
||||
return {command: [data]}
|
||||
return data
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class BOSerGraphQLAPI:
|
||||
for i in d:
|
||||
if i:
|
||||
for k in i:
|
||||
if not k in ret:
|
||||
if k not in ret:
|
||||
ret[k] = i[k]
|
||||
else:
|
||||
ret[k] = merge(ret[k], i[k])
|
||||
|
||||
Reference in New Issue
Block a user