refactor: update type annotations in config.
This commit is contained in:
@@ -70,7 +70,7 @@ class MinerConfigValue:
|
|||||||
def from_dict(cls, dict_conf: Union[dict, None]):
|
def from_dict(cls, dict_conf: Union[dict, None]):
|
||||||
return cls()
|
return cls()
|
||||||
|
|
||||||
def as_dict(self):
|
def as_dict(self) -> dict:
|
||||||
return asdict(self)
|
return asdict(self)
|
||||||
|
|
||||||
def as_am_modern(self) -> dict:
|
def as_am_modern(self) -> dict:
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class FanModeNormal(MinerConfigValue):
|
|||||||
return cls(**cls_conf)
|
return cls(**cls_conf)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_vnish(cls, web_cooling_settings: dict):
|
def from_vnish(cls, web_cooling_settings: dict) -> "FanModeNormal":
|
||||||
cls_conf = {}
|
cls_conf = {}
|
||||||
if web_cooling_settings.get("fan_min_count") is not None:
|
if web_cooling_settings.get("fan_min_count") is not None:
|
||||||
cls_conf["minimum_fans"] = web_cooling_settings["fan_min_count"]
|
cls_conf["minimum_fans"] = web_cooling_settings["fan_min_count"]
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class MiningModeHPM(MinerConfigValue):
|
|||||||
def from_dict(cls, dict_conf: Union[dict, None]) -> "MiningModeHPM":
|
def from_dict(cls, dict_conf: Union[dict, None]) -> "MiningModeHPM":
|
||||||
return cls()
|
return cls()
|
||||||
|
|
||||||
def as_am_modern(self):
|
def as_am_modern(self) -> dict:
|
||||||
return {"miner-mode": "0"}
|
return {"miner-mode": "0"}
|
||||||
|
|
||||||
def as_wm(self) -> dict:
|
def as_wm(self) -> dict:
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ class PoolGroup(MinerConfigValue):
|
|||||||
def as_goldshell(self, user_suffix: str = None) -> list:
|
def as_goldshell(self, user_suffix: str = None) -> list:
|
||||||
return [pool.as_goldshell(user_suffix) for pool in self.pools]
|
return [pool.as_goldshell(user_suffix) for pool in self.pools]
|
||||||
|
|
||||||
def as_avalon(self, user_suffix: str = None) -> dict:
|
def as_avalon(self, user_suffix: str = None) -> str:
|
||||||
if len(self.pools) > 0:
|
if len(self.pools) > 0:
|
||||||
return self.pools[0].as_avalon(user_suffix=user_suffix)
|
return self.pools[0].as_avalon(user_suffix=user_suffix)
|
||||||
return Pool("", "", "").as_avalon()
|
return Pool("", "", "").as_avalon()
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class TemperatureConfig(MinerConfigValue):
|
|||||||
return cls(target=target_temp, danger=dangerous_temp)
|
return cls(target=target_temp, danger=dangerous_temp)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_vnish(cls, web_settings: dict):
|
def from_vnish(cls, web_settings: dict) -> "TemperatureConfig":
|
||||||
try:
|
try:
|
||||||
if web_settings["miner"]["cooling"]["mode"]["name"] == "auto":
|
if web_settings["miner"]["cooling"]["mode"]["name"] == "auto":
|
||||||
return cls(target=web_settings["miner"]["cooling"]["mode"]["param"])
|
return cls(target=web_settings["miner"]["cooling"]["mode"]["param"])
|
||||||
@@ -81,7 +81,7 @@ class TemperatureConfig(MinerConfigValue):
|
|||||||
return cls()
|
return cls()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_boser(cls, grpc_miner_conf: dict):
|
def from_boser(cls, grpc_miner_conf: dict) -> "TemperatureConfig":
|
||||||
try:
|
try:
|
||||||
temperature_conf = grpc_miner_conf["temperature"]
|
temperature_conf = grpc_miner_conf["temperature"]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|||||||
Reference in New Issue
Block a user