bug: fix type hints
This commit is contained in:
@@ -28,6 +28,9 @@ class MinerConfig(BaseModel):
|
||||
"""Represents the configuration for a miner including pool configuration,
|
||||
fan mode, temperature settings, mining mode, and power scaling."""
|
||||
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
||||
pools: PoolConfig = Field(default_factory=PoolConfig.default)
|
||||
fan_mode: FanMode = Field(default_factory=FanModeConfig.default)
|
||||
temperature: TemperatureConfig = Field(default_factory=TemperatureConfig.default)
|
||||
|
||||
@@ -336,4 +336,7 @@ class FanModeConfig(MinerConfigOption):
|
||||
return cls.default()
|
||||
|
||||
|
||||
FanMode = TypeVar("FanMode", bound=Union[*[v.value for v in FanModeConfig]])
|
||||
FanMode = TypeVar(
|
||||
"FanMode",
|
||||
bound=Union[FanModeConfig.normal, FanModeConfig.manual, FanModeConfig.immersion],
|
||||
)
|
||||
|
||||
@@ -148,6 +148,9 @@ class MiningModeHPM(MinerConfigValue):
|
||||
|
||||
|
||||
class MiningModePowerTune(MinerConfigValue):
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
||||
mode: str = field(init=False, default="power_tuning")
|
||||
power: int | None = None
|
||||
algo: TunerAlgoType = field(default_factory=TunerAlgo.default)
|
||||
@@ -244,6 +247,9 @@ class MiningModePowerTune(MinerConfigValue):
|
||||
|
||||
|
||||
class MiningModeHashrateTune(MinerConfigValue):
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
||||
mode: str = field(init=False, default="hashrate_tuning")
|
||||
hashrate: int = None
|
||||
algo: TunerAlgoType = field(default_factory=TunerAlgo.default)
|
||||
@@ -642,4 +648,15 @@ class MiningModeConfig(MinerConfigOption):
|
||||
return cls.default()
|
||||
|
||||
|
||||
MiningMode = TypeVar("MiningMode", bound=Union[*[v.value for v in MiningModeConfig]])
|
||||
MiningMode = TypeVar(
|
||||
"MiningMode",
|
||||
bound=Union[
|
||||
MiningModeConfig.normal,
|
||||
MiningModeConfig.high,
|
||||
MiningModeConfig.low,
|
||||
MiningModeConfig.sleep,
|
||||
MiningModeConfig.manual,
|
||||
MiningModeConfig.power_tuning,
|
||||
MiningModeConfig.hashrate_tuning,
|
||||
],
|
||||
)
|
||||
|
||||
@@ -55,4 +55,12 @@ class TunerAlgo(MinerConfigOption):
|
||||
return cls_attr().from_dict(dict_conf)
|
||||
|
||||
|
||||
TunerAlgoType = TypeVar("TunerAlgoType", bound=Union[*[v.value for v in TunerAlgo]])
|
||||
TunerAlgoType = TypeVar(
|
||||
"TunerAlgoType",
|
||||
bound=Union[
|
||||
TunerAlgo.standard,
|
||||
TunerAlgo.voltage_optimizer,
|
||||
TunerAlgo.board_tune,
|
||||
TunerAlgo.chip_tune,
|
||||
],
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Self
|
||||
|
||||
from pydantic import BaseModel
|
||||
from typing_extensions import Self
|
||||
|
||||
from .unit.base import AlgoHashRateUnitType
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Self
|
||||
from typing_extensions import Self
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.blake256 import Blake256Unit
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Self
|
||||
from typing_extensions import Self
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.eaglesong import EaglesongUnit
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Self
|
||||
from typing_extensions import Self
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.equihash import EquihashUnit
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Self
|
||||
from typing_extensions import Self
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.ethash import EtHashUnit
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Self
|
||||
from typing_extensions import Self
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.handshake import HandshakeUnit
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Self
|
||||
from typing_extensions import Self
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.kadena import KadenaUnit
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Self
|
||||
from typing_extensions import Self
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.kheavyhash import KHeavyHashUnit
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Self
|
||||
from typing_extensions import Self
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.scrypt import ScryptUnit
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Self
|
||||
from typing_extensions import Self
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.sha256 import SHA256Unit
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Self
|
||||
from typing_extensions import Self
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.x11 import X11Unit
|
||||
|
||||
Reference in New Issue
Block a user