refactor: fix some not x in y and not x not in y

This commit is contained in:
UpstreamData
2024-01-16 08:36:31 -07:00
parent 5327b3fe3d
commit 468134e754
8 changed files with 21 additions and 15 deletions

View File

@@ -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:

View File

@@ -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)

View File

@@ -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:

View File

@@ -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:

View File

@@ -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