* feature: switch almost everything to pydantic BaseModel * feature: swap more dataclasses over to pydantic models * feature: use more model serializers to make data handle better * bug: fix some serialization issues with `None` values * bug: fix some initialization problems with miner mode config * bug: fix new BOS+ pool parsing * bug: fix new BOS+ board temperature parsing serialization error * bug: more misc fixes with serialization, extra methods, and hashrate types * bug: add explicit type conversions to hashrate types * bug: fix epic pool URL parsing * bug: fix positional args in hashboards * bug: fix epic missing url scheme * convert board temp to int --------- Co-authored-by: Upstream Data <brett@upstreamdata.ca> Co-authored-by: John-Paul Compagnone <jpcompagnone@epicblockchain.io>
19 lines
399 B
Python
19 lines
399 B
Python
from pydantic import BaseModel
|
|
|
|
|
|
class BaseMinerError(BaseModel):
|
|
@classmethod
|
|
def fields(cls):
|
|
return list(cls.model_fields.keys())
|
|
|
|
def asdict(self) -> dict:
|
|
return self.model_dump()
|
|
|
|
def as_dict(self) -> dict:
|
|
"""Get this dataclass as a dictionary.
|
|
|
|
Returns:
|
|
A dictionary version of this class.
|
|
"""
|
|
return self.asdict()
|