refactor: optimize hashrate algo units slightly
This commit is contained in:
@@ -10,8 +10,46 @@ class AlgoHashRateUnitType(IntEnum):
|
|||||||
PH: int
|
PH: int
|
||||||
EH: int
|
EH: int
|
||||||
ZH: int
|
ZH: int
|
||||||
|
|
||||||
default: int
|
default: int
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
if self.value == self.H:
|
||||||
|
return "H/s"
|
||||||
|
if self.value == self.KH:
|
||||||
|
return "KH/s"
|
||||||
|
if self.value == self.MH:
|
||||||
|
return "MH/s"
|
||||||
|
if self.value == self.GH:
|
||||||
|
return "GH/s"
|
||||||
|
if self.value == self.TH:
|
||||||
|
return "TH/s"
|
||||||
|
if self.value == self.PH:
|
||||||
|
return "PH/s"
|
||||||
|
if self.value == self.EH:
|
||||||
|
return "EH/s"
|
||||||
|
if self.value == self.ZH:
|
||||||
|
return "ZH/s"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_str(cls, value):
|
def from_str(cls, value: str):
|
||||||
|
if value == "H":
|
||||||
|
return cls.H
|
||||||
|
elif value == "KH":
|
||||||
|
return cls.KH
|
||||||
|
elif value == "MH":
|
||||||
|
return cls.MH
|
||||||
|
elif value == "GH":
|
||||||
|
return cls.GH
|
||||||
|
elif value == "TH":
|
||||||
|
return cls.TH
|
||||||
|
elif value == "PH":
|
||||||
|
return cls.PH
|
||||||
|
elif value == "EH":
|
||||||
|
return cls.EH
|
||||||
|
elif value == "ZH":
|
||||||
|
return cls.ZH
|
||||||
return cls.default
|
return cls.default
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return str(self)
|
||||||
|
|||||||
@@ -14,44 +14,3 @@ class Blake256Unit(AlgoHashRateUnitType):
|
|||||||
ZH = int(EH) * 1000
|
ZH = int(EH) * 1000
|
||||||
|
|
||||||
default = TH
|
default = TH
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
if self.value == self.H:
|
|
||||||
return "H/s"
|
|
||||||
if self.value == self.KH:
|
|
||||||
return "KH/s"
|
|
||||||
if self.value == self.MH:
|
|
||||||
return "MH/s"
|
|
||||||
if self.value == self.GH:
|
|
||||||
return "GH/s"
|
|
||||||
if self.value == self.TH:
|
|
||||||
return "TH/s"
|
|
||||||
if self.value == self.PH:
|
|
||||||
return "PH/s"
|
|
||||||
if self.value == self.EH:
|
|
||||||
return "EH/s"
|
|
||||||
if self.value == self.ZH:
|
|
||||||
return "ZH/s"
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_str(cls, value: str):
|
|
||||||
if value == "H":
|
|
||||||
return cls.H
|
|
||||||
elif value == "KH":
|
|
||||||
return cls.KH
|
|
||||||
elif value == "MH":
|
|
||||||
return cls.MH
|
|
||||||
elif value == "GH":
|
|
||||||
return cls.GH
|
|
||||||
elif value == "TH":
|
|
||||||
return cls.TH
|
|
||||||
elif value == "PH":
|
|
||||||
return cls.PH
|
|
||||||
elif value == "EH":
|
|
||||||
return cls.EH
|
|
||||||
elif value == "ZH":
|
|
||||||
return cls.ZH
|
|
||||||
return cls.default
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return str(self)
|
|
||||||
|
|||||||
@@ -14,44 +14,3 @@ class EaglesongUnit(AlgoHashRateUnitType):
|
|||||||
ZH = int(EH) * 1000
|
ZH = int(EH) * 1000
|
||||||
|
|
||||||
default = TH
|
default = TH
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
if self.value == self.H:
|
|
||||||
return "H/s"
|
|
||||||
if self.value == self.KH:
|
|
||||||
return "KH/s"
|
|
||||||
if self.value == self.MH:
|
|
||||||
return "MH/s"
|
|
||||||
if self.value == self.GH:
|
|
||||||
return "GH/s"
|
|
||||||
if self.value == self.TH:
|
|
||||||
return "TH/s"
|
|
||||||
if self.value == self.PH:
|
|
||||||
return "PH/s"
|
|
||||||
if self.value == self.EH:
|
|
||||||
return "EH/s"
|
|
||||||
if self.value == self.ZH:
|
|
||||||
return "ZH/s"
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_str(cls, value: str):
|
|
||||||
if value == "H":
|
|
||||||
return cls.H
|
|
||||||
elif value == "KH":
|
|
||||||
return cls.KH
|
|
||||||
elif value == "MH":
|
|
||||||
return cls.MH
|
|
||||||
elif value == "GH":
|
|
||||||
return cls.GH
|
|
||||||
elif value == "TH":
|
|
||||||
return cls.TH
|
|
||||||
elif value == "PH":
|
|
||||||
return cls.PH
|
|
||||||
elif value == "EH":
|
|
||||||
return cls.EH
|
|
||||||
elif value == "ZH":
|
|
||||||
return cls.ZH
|
|
||||||
return cls.default
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return str(self)
|
|
||||||
|
|||||||
@@ -32,26 +32,3 @@ class EquihashUnit(AlgoHashRateUnitType):
|
|||||||
return "ESol/s"
|
return "ESol/s"
|
||||||
if self.value == self.ZH:
|
if self.value == self.ZH:
|
||||||
return "ZSol/s"
|
return "ZSol/s"
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_str(cls, value: str):
|
|
||||||
if value == "H":
|
|
||||||
return cls.H
|
|
||||||
elif value == "KH":
|
|
||||||
return cls.KH
|
|
||||||
elif value == "MH":
|
|
||||||
return cls.MH
|
|
||||||
elif value == "GH":
|
|
||||||
return cls.GH
|
|
||||||
elif value == "TH":
|
|
||||||
return cls.TH
|
|
||||||
elif value == "PH":
|
|
||||||
return cls.PH
|
|
||||||
elif value == "EH":
|
|
||||||
return cls.EH
|
|
||||||
elif value == "ZH":
|
|
||||||
return cls.ZH
|
|
||||||
return cls.default
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return str(self)
|
|
||||||
|
|||||||
@@ -14,44 +14,3 @@ class EtHashUnit(AlgoHashRateUnitType):
|
|||||||
ZH = int(EH) * 1000
|
ZH = int(EH) * 1000
|
||||||
|
|
||||||
default = MH
|
default = MH
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
if self.value == self.H:
|
|
||||||
return "H/s"
|
|
||||||
if self.value == self.KH:
|
|
||||||
return "KH/s"
|
|
||||||
if self.value == self.MH:
|
|
||||||
return "MH/s"
|
|
||||||
if self.value == self.GH:
|
|
||||||
return "GH/s"
|
|
||||||
if self.value == self.TH:
|
|
||||||
return "TH/s"
|
|
||||||
if self.value == self.PH:
|
|
||||||
return "PH/s"
|
|
||||||
if self.value == self.EH:
|
|
||||||
return "EH/s"
|
|
||||||
if self.value == self.ZH:
|
|
||||||
return "ZH/s"
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_str(cls, value: str):
|
|
||||||
if value == "H":
|
|
||||||
return cls.H
|
|
||||||
elif value == "KH":
|
|
||||||
return cls.KH
|
|
||||||
elif value == "MH":
|
|
||||||
return cls.MH
|
|
||||||
elif value == "GH":
|
|
||||||
return cls.GH
|
|
||||||
elif value == "TH":
|
|
||||||
return cls.TH
|
|
||||||
elif value == "PH":
|
|
||||||
return cls.PH
|
|
||||||
elif value == "EH":
|
|
||||||
return cls.EH
|
|
||||||
elif value == "ZH":
|
|
||||||
return cls.ZH
|
|
||||||
return cls.default
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return str(self)
|
|
||||||
|
|||||||
@@ -14,44 +14,3 @@ class HandshakeUnit(AlgoHashRateUnitType):
|
|||||||
ZH = int(EH) * 1000
|
ZH = int(EH) * 1000
|
||||||
|
|
||||||
default = TH
|
default = TH
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
if self.value == self.H:
|
|
||||||
return "H/s"
|
|
||||||
if self.value == self.KH:
|
|
||||||
return "KH/s"
|
|
||||||
if self.value == self.MH:
|
|
||||||
return "MH/s"
|
|
||||||
if self.value == self.GH:
|
|
||||||
return "GH/s"
|
|
||||||
if self.value == self.TH:
|
|
||||||
return "TH/s"
|
|
||||||
if self.value == self.PH:
|
|
||||||
return "PH/s"
|
|
||||||
if self.value == self.EH:
|
|
||||||
return "EH/s"
|
|
||||||
if self.value == self.ZH:
|
|
||||||
return "ZH/s"
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_str(cls, value: str):
|
|
||||||
if value == "H":
|
|
||||||
return cls.H
|
|
||||||
elif value == "KH":
|
|
||||||
return cls.KH
|
|
||||||
elif value == "MH":
|
|
||||||
return cls.MH
|
|
||||||
elif value == "GH":
|
|
||||||
return cls.GH
|
|
||||||
elif value == "TH":
|
|
||||||
return cls.TH
|
|
||||||
elif value == "PH":
|
|
||||||
return cls.PH
|
|
||||||
elif value == "EH":
|
|
||||||
return cls.EH
|
|
||||||
elif value == "ZH":
|
|
||||||
return cls.ZH
|
|
||||||
return cls.default
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return str(self)
|
|
||||||
|
|||||||
@@ -14,44 +14,3 @@ class KadenaUnit(AlgoHashRateUnitType):
|
|||||||
ZH = int(EH) * 1000
|
ZH = int(EH) * 1000
|
||||||
|
|
||||||
default = TH
|
default = TH
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
if self.value == self.H:
|
|
||||||
return "H/s"
|
|
||||||
if self.value == self.KH:
|
|
||||||
return "KH/s"
|
|
||||||
if self.value == self.MH:
|
|
||||||
return "MH/s"
|
|
||||||
if self.value == self.GH:
|
|
||||||
return "GH/s"
|
|
||||||
if self.value == self.TH:
|
|
||||||
return "TH/s"
|
|
||||||
if self.value == self.PH:
|
|
||||||
return "PH/s"
|
|
||||||
if self.value == self.EH:
|
|
||||||
return "EH/s"
|
|
||||||
if self.value == self.ZH:
|
|
||||||
return "ZH/s"
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_str(cls, value: str):
|
|
||||||
if value == "H":
|
|
||||||
return cls.H
|
|
||||||
elif value == "KH":
|
|
||||||
return cls.KH
|
|
||||||
elif value == "MH":
|
|
||||||
return cls.MH
|
|
||||||
elif value == "GH":
|
|
||||||
return cls.GH
|
|
||||||
elif value == "TH":
|
|
||||||
return cls.TH
|
|
||||||
elif value == "PH":
|
|
||||||
return cls.PH
|
|
||||||
elif value == "EH":
|
|
||||||
return cls.EH
|
|
||||||
elif value == "ZH":
|
|
||||||
return cls.ZH
|
|
||||||
return cls.default
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return str(self)
|
|
||||||
|
|||||||
@@ -14,44 +14,3 @@ class KHeavyHashUnit(AlgoHashRateUnitType):
|
|||||||
ZH = int(EH) * 1000
|
ZH = int(EH) * 1000
|
||||||
|
|
||||||
default = TH
|
default = TH
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
if self.value == self.H:
|
|
||||||
return "H/s"
|
|
||||||
if self.value == self.KH:
|
|
||||||
return "KH/s"
|
|
||||||
if self.value == self.MH:
|
|
||||||
return "MH/s"
|
|
||||||
if self.value == self.GH:
|
|
||||||
return "GH/s"
|
|
||||||
if self.value == self.TH:
|
|
||||||
return "TH/s"
|
|
||||||
if self.value == self.PH:
|
|
||||||
return "PH/s"
|
|
||||||
if self.value == self.EH:
|
|
||||||
return "EH/s"
|
|
||||||
if self.value == self.ZH:
|
|
||||||
return "ZH/s"
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_str(cls, value: str):
|
|
||||||
if value == "H":
|
|
||||||
return cls.H
|
|
||||||
elif value == "KH":
|
|
||||||
return cls.KH
|
|
||||||
elif value == "MH":
|
|
||||||
return cls.MH
|
|
||||||
elif value == "GH":
|
|
||||||
return cls.GH
|
|
||||||
elif value == "TH":
|
|
||||||
return cls.TH
|
|
||||||
elif value == "PH":
|
|
||||||
return cls.PH
|
|
||||||
elif value == "EH":
|
|
||||||
return cls.EH
|
|
||||||
elif value == "ZH":
|
|
||||||
return cls.ZH
|
|
||||||
return cls.default
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return str(self)
|
|
||||||
|
|||||||
@@ -14,44 +14,3 @@ class ScryptUnit(IntEnum):
|
|||||||
ZH = int(EH) * 1000
|
ZH = int(EH) * 1000
|
||||||
|
|
||||||
default = GH
|
default = GH
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
if self.value == self.H:
|
|
||||||
return "H/s"
|
|
||||||
if self.value == self.KH:
|
|
||||||
return "KH/s"
|
|
||||||
if self.value == self.MH:
|
|
||||||
return "MH/s"
|
|
||||||
if self.value == self.GH:
|
|
||||||
return "GH/s"
|
|
||||||
if self.value == self.TH:
|
|
||||||
return "TH/s"
|
|
||||||
if self.value == self.PH:
|
|
||||||
return "PH/s"
|
|
||||||
if self.value == self.EH:
|
|
||||||
return "EH/s"
|
|
||||||
if self.value == self.ZH:
|
|
||||||
return "ZH/s"
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_str(cls, value: str):
|
|
||||||
if value == "H":
|
|
||||||
return cls.H
|
|
||||||
elif value == "KH":
|
|
||||||
return cls.KH
|
|
||||||
elif value == "MH":
|
|
||||||
return cls.MH
|
|
||||||
elif value == "GH":
|
|
||||||
return cls.GH
|
|
||||||
elif value == "TH":
|
|
||||||
return cls.TH
|
|
||||||
elif value == "PH":
|
|
||||||
return cls.PH
|
|
||||||
elif value == "EH":
|
|
||||||
return cls.EH
|
|
||||||
elif value == "ZH":
|
|
||||||
return cls.ZH
|
|
||||||
return cls.default
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return str(self)
|
|
||||||
|
|||||||
@@ -14,44 +14,3 @@ class SHA256Unit(AlgoHashRateUnitType):
|
|||||||
ZH = int(EH) * 1000
|
ZH = int(EH) * 1000
|
||||||
|
|
||||||
default = TH
|
default = TH
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
if self.value == self.H:
|
|
||||||
return "H/s"
|
|
||||||
if self.value == self.KH:
|
|
||||||
return "KH/s"
|
|
||||||
if self.value == self.MH:
|
|
||||||
return "MH/s"
|
|
||||||
if self.value == self.GH:
|
|
||||||
return "GH/s"
|
|
||||||
if self.value == self.TH:
|
|
||||||
return "TH/s"
|
|
||||||
if self.value == self.PH:
|
|
||||||
return "PH/s"
|
|
||||||
if self.value == self.EH:
|
|
||||||
return "EH/s"
|
|
||||||
if self.value == self.ZH:
|
|
||||||
return "ZH/s"
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_str(cls, value: str):
|
|
||||||
if value == "H":
|
|
||||||
return cls.H
|
|
||||||
elif value == "KH":
|
|
||||||
return cls.KH
|
|
||||||
elif value == "MH":
|
|
||||||
return cls.MH
|
|
||||||
elif value == "GH":
|
|
||||||
return cls.GH
|
|
||||||
elif value == "TH":
|
|
||||||
return cls.TH
|
|
||||||
elif value == "PH":
|
|
||||||
return cls.PH
|
|
||||||
elif value == "EH":
|
|
||||||
return cls.EH
|
|
||||||
elif value == "ZH":
|
|
||||||
return cls.ZH
|
|
||||||
return cls.default
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return str(self)
|
|
||||||
|
|||||||
@@ -14,44 +14,3 @@ class X11Unit(AlgoHashRateUnitType):
|
|||||||
ZH = int(EH) * 1000
|
ZH = int(EH) * 1000
|
||||||
|
|
||||||
default = GH
|
default = GH
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
if self.value == self.H:
|
|
||||||
return "H/s"
|
|
||||||
if self.value == self.KH:
|
|
||||||
return "KH/s"
|
|
||||||
if self.value == self.MH:
|
|
||||||
return "MH/s"
|
|
||||||
if self.value == self.GH:
|
|
||||||
return "GH/s"
|
|
||||||
if self.value == self.TH:
|
|
||||||
return "TH/s"
|
|
||||||
if self.value == self.PH:
|
|
||||||
return "PH/s"
|
|
||||||
if self.value == self.EH:
|
|
||||||
return "EH/s"
|
|
||||||
if self.value == self.ZH:
|
|
||||||
return "ZH/s"
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_str(cls, value: str):
|
|
||||||
if value == "H":
|
|
||||||
return cls.H
|
|
||||||
elif value == "KH":
|
|
||||||
return cls.KH
|
|
||||||
elif value == "MH":
|
|
||||||
return cls.MH
|
|
||||||
elif value == "GH":
|
|
||||||
return cls.GH
|
|
||||||
elif value == "TH":
|
|
||||||
return cls.TH
|
|
||||||
elif value == "PH":
|
|
||||||
return cls.PH
|
|
||||||
elif value == "EH":
|
|
||||||
return cls.EH
|
|
||||||
elif value == "ZH":
|
|
||||||
return cls.ZH
|
|
||||||
return cls.default
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return str(self)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user