Compare commits

..

35 Commits

Author SHA1 Message Date
UpstreamData
74b4aeb44a version: bump version number 2022-11-14 09:14:28 -07:00
UpstreamData
9c7ab5ac57 bug: fix support for new miners that return a BOSer string in version data. 2022-11-14 09:10:18 -07:00
Upstream Data
65ecf1fea2 version: bump version number 2022-11-13 19:36:25 -07:00
Upstream Data
44142c658b format: remove print statements 2022-11-13 19:36:07 -07:00
Upstream Data
25a205ce6c version: bump version number 2022-11-13 19:27:55 -07:00
Upstream Data
25094084cf bug: clarify uppercasing data from __get_model_from_graphql() 2022-11-13 19:27:32 -07:00
Upstream Data
4eac601153 version: bump version number 2022-11-13 19:17:43 -07:00
Upstream Data
f0d8d66b9b bug: fix not handling errors in send_graphql_query 2022-11-13 19:16:48 -07:00
Upstream Data
cfa550f8c0 version: bump version number 2022-11-13 19:07:56 -07:00
Arceris
91f6a5bf41 bug: catch TypeError on temps 2022-11-13 19:06:52 -07:00
Upstream Data
464bd6be65 version: bump version number. 2022-11-13 18:58:31 -07:00
Upstream Data
031d7e2186 bug: fix missing catching IndexError 2022-11-13 18:58:05 -07:00
Upstream Data
126b0d124c version: bump version number 2022-11-13 18:54:46 -07:00
Upstream Data
81c84a3e8f bug: fix a bug with no try except blocks on pools. 2022-11-13 18:54:26 -07:00
Upstream Data
406d5bd549 version: bump version number 2022-11-13 18:21:18 -07:00
Upstream Data
cd5fe09fd9 bug: fix wrong formatting for multiple error handling 2022-11-13 18:20:15 -07:00
Upstream Data
766fc4efed bug: fix check light not responding properly from graphQL. 2022-11-13 17:06:35 -07:00
Upstream Data
b70fed40c8 bug: add try except statements to get_data to fix bugs with getting data from graphql. 2022-11-13 17:03:41 -07:00
Upstream Data
255d98fd08 bug: fix some issues with validating data from graphql properly 2022-11-13 16:48:22 -07:00
Upstream Data
78304631f7 bug: fix errors not registering properly on braiins OS miners 2022-11-13 16:34:26 -07:00
Upstream Data
ab230844fc bug: fix an issue with chip count not receiving properly in some cases. 2022-11-13 16:31:41 -07:00
Upstream Data
8a58cb9fd3 format: remove extra print 2022-11-13 16:28:36 -07:00
Upstream Data
70b6ed73dc bug: fix manual return from __get_devdetails_and_version 2022-11-13 16:27:42 -07:00
Upstream Data
d2400bf44e bug: fix identifying stock as bosminer. 2022-11-13 16:22:57 -07:00
Upstream Data
db780fe876 version: bump version number 2022-11-13 15:14:16 -07:00
Upstream Data
cd84ae828a bug: fix a bug with some missing temperatures in graphql. 2022-11-13 15:13:56 -07:00
Upstream Data
970d5d1031 version: bump version number 2022-11-13 14:39:23 -07:00
Upstream Data
da0e327ec7 feature: add support for graphQL for BOS miners which may be having API issues, such as BBB. 2022-11-13 14:38:44 -07:00
Upstream Data
4c84a8d572 bug: ensure bosminer check_light backwards compatibility 2022-11-13 11:06:28 -07:00
Upstream Data
1cfd895deb feature: improve speed of bosminer check_light by 10x using graphql. 2022-11-13 11:01:22 -07:00
Upstream Data
d0da08eb10 version: bump version number 2022-11-12 14:51:30 -07:00
Upstream Data
ee4f2cd87d bug: fix win error check not being cross platform 2022-11-12 14:51:10 -07:00
UpstreamData
8a6577c8aa docs: Update README.md. 2022-11-10 14:20:41 -07:00
UpstreamData
ed5eae4187 format: add isort to dev requirements. 2022-11-10 14:17:31 -07:00
UpstreamData
f3b25027ad format: add isort to pre-commit and sort imports. 2022-11-10 14:15:45 -07:00
85 changed files with 459 additions and 264 deletions

View File

@@ -9,6 +9,12 @@ repos:
rev: 22.6.0 rev: 22.6.0
hooks: hooks:
- id: black - id: black
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: isort (python)
- repo: local - repo: local
hooks: hooks:
- id: unittest - id: unittest

View File

@@ -18,6 +18,10 @@ You can install pyasic directly from pip with the command `pip install pyasic`.
For those of you who aren't comfortable with code and developer tools, there are windows builds of GUI applications that use this library [here](https://drive.google.com/drive/folders/1DjR8UOS_g0ehfiJcgmrV0FFoqFvE9akW?usp=sharing). For those of you who aren't comfortable with code and developer tools, there are windows builds of GUI applications that use this library [here](https://drive.google.com/drive/folders/1DjR8UOS_g0ehfiJcgmrV0FFoqFvE9akW?usp=sharing).
## Developer Setup ## Developer Setup
It is highly reccommended that you contribute to this project through [`pyasic-super`](https://github.com/UpstreamData/pyasic-super) using its submodules. This allows testing in conjunction with other `pyasic` related programs.
<br>
This repo uses poetry for dependencies, which can be installed by following the guide on their website [here](https://python-poetry.org/docs/#installation). This repo uses poetry for dependencies, which can be installed by following the guide on their website [here](https://python-poetry.org/docs/#installation).
After you have poetry installed, run `poetry install --with dev`, or `poetry install --with dev,docs` if you want to include packages required for documentation. After you have poetry installed, run `poetry install --with dev`, or `poetry install --with dev,docs` if you want to include packages required for documentation.

View File

@@ -13,12 +13,12 @@
# limitations under the License. # limitations under the License.
import asyncio import asyncio
import json
import ipaddress import ipaddress
import warnings import json
import logging import logging
from typing import Union
import re import re
import warnings
from typing import Union
from pyasic.errors import APIError, APIWarning from pyasic.errors import APIError, APIWarning
@@ -98,7 +98,7 @@ If you are sure you want to use this command please use API.send_command("{comma
reader, writer = await asyncio.open_connection(str(self.ip), self.port) reader, writer = await asyncio.open_connection(str(self.ip), self.port)
# handle OSError 121 # handle OSError 121
except OSError as e: except OSError as e:
if e.winerror == "121": if getattr(e, "winerror") == "121":
logging.warning("Semaphore Timeout has Expired.") logging.warning("Semaphore Timeout has Expired.")
return b"{}" return b"{}"

View File

@@ -13,8 +13,7 @@
# limitations under the License. # limitations under the License.
import logging import logging
from pyasic.API import BaseMinerAPI from pyasic.API import APIError, BaseMinerAPI
from pyasic.API import APIError
class BMMinerAPI(BaseMinerAPI): class BMMinerAPI(BaseMinerAPI):

View File

@@ -13,22 +13,21 @@
# limitations under the License. # limitations under the License.
import asyncio import asyncio
import re
import json
import hashlib
import binascii
import base64 import base64
import binascii
import hashlib
import json
import logging import logging
import re
from typing import Union from typing import Union
from passlib.handlers.md5_crypt import md5_crypt
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from passlib.handlers.md5_crypt import md5_crypt
from pyasic.errors import APIError
from pyasic.API import BaseMinerAPI from pyasic.API import BaseMinerAPI
from pyasic.errors import APIError
from pyasic.settings import PyasicSettings from pyasic.settings import PyasicSettings
### IMPORTANT ### ### IMPORTANT ###
# you need to change the password of the miners using the Whatsminer # you need to change the password of the miners using the Whatsminer
# tool, then you can set them back to admin with this tool, but they # tool, then you can set them back to admin with this tool, but they

View File

@@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from pyasic.API import BaseMinerAPI, APIError
import logging import logging
from pyasic.API import APIError, BaseMinerAPI
class CGMinerAPI(BaseMinerAPI): class CGMinerAPI(BaseMinerAPI):
"""An abstraction of the CGMiner API. """An abstraction of the CGMiner API.

View File

@@ -16,26 +16,20 @@ from pyasic.API.bosminer import BOSMinerAPI
from pyasic.API.btminer import BTMinerAPI from pyasic.API.btminer import BTMinerAPI
from pyasic.API.cgminer import CGMinerAPI from pyasic.API.cgminer import CGMinerAPI
from pyasic.API.unknown import UnknownAPI from pyasic.API.unknown import UnknownAPI
from pyasic.config import MinerConfig from pyasic.config import MinerConfig
from pyasic.data import ( from pyasic.data import (
MinerData,
BraiinsOSError, BraiinsOSError,
InnosiliconError, InnosiliconError,
MinerData,
WhatsminerError, WhatsminerError,
X19Error, X19Error,
) )
from pyasic.errors import APIError, APIWarning from pyasic.errors import APIError, APIWarning
from pyasic.miners import get_miner from pyasic.miners import get_miner
from pyasic.miners.base import AnyMiner from pyasic.miners.base import AnyMiner
from pyasic.miners.miner_factory import MinerFactory from pyasic.miners.miner_factory import MinerFactory
from pyasic.miners.miner_listener import MinerListener from pyasic.miners.miner_listener import MinerListener
from pyasic.network import MinerNetwork from pyasic.network import MinerNetwork
from pyasic.settings import PyasicSettings from pyasic.settings import PyasicSettings
__all__ = [ __all__ = [

View File

@@ -12,15 +12,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from dataclasses import dataclass, asdict, fields import json
from typing import Literal, List
import random import random
import string import string
import time
from dataclasses import asdict, dataclass, fields
from typing import List, Literal
import toml import toml
import yaml import yaml
import json
import time
@dataclass @dataclass

View File

@@ -12,15 +12,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from typing import Union, List import copy
from dataclasses import dataclass, field, asdict, fields import json
import time
from dataclasses import asdict, dataclass, field, fields
from datetime import datetime, timezone from datetime import datetime, timezone
from functools import reduce from functools import reduce
import time from typing import List, Union
import json
import copy
from .error_codes import X19Error, WhatsminerError, BraiinsOSError, InnosiliconError from .error_codes import BraiinsOSError, InnosiliconError, WhatsminerError, X19Error
@dataclass @dataclass

View File

@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from dataclasses import dataclass, asdict, fields from dataclasses import asdict, dataclass, fields
@dataclass @dataclass

View File

@@ -12,13 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .whatsminer import WhatsminerError
from .bos import BraiinsOSError
from .X19 import X19Error
from .innosilicon import InnosiliconError
from typing import TypeVar from typing import TypeVar
from .bos import BraiinsOSError
from .innosilicon import InnosiliconError
from .whatsminer import WhatsminerError
from .X19 import X19Error
MinerErrorData = TypeVar( MinerErrorData = TypeVar(
"MinerErrorData", WhatsminerError, BraiinsOSError, X19Error, InnosiliconError "MinerErrorData", WhatsminerError, BraiinsOSError, X19Error, InnosiliconError
) )

View File

@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from dataclasses import dataclass, asdict, fields from dataclasses import asdict, dataclass, fields
@dataclass @dataclass

View File

@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from dataclasses import dataclass, field, asdict, fields from dataclasses import asdict, dataclass, field, fields
@dataclass @dataclass

View File

@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from dataclasses import dataclass, field, asdict, fields from dataclasses import asdict, dataclass, field, fields
@dataclass @dataclass

View File

@@ -13,6 +13,7 @@
# limitations under the License. # limitations under the License.
import logging import logging
from pyasic.settings import PyasicSettings from pyasic.settings import PyasicSettings

View File

@@ -15,9 +15,10 @@
import ipaddress import ipaddress
from typing import Union from typing import Union
from pyasic.miners.base import BaseMiner, AnyMiner from pyasic.miners.base import AnyMiner, BaseMiner
from pyasic.miners.miner_factory import MinerFactory from pyasic.miners.miner_factory import MinerFactory
# abstracted version of get miner that is easier to access # abstracted version of get miner that is easier to access
async def get_miner(ip: Union[ipaddress.ip_address, str]) -> AnyMiner: async def get_miner(ip: Union[ipaddress.ip_address, str]) -> AnyMiner:
return await MinerFactory().get_miner(ip) return await MinerFactory().get_miner(ip)

View File

@@ -14,16 +14,13 @@
import ipaddress import ipaddress
import logging import logging
from typing import Union, List from typing import List, Union
from pyasic.API.bmminer import BMMinerAPI from pyasic.API.bmminer import BMMinerAPI
from pyasic.miners.base import BaseMiner
from pyasic.data import MinerData, HashBoard
from pyasic.config import MinerConfig from pyasic.config import MinerConfig
from pyasic.data import HashBoard, MinerData
from pyasic.data.error_codes import MinerErrorData from pyasic.data.error_codes import MinerErrorData
from pyasic.miners.base import BaseMiner
from pyasic.settings import PyasicSettings from pyasic.settings import PyasicSettings

View File

@@ -13,22 +13,19 @@
# limitations under the License. # limitations under the License.
import ipaddress import ipaddress
import logging
import json import json
from typing import Union, List import logging
from typing import List, Union
import toml import toml
import httpx
from pyasic.miners.base import BaseMiner
from pyasic.API.bosminer import BOSMinerAPI from pyasic.API.bosminer import BOSMinerAPI
from pyasic.errors import APIError
from pyasic.data.error_codes import BraiinsOSError, MinerErrorData
from pyasic.data import MinerData, HashBoard
from pyasic.config import MinerConfig from pyasic.config import MinerConfig
from pyasic.data import HashBoard, MinerData
from pyasic.data.error_codes import BraiinsOSError, MinerErrorData
from pyasic.errors import APIError
from pyasic.miners.base import BaseMiner
from pyasic.settings import PyasicSettings from pyasic.settings import PyasicSettings
@@ -69,6 +66,27 @@ class BOSMiner(BaseMiner):
# return the result, either command output or None # return the result, either command output or None
return str(result) return str(result)
async def send_graphql_query(self, query) -> Union[dict, None]:
url = f"http://{self.ip}/graphql"
try:
async with httpx.AsyncClient() as client:
_auth = await client.post(
url,
json={
"query": 'mutation{auth{login(username:"'
+ self.uname
+ '", password:"'
+ self.pwd
+ '"){__typename}}}'
},
)
d = await client.post(url, json={"query": query})
if d.status_code == 200:
return d.json()
except httpx.ReadError:
return None
return None
async def fault_light_on(self) -> bool: async def fault_light_on(self) -> bool:
"""Sends command to turn on fault light on the miner.""" """Sends command to turn on fault light on the miner."""
logging.debug(f"{self}: Sending fault_light on command.") logging.debug(f"{self}: Sending fault_light on command.")
@@ -152,6 +170,11 @@ class BOSMiner(BaseMiner):
""" """
if self.hostname: if self.hostname:
return self.hostname return self.hostname
# get hostname through GraphQL
if data := await self.send_graphql_query("{bos {hostname}}"):
self.hostname = data["data"]["bos"]["hostname"]
return self.hostname
try: try:
async with (await self._get_ssh_connection()) as conn: async with (await self._get_ssh_connection()) as conn:
if conn is not None: if conn is not None:
@@ -215,9 +238,15 @@ class BOSMiner(BaseMiner):
if self.version: if self.version:
logging.debug(f"Found version for {self.ip}: {self.version}") logging.debug(f"Found version for {self.ip}: {self.version}")
return self.version return self.version
version_data = None
# try to get data from graphql
data = await self.send_graphql_query("{bos{info{version{full}}}}")
if data:
version_data = data["bos"]["info"]["version"]["full"]
# get output of bos version file if not version_data:
version_data = await self.send_ssh_command("cat /etc/bos_version") # try version data file
version_data = await self.send_ssh_command("cat /etc/bos_version")
# if we get the version data, parse it # if we get the version data, parse it
if version_data: if version_data:
@@ -248,6 +277,15 @@ class BOSMiner(BaseMiner):
async def check_light(self) -> bool: async def check_light(self) -> bool:
if self.light: if self.light:
return self.light return self.light
# get light through GraphQL
if data := await self.send_graphql_query("{bos {faultLight}}"):
try:
self.light = data["data"]["bos"]["faultLight"]
return self.light
except (TypeError, KeyError, ValueError, IndexError):
pass
# get light via ssh if that fails (10x slower)
data = ( data = (
await self.send_ssh_command("cat /sys/class/leds/'Red LED'/delay_off") await self.send_ssh_command("cat /sys/class/leds/'Red LED'/delay_off")
).strip() ).strip()
@@ -289,6 +327,7 @@ class BOSMiner(BaseMiner):
if board["Status"] not in [ if board["Status"] not in [
"Stable", "Stable",
"Testing performance profile", "Testing performance profile",
"Tuning individual chips"
]: ]:
_error = board["Status"].split(" {")[0] _error = board["Status"].split(" {")[0]
_error = _error[0].lower() + _error[1:] _error = _error[0].lower() + _error[1:]
@@ -303,6 +342,10 @@ class BOSMiner(BaseMiner):
Returns: Returns:
A [`MinerData`][pyasic.data.MinerData] instance containing the miners data. A [`MinerData`][pyasic.data.MinerData] instance containing the miners data.
""" """
d = await self._graphql_get_data()
if d:
return d
data = MinerData( data = MinerData(
ip=str(self.ip), ip=str(self.ip),
ideal_chips=self.nominal_chips * self.ideal_hashboards, ideal_chips=self.nominal_chips * self.ideal_hashboards,
@@ -342,7 +385,7 @@ class BOSMiner(BaseMiner):
"devdetails", "devdetails",
"fans", "fans",
"devs", "devs",
allow_warning=allow_warning allow_warning=allow_warning,
) )
except APIError as e: except APIError as e:
if str(e.message) == "Not ready": if str(e.message) == "Not ready":
@@ -493,6 +536,139 @@ class BOSMiner(BaseMiner):
data.hashboards[_id].hashrate = hashrate data.hashboards[_id].hashrate = hashrate
return data return data
async def _graphql_get_data(self) -> Union[MinerData, None]:
data = MinerData(
ip=str(self.ip),
ideal_chips=self.nominal_chips * self.ideal_hashboards,
ideal_hashboards=self.ideal_hashboards,
hashboards=[
HashBoard(slot=i, expected_chips=self.nominal_chips, missing=True)
for i in range(self.ideal_hashboards)
],
)
query = "{bos {hostname}, bosminer{config{... on BosminerConfig{groups{pools{url, user}, strategy{... on QuotaStrategy {quota}}}}}, info{fans{name, rpm}, workSolver{realHashrate{mhs1M}, temperatures{degreesC}, power{limitW, approxConsumptionW}, childSolvers{name, realHashrate{mhs1M}, hwDetails{chips}, tuner{statusMessages}, temperatures{degreesC}}}}}}"
query_data = await self.send_graphql_query(query)
if not query_data:
return None
query_data = query_data["data"]
data.mac = await self.get_mac()
data.model = await self.get_model()
if query_data.get("bos"):
if query_data["bos"].get("hostname"):
data.hostname = query_data["bos"]["hostname"]
try:
if query_data["bosminer"]["info"]["workSolver"]["realHashrate"].get("mhs1M"):
data.hashrate = round(
query_data["bosminer"]["info"]["workSolver"]["realHashrate"]["mhs1M"]
/ 1000000,
2,
)
except (TypeError, KeyError, ValueError, IndexError):
pass
boards = None
if query_data.get("bosminer"):
if query_data["bosminer"].get("info"):
if query_data["bosminer"]["info"].get("workSolver"):
boards = query_data["bosminer"]["info"]["workSolver"].get("childSolvers")
if boards:
offset = 6 if int(boards[0]["name"]) in [6, 7, 8] else int(boards[0]["name"])
for hb in boards:
_id = int(hb["name"]) - offset
board = data.hashboards[_id]
board.hashrate = round(hb["realHashrate"]["mhs1M"] / 1000000, 2)
temps = hb["temperatures"]
try:
if len(temps) > 0:
board.temp = round(hb["temperatures"][0]["degreesC"])
if len(temps) > 1:
board.chip_temp = round(hb["temperatures"][1]["degreesC"])
except (TypeError, KeyError, ValueError, IndexError):
pass
details = hb.get("hwDetails")
if details:
if chips := details["chips"]:
board.chips = chips
board.missing = False
tuner = hb.get("tuner")
if tuner:
if msg := tuner.get("statusMessages"):
if len(msg) > 0:
if hb["tuner"]["statusMessages"][0] not in [
"Stable",
"Testing performance profile",
"Tuning individual chips"
]:
data.errors.append(
BraiinsOSError(f"Slot {_id} {hb['tuner']['statusMessages'][0]}")
)
try:
data.wattage = query_data["bosminer"]["info"]["workSolver"]["power"]["approxConsumptionW"]
except (TypeError, KeyError, ValueError, IndexError):
pass
try:
data.wattage_limit = query_data["bosminer"]["info"]["workSolver"]["power"]["limitW"]
except (TypeError, KeyError, ValueError, IndexError):
pass
for n in range(self.fan_count):
try:
setattr(data, f"fan_{n + 1}", query_data["bosminer"]["info"]["fans"][n]["rpm"])
except (TypeError, KeyError, ValueError, IndexError):
pass
groups = None
if query_data.get("bosminer"):
if query_data["bosminer"].get("config"):
groups = query_data["bosminer"]["config"].get("groups")
if groups:
if len(groups) == 1:
try:
data.pool_1_user = groups[0]["pools"][0]["user"]
except (TypeError, KeyError, ValueError, IndexError):
pass
try:
data.pool_1_url = groups[0]["pools"][0]["url"]
except (TypeError, KeyError, ValueError, IndexError):
pass
try:
data.pool_2_user = groups[0]["pools"][1]["user"]
except (TypeError, KeyError, ValueError, IndexError):
pass
try:
data.pool_2_url = groups[0]["pools"][1]["url"]
except (TypeError, KeyError, ValueError, IndexError):
pass
data.quota = 0
else:
try:
data.pool_1_user = groups[0]["pools"][0]["user"]
except (TypeError, KeyError, ValueError, IndexError):
pass
try:
data.pool_1_url = groups[0]["pools"][0]["url"]
except (TypeError, KeyError, ValueError, IndexError):
pass
try:
data.pool_2_user = groups[1]["pools"][0]["user"]
except (TypeError, KeyError, ValueError, IndexError):
pass
try:
data.pool_2_url = groups[1]["pools"][0]["url"]
except (TypeError, KeyError, ValueError, IndexError):
pass
if groups[0]["strategy"].get("quota"):
data.quota = groups[0]["strategy"]["quota"] + "/" + groups[1]["strategy"]["quota"]
data.fault_light = await self.check_light()
return data
async def get_mac(self): async def get_mac(self):
result = await self.send_ssh_command("cat /sys/class/net/eth0/address") result = await self.send_ssh_command("cat /sys/class/net/eth0/address")
return result.upper().strip() return result.upper().strip()

View File

@@ -12,16 +12,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import logging
import ipaddress import ipaddress
from typing import Union, List import logging
from typing import List, Union
from pyasic.API.bosminer import BOSMinerAPI from pyasic.API.bosminer import BOSMinerAPI
from pyasic.miners.base import BaseMiner
from pyasic.config import MinerConfig from pyasic.config import MinerConfig
from pyasic.data import MinerData from pyasic.data import MinerData
from pyasic.data.error_codes import MinerErrorData from pyasic.data.error_codes import MinerErrorData
from pyasic.miners.base import BaseMiner
class BOSMinerOld(BaseMiner): class BOSMinerOld(BaseMiner):

View File

@@ -14,17 +14,14 @@
import ipaddress import ipaddress
import logging import logging
from typing import Union, List from typing import List, Union
from pyasic.API.btminer import BTMinerAPI from pyasic.API.btminer import BTMinerAPI
from pyasic.miners.base import BaseMiner
from pyasic.errors import APIError
from pyasic.data import MinerData, HashBoard
from pyasic.data.error_codes import WhatsminerError, MinerErrorData
from pyasic.config import MinerConfig from pyasic.config import MinerConfig
from pyasic.data import HashBoard, MinerData
from pyasic.data.error_codes import MinerErrorData, WhatsminerError
from pyasic.errors import APIError
from pyasic.miners.base import BaseMiner
from pyasic.settings import PyasicSettings from pyasic.settings import PyasicSettings

View File

@@ -14,17 +14,14 @@
import ipaddress import ipaddress
import logging import logging
from typing import Union, List from typing import List, Union
from pyasic.API.cgminer import CGMinerAPI from pyasic.API.cgminer import CGMinerAPI
from pyasic.miners.base import BaseMiner
from pyasic.errors import APIError
from pyasic.config import MinerConfig from pyasic.config import MinerConfig
from pyasic.data import HashBoard, MinerData
from pyasic.data import MinerData, HashBoard
from pyasic.data.error_codes import MinerErrorData from pyasic.data.error_codes import MinerErrorData
from pyasic.errors import APIError
from pyasic.miners.base import BaseMiner
from pyasic.settings import PyasicSettings from pyasic.settings import PyasicSettings

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from pyasic.miners._backends import BMMiner
import ipaddress import ipaddress
from pyasic.miners._backends import BMMiner
class Hiveon(BMMiner): class Hiveon(BMMiner):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -14,5 +14,5 @@
from .antminer import * from .antminer import *
from .avalonminer import * from .avalonminer import *
from .whatsminer import *
from .innosilicon import * from .innosilicon import *
from .whatsminer import *

View File

@@ -16,7 +16,6 @@ from .S17 import S17
from .S17_Plus import S17Plus from .S17_Plus import S17Plus
from .S17_Pro import S17Pro from .S17_Pro import S17Pro
from .S17e import S17e from .S17e import S17e
from .T17 import T17 from .T17 import T17
from .T17_Plus import T17Plus from .T17_Plus import T17Plus
from .T17e import T17e from .T17e import T17e

View File

@@ -14,12 +14,8 @@
from .S19 import S19 from .S19 import S19
from .S19_Pro import S19Pro from .S19_Pro import S19Pro
from .S19_XP import S19XP
from .S19a import S19a
from .S19j import S19j from .S19j import S19j
from .S19j_Pro import S19jPro from .S19j_Pro import S19jPro
from .S19_XP import S19XP
from .S19a import S19a
from .T19 import T19 from .T19 import T19

View File

@@ -15,7 +15,6 @@
from .M20 import M20, M20V10 from .M20 import M20, M20V10
from .M20S import M20S, M20SV10, M20SV20 from .M20S import M20S, M20SV10, M20SV20
from .M20S_Plus import M20SPlus from .M20S_Plus import M20SPlus
from .M21 import M21 from .M21 import M21
from .M21S import M21S, M21SV20, M21SV60 from .M21S import M21S, M21SV20, M21SV60
from .M21S_Plus import M21SPlus from .M21S_Plus import M21SPlus

View File

@@ -12,26 +12,24 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .M30S import M30S, M30SVE10, M30SVE20, M30SVG20, M30SV50 from .M30S import M30S, M30SV50, M30SVE10, M30SVE20, M30SVG20
from .M30S_Plus import M30SPlus, M30SPlusVG60, M30SPlusVE40, M30SPlusVF20 from .M30S_Plus import M30SPlus, M30SPlusVE40, M30SPlusVF20, M30SPlusVG60
from .M30S_Plus_Plus import ( from .M30S_Plus_Plus import (
M30SPlusPlus, M30SPlusPlus,
M30SPlusPlusVG30, M30SPlusPlusVG30,
M30SPlusPlusVG40, M30SPlusPlusVG40,
M30SPlusPlusVH60, M30SPlusPlusVH60,
) )
from .M31S import M31S from .M31S import M31S
from .M31S_Plus import ( from .M31S_Plus import (
M31SPlus, M31SPlus,
M31SPlusVE20,
M31SPlusV30, M31SPlusV30,
M31SPlusV40, M31SPlusV40,
M31SPlusV80,
M31SPlusV60, M31SPlusV60,
M31SPlusV80,
M31SPlusV90, M31SPlusV90,
M31SPlusVE20,
) )
from .M32 import M32, M32V20 from .M32 import M32, M32V20
from .M32S import M32S from .M32S import M32S
from .M34S_Plus import M34SPlus, M34SPlusVE10 from .M34S_Plus import M34SPlus, M34SPlusVE10

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .X17 import BMMinerX17
from pyasic.miners._types import S17 # noqa - Ignore access to _module from pyasic.miners._types import S17 # noqa - Ignore access to _module
from .X17 import BMMinerX17
class BMMinerS17(BMMinerX17, S17): class BMMinerS17(BMMinerX17, S17):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .X17 import BMMinerX17
from pyasic.miners._types import S17Plus # noqa - Ignore access to _module from pyasic.miners._types import S17Plus # noqa - Ignore access to _module
from .X17 import BMMinerX17
class BMMinerS17Plus(BMMinerX17, S17Plus): class BMMinerS17Plus(BMMinerX17, S17Plus):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .X17 import BMMinerX17
from pyasic.miners._types import S17Pro # noqa - Ignore access to _module from pyasic.miners._types import S17Pro # noqa - Ignore access to _module
from .X17 import BMMinerX17
class BMMinerS17Pro(BMMinerX17, S17Pro): class BMMinerS17Pro(BMMinerX17, S17Pro):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .X17 import BMMinerX17
from pyasic.miners._types import S17e # noqa - Ignore access to _module from pyasic.miners._types import S17e # noqa - Ignore access to _module
from .X17 import BMMinerX17
class BMMinerS17e(BMMinerX17, S17e): class BMMinerS17e(BMMinerX17, S17e):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .X17 import BMMinerX17
from pyasic.miners._types import T17 # noqa - Ignore access to _module from pyasic.miners._types import T17 # noqa - Ignore access to _module
from .X17 import BMMinerX17
class BMMinerT17(BMMinerX17, T17): class BMMinerT17(BMMinerX17, T17):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .X17 import BMMinerX17
from pyasic.miners._types import T17Plus # noqa - Ignore access to _module from pyasic.miners._types import T17Plus # noqa - Ignore access to _module
from .X17 import BMMinerX17
class BMMinerT17Plus(BMMinerX17, T17Plus): class BMMinerT17Plus(BMMinerX17, T17Plus):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .X17 import BMMinerX17
from pyasic.miners._types import T17e # noqa - Ignore access to _module from pyasic.miners._types import T17e # noqa - Ignore access to _module
from .X17 import BMMinerX17
class BMMinerT17e(BMMinerX17, T17e): class BMMinerT17e(BMMinerX17, T17e):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,12 +12,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from pyasic.miners._backends import BMMiner # noqa - Ignore access to _module from typing import Union
from pyasic.settings import PyasicSettings
import httpx import httpx
from typing import Union
from pyasic.miners._backends import BMMiner # noqa - Ignore access to _module
from pyasic.settings import PyasicSettings
class BMMinerX17(BMMiner): class BMMinerX17(BMMiner):

View File

@@ -16,7 +16,6 @@ from .S17 import BMMinerS17
from .S17_Plus import BMMinerS17Plus from .S17_Plus import BMMinerS17Plus
from .S17_Pro import BMMinerS17Pro from .S17_Pro import BMMinerS17Pro
from .S17e import BMMinerS17e from .S17e import BMMinerS17e
from .T17 import BMMinerT17 from .T17 import BMMinerT17
from .T17_Plus import BMMinerT17Plus from .T17_Plus import BMMinerT17Plus
from .T17e import BMMinerT17e from .T17e import BMMinerT17e

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .X19 import BMMinerX19
from pyasic.miners._types import S19 # noqa - Ignore access to _module from pyasic.miners._types import S19 # noqa - Ignore access to _module
from .X19 import BMMinerX19
class BMMinerS19(BMMinerX19, S19): class BMMinerS19(BMMinerX19, S19):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .X19 import BMMinerX19
from pyasic.miners._types import S19Pro # noqa - Ignore access to _module from pyasic.miners._types import S19Pro # noqa - Ignore access to _module
from .X19 import BMMinerX19
class BMMinerS19Pro(BMMinerX19, S19Pro): class BMMinerS19Pro(BMMinerX19, S19Pro):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .X19 import BMMinerX19
from pyasic.miners._types import S19XP # noqa - Ignore access to _module from pyasic.miners._types import S19XP # noqa - Ignore access to _module
from .X19 import BMMinerX19
class BMMinerS19XP(BMMinerX19, S19XP): class BMMinerS19XP(BMMinerX19, S19XP):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .X19 import BMMinerX19
from pyasic.miners._types import S19a # noqa - Ignore access to _module from pyasic.miners._types import S19a # noqa - Ignore access to _module
from .X19 import BMMinerX19
class BMMinerS19a(BMMinerX19, S19a): class BMMinerS19a(BMMinerX19, S19a):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .X19 import BMMinerX19
from pyasic.miners._types import S19j # noqa - Ignore access to _module from pyasic.miners._types import S19j # noqa - Ignore access to _module
from .X19 import BMMinerX19
class BMMinerS19j(BMMinerX19, S19j): class BMMinerS19j(BMMinerX19, S19j):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .X19 import BMMinerX19
from pyasic.miners._types import S19jPro # noqa - Ignore access to _module from pyasic.miners._types import S19jPro # noqa - Ignore access to _module
from .X19 import BMMinerX19
class BMMinerS19jPro(BMMinerX19, S19jPro): class BMMinerS19jPro(BMMinerX19, S19jPro):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .X19 import BMMinerX19
from pyasic.miners._types import T19 # noqa - Ignore access to _module from pyasic.miners._types import T19 # noqa - Ignore access to _module
from .X19 import BMMinerX19
class BMMinerT19(BMMinerX19, T19): class BMMinerT19(BMMinerX19, T19):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,16 +12,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from pyasic.miners._backends import BMMiner # noqa - Ignore access to _module import asyncio
import json
from pyasic.config import MinerConfig from typing import List, Union
from pyasic.data.error_codes import X19Error, MinerErrorData
from pyasic.settings import PyasicSettings
import httpx import httpx
import json
import asyncio from pyasic.config import MinerConfig
from typing import Union, List from pyasic.data.error_codes import MinerErrorData, X19Error
from pyasic.miners._backends import BMMiner # noqa - Ignore access to _module
from pyasic.settings import PyasicSettings
class BMMinerX19(BMMiner): class BMMinerX19(BMMiner):

View File

@@ -14,12 +14,8 @@
from .S19 import BMMinerS19 from .S19 import BMMinerS19
from .S19_Pro import BMMinerS19Pro from .S19_Pro import BMMinerS19Pro
from .S19_XP import BMMinerS19XP
from .S19a import BMMinerS19a
from .S19j import BMMinerS19j from .S19j import BMMinerS19j
from .S19j_Pro import BMMinerS19jPro from .S19j_Pro import BMMinerS19jPro
from .S19_XP import BMMinerS19XP
from .S19a import BMMinerS19a
from .T19 import BMMinerT19 from .T19 import BMMinerT19

View File

@@ -16,7 +16,6 @@ from .S17 import BOSMinerS17
from .S17_Plus import BOSMinerS17Plus from .S17_Plus import BOSMinerS17Plus
from .S17_Pro import BOSMinerS17Pro from .S17_Pro import BOSMinerS17Pro
from .S17e import BOSMinerS17e from .S17e import BOSMinerS17e
from .T17 import BOSMinerT17 from .T17 import BOSMinerT17
from .T17_Plus import BOSMinerT17Plus from .T17_Plus import BOSMinerT17Plus
from .T17e import BOSMinerT17e from .T17e import BOSMinerT17e

View File

@@ -14,8 +14,6 @@
from .S19 import BOSMinerS19 from .S19 import BOSMinerS19
from .S19_Pro import BOSMinerS19Pro from .S19_Pro import BOSMinerS19Pro
from .S19j import BOSMinerS19j from .S19j import BOSMinerS19j
from .S19j_Pro import BOSMinerS19jPro from .S19j_Pro import BOSMinerS19jPro
from .T19 import BOSMinerT19 from .T19 import BOSMinerT19

View File

@@ -16,7 +16,6 @@ from .S17 import CGMinerS17
from .S17_Plus import CGMinerS17Plus from .S17_Plus import CGMinerS17Plus
from .S17_Pro import CGMinerS17Pro from .S17_Pro import CGMinerS17Pro
from .S17e import CGMinerS17e from .S17e import CGMinerS17e
from .T17 import CGMinerT17 from .T17 import CGMinerT17
from .T17_Plus import CGMinerT17Plus from .T17_Plus import CGMinerT17Plus
from .T17e import CGMinerT17e from .T17e import CGMinerT17e

View File

@@ -14,8 +14,6 @@
from .S19 import CGMinerS19 from .S19 import CGMinerS19
from .S19_Pro import CGMinerS19Pro from .S19_Pro import CGMinerS19Pro
from .S19j import CGMinerS19j from .S19j import CGMinerS19j
from .S19j_Pro import CGMinerS19jPro from .S19j_Pro import CGMinerS19jPro
from .T19 import CGMinerT19 from .T19 import CGMinerT19

View File

@@ -12,10 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from pyasic.data import HashBoard, MinerData
from pyasic.miners._backends import Hiveon # noqa - Ignore access to _module from pyasic.miners._backends import Hiveon # noqa - Ignore access to _module
from pyasic.miners._types import T9 # noqa - Ignore access to _module from pyasic.miners._types import T9 # noqa - Ignore access to _module
from pyasic.data import MinerData, HashBoard
from pyasic.settings import PyasicSettings from pyasic.settings import PyasicSettings

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .A10X import CGMinerA10X
from pyasic.miners._types import Avalon1026 # noqa - Ignore access to _module from pyasic.miners._types import Avalon1026 # noqa - Ignore access to _module
from .A10X import CGMinerA10X
class CGMinerAvalon1026(CGMinerA10X, Avalon1026): class CGMinerAvalon1026(CGMinerA10X, Avalon1026):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .A10X import CGMinerA10X
from pyasic.miners._types import Avalon1047 # noqa - Ignore access to _module from pyasic.miners._types import Avalon1047 # noqa - Ignore access to _module
from .A10X import CGMinerA10X
class CGMinerAvalon1047(CGMinerA10X, Avalon1047): class CGMinerAvalon1047(CGMinerA10X, Avalon1047):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .A10X import CGMinerA10X
from pyasic.miners._types import Avalon1066 # noqa - Ignore access to _module from pyasic.miners._types import Avalon1066 # noqa - Ignore access to _module
from .A10X import CGMinerA10X
class CGMinerAvalon1066(CGMinerA10X, Avalon1066): class CGMinerAvalon1066(CGMinerA10X, Avalon1066):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,13 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from pyasic.miners._backends import CGMiner # noqa - Ignore access to _module
from pyasic.data import MinerData, HashBoard
from pyasic.settings import PyasicSettings
import re
from pyasic.config import MinerConfig
import logging import logging
import re
from pyasic.config import MinerConfig
from pyasic.data import HashBoard, MinerData
from pyasic.miners._backends import CGMiner # noqa - Ignore access to _module
from pyasic.settings import PyasicSettings
class CGMinerA10X(CGMiner): class CGMinerA10X(CGMiner):

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .A7X import CGMinerA7X # noqa - Ignore access to _module
from pyasic.miners._types import Avalon721 # noqa - Ignore access to _module from pyasic.miners._types import Avalon721 # noqa - Ignore access to _module
from .A7X import CGMinerA7X # noqa - Ignore access to _module
class CGMinerAvalon721(CGMinerA7X, Avalon721): class CGMinerAvalon721(CGMinerA7X, Avalon721):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .A7X import CGMinerA7X # noqa - Ignore access to _module
from pyasic.miners._types import Avalon741 # noqa - Ignore access to _module from pyasic.miners._types import Avalon741 # noqa - Ignore access to _module
from .A7X import CGMinerA7X # noqa - Ignore access to _module
class CGMinerAvalon741(CGMinerA7X, Avalon741): class CGMinerAvalon741(CGMinerA7X, Avalon741):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .A7X import CGMinerA7X # noqa - Ignore access to _module
from pyasic.miners._types import Avalon761 # noqa - Ignore access to _module from pyasic.miners._types import Avalon761 # noqa - Ignore access to _module
from .A7X import CGMinerA7X # noqa - Ignore access to _module
class CGMinerAvalon761(CGMinerA7X, Avalon761): class CGMinerAvalon761(CGMinerA7X, Avalon761):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,13 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from pyasic.miners._backends import CGMiner # noqa - Ignore access to _module
from pyasic.data import MinerData, HashBoard
from pyasic.settings import PyasicSettings
import re
from pyasic.config import MinerConfig
import logging import logging
import re
from pyasic.config import MinerConfig
from pyasic.data import HashBoard, MinerData
from pyasic.miners._backends import CGMiner # noqa - Ignore access to _module
from pyasic.settings import PyasicSettings
class CGMinerA7X(CGMiner): class CGMinerA7X(CGMiner):

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .A8X import CGMinerA8X # noqa - Ignore access to _module
from pyasic.miners._types import Avalon821 # noqa - Ignore access to _module from pyasic.miners._types import Avalon821 # noqa - Ignore access to _module
from .A8X import CGMinerA8X # noqa - Ignore access to _module
class CGMinerAvalon821(CGMinerA8X, Avalon821): class CGMinerAvalon821(CGMinerA8X, Avalon821):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .A8X import CGMinerA8X # noqa - Ignore access to _module
from pyasic.miners._types import Avalon841 # noqa - Ignore access to _module from pyasic.miners._types import Avalon841 # noqa - Ignore access to _module
from .A8X import CGMinerA8X # noqa - Ignore access to _module
class CGMinerAvalon841(CGMinerA8X, Avalon841): class CGMinerAvalon841(CGMinerA8X, Avalon841):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .A8X import CGMinerA8X # noqa - Ignore access to _module
from pyasic.miners._types import Avalon851 # noqa - Ignore access to _module from pyasic.miners._types import Avalon851 # noqa - Ignore access to _module
from .A8X import CGMinerA8X # noqa - Ignore access to _module
class CGMinerAvalon851(CGMinerA8X, Avalon851): class CGMinerAvalon851(CGMinerA8X, Avalon851):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:

View File

@@ -12,13 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from pyasic.miners._backends import CGMiner # noqa - Ignore access to _module
from pyasic.data import MinerData, HashBoard
from pyasic.settings import PyasicSettings
import re
from pyasic.config import MinerConfig
import logging import logging
import re
from pyasic.config import MinerConfig
from pyasic.data import HashBoard, MinerData
from pyasic.miners._backends import CGMiner # noqa - Ignore access to _module
from pyasic.settings import PyasicSettings
class CGMinerA8X(CGMiner): class CGMinerA8X(CGMiner):

View File

@@ -12,14 +12,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import logging
import re
from pyasic.config import MinerConfig
from pyasic.data import HashBoard, MinerData
from pyasic.miners._backends import CGMiner # noqa - Ignore access to _module from pyasic.miners._backends import CGMiner # noqa - Ignore access to _module
from pyasic.miners._types import Avalon921 # noqa - Ignore access to _module from pyasic.miners._types import Avalon921 # noqa - Ignore access to _module
from pyasic.data import MinerData, HashBoard
from pyasic.settings import PyasicSettings from pyasic.settings import PyasicSettings
import re
from pyasic.config import MinerConfig
import logging
class CGMinerAvalon921(CGMiner, Avalon921): class CGMinerAvalon921(CGMiner, Avalon921):

View File

@@ -12,20 +12,21 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import asyncssh
import logging
import ipaddress import ipaddress
import logging
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from typing import TypeVar, List, Union from typing import List, TypeVar, Union
import asyncssh
from pyasic.data import MinerData
from pyasic.config import MinerConfig from pyasic.config import MinerConfig
from pyasic.data import MinerData
from pyasic.data.error_codes import ( from pyasic.data.error_codes import (
WhatsminerError,
BraiinsOSError, BraiinsOSError,
InnosiliconError, InnosiliconError,
X19Error,
MinerErrorData, MinerErrorData,
WhatsminerError,
X19Error,
) )

View File

@@ -12,18 +12,19 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from pyasic.miners._backends import CGMiner # noqa - Ignore access to _module import logging
from pyasic.miners._types import InnosiliconT3HPlus # noqa - Ignore access to _module import warnings
from pyasic.data import MinerData, HashBoard from typing import List, Union
from pyasic.data.error_codes import InnosiliconError, MinerErrorData
from pyasic.settings import PyasicSettings
from pyasic.config import MinerConfig
from pyasic.errors import APIError
import httpx import httpx
import warnings
from typing import Union, List from pyasic.config import MinerConfig
import logging from pyasic.data import HashBoard, MinerData
from pyasic.data.error_codes import InnosiliconError, MinerErrorData
from pyasic.errors import APIError
from pyasic.miners._backends import CGMiner # noqa - Ignore access to _module
from pyasic.miners._types import InnosiliconT3HPlus # noqa - Ignore access to _module
from pyasic.settings import PyasicSettings
class CGMinerInnosiliconT3HPlus(CGMiner, InnosiliconT3HPlus): class CGMinerInnosiliconT3HPlus(CGMiner, InnosiliconT3HPlus):

View File

@@ -12,38 +12,32 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from typing import Tuple, List, Union
from collections.abc import AsyncIterable
from pyasic.miners.base import AnyMiner
import httpx
from pyasic.miners.antminer import *
from pyasic.miners.avalonminer import *
from pyasic.miners.whatsminer import *
from pyasic.miners.innosilicon import *
from pyasic.miners._backends.cgminer import CGMiner # noqa - Ignore _module import
from pyasic.miners._backends.bmminer import BMMiner # noqa - Ignore _module import
from pyasic.miners._backends.bosminer import BOSMiner # noqa - Ignore _module import
from pyasic.miners._backends.btminer import BTMiner # noqa - Ignore _module import
from pyasic.miners._backends.bosminer_old import ( # noqa - Ignore _module import
BOSMinerOld,
)
from pyasic.miners.unknown import UnknownMiner
from pyasic.errors import APIError
from pyasic.misc import Singleton
import asyncio import asyncio
import ipaddress import ipaddress
import json import json
import logging import logging
from collections.abc import AsyncIterable
from pyasic.settings import PyasicSettings from typing import List, Tuple, Union
import asyncssh import asyncssh
import httpx
from pyasic.errors import APIError
from pyasic.miners._backends.bmminer import BMMiner # noqa - Ignore _module import
from pyasic.miners._backends.bosminer import BOSMiner # noqa - Ignore _module import
from pyasic.miners._backends.bosminer_old import ( # noqa - Ignore _module import
BOSMinerOld,
)
from pyasic.miners._backends.btminer import BTMiner # noqa - Ignore _module import
from pyasic.miners._backends.cgminer import CGMiner # noqa - Ignore _module import
from pyasic.miners.antminer import *
from pyasic.miners.avalonminer import *
from pyasic.miners.base import AnyMiner
from pyasic.miners.innosilicon import *
from pyasic.miners.unknown import UnknownMiner
from pyasic.miners.whatsminer import *
from pyasic.misc import Singleton
from pyasic.settings import PyasicSettings
MINER_CLASSES = { MINER_CLASSES = {
"ANTMINER S9": { "ANTMINER S9": {
@@ -343,7 +337,6 @@ class MinerFactory(metaclass=Singleton):
break break
except asyncio.TimeoutError: except asyncio.TimeoutError:
logging.warning(f"{ip}: Get Miner Timed Out") logging.warning(f"{ip}: Get Miner Timed Out")
miner = self._select_miner_from_classes(ip, model, api, ver) miner = self._select_miner_from_classes(ip, model, api, ver)
# save the miner to the cache at its IP if its not unknown # save the miner to the cache at its IP if its not unknown
@@ -439,6 +432,15 @@ class MinerFactory(metaclass=Singleton):
# if we have devdetails, we can get model data from there # if we have devdetails, we can get model data from there
if devdetails: if devdetails:
try:
if devdetails[0]["STATUS"][0]["Msg"]:
model = await self.__get_model_from_graphql(ip)
if model:
api = "BOSMiner+"
return model, api, ver
except (KeyError, TypeError, ValueError, IndexError):
pass
for _devdetails_key in ["Model", "Driver"]: for _devdetails_key in ["Model", "Driver"]:
try: try:
model = devdetails["DEVDETAILS"][0][_devdetails_key].upper() model = devdetails["DEVDETAILS"][0][_devdetails_key].upper()
@@ -455,6 +457,14 @@ class MinerFactory(metaclass=Singleton):
# if we have version we can get API type from here # if we have version we can get API type from here
if version: if version:
try:
if version[0]["STATUS"][0]["Msg"]:
model = await self.__get_model_from_graphql(ip)
if model:
api = "BOSMiner+"
return model, api, ver
except (KeyError, TypeError, ValueError, IndexError):
pass
if "VERSION" in version: if "VERSION" in version:
api_types = ["BMMiner", "CGMiner", "BTMiner"] api_types = ["BMMiner", "CGMiner", "BTMiner"]
# check basic API types, BOSMiner needs a special check # check basic API types, BOSMiner needs a special check
@@ -470,6 +480,8 @@ class MinerFactory(metaclass=Singleton):
api = "BOSMiner+" api = "BOSMiner+"
if "BOSminer+" in version["VERSION"][0]: if "BOSminer+" in version["VERSION"][0]:
api = "BOSMiner+" api = "BOSMiner+"
if any("BOSer" in string for string in version["VERSION"][0]):
api = "BOSMiner+"
# check for avalonminers # check for avalonminers
for _version_key in ["PROD", "MODEL"]: for _version_key in ["PROD", "MODEL"]:
@@ -546,6 +558,11 @@ class MinerFactory(metaclass=Singleton):
# validate success # validate success
validation = await self._validate_command(data) validation = await self._validate_command(data)
if not validation[0]: if not validation[0]:
try:
if data["version"][0]["STATUS"][0]["Msg"] == "Disconnected":
return data["devdetails"], data["version"]
except KeyError:
pass
raise APIError(validation[1]) raise APIError(validation[1])
# copy each part of the main command to devdetails and version # copy each part of the main command to devdetails and version
devdetails = data["devdetails"][0] devdetails = data["devdetails"][0]
@@ -593,6 +610,16 @@ class MinerFactory(metaclass=Singleton):
model = "ANTMINER S17" model = "ANTMINER S17"
return model return model
@staticmethod
async def __get_model_from_graphql(ip: ipaddress.ip_address) -> Union[str, None]:
model = None
url = f"http://{ip}/graphql"
async with httpx.AsyncClient() as client:
d = await client.post(url, json={"query": "{bosminer {info{modelName}}}"})
if d.status_code == 200:
model = (d.json()["data"]["bosminer"]["info"]["modelName"]).upper()
return model
@staticmethod @staticmethod
async def __get_system_info_from_web(ip) -> dict: async def __get_system_info_from_web(ip) -> dict:
url = f"http://{ip}/cgi-bin/get_system_info.cgi" url = f"http://{ip}/cgi-bin/get_system_info.cgi"

View File

@@ -15,10 +15,10 @@
from typing import List from typing import List
from pyasic.API.unknown import UnknownAPI from pyasic.API.unknown import UnknownAPI
from pyasic.miners.base import BaseMiner
from pyasic.config import MinerConfig from pyasic.config import MinerConfig
from pyasic.data import MinerData from pyasic.data import MinerData
from pyasic.data.error_codes import MinerErrorData from pyasic.data.error_codes import MinerErrorData
from pyasic.miners.base import BaseMiner
class UnknownMiner(BaseMiner): class UnknownMiner(BaseMiner):

View File

@@ -13,10 +13,7 @@
# limitations under the License. # limitations under the License.
from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module
from pyasic.miners._types import ( # noqa - Ignore access to _module from pyasic.miners._types import M20, M20V10 # noqa - Ignore access to _module
M20,
M20V10,
)
class BTMinerM20(BTMiner, M20): class BTMinerM20(BTMiner, M20):

View File

@@ -13,11 +13,11 @@
# limitations under the License. # limitations under the License.
from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module
from pyasic.miners._types import ( from pyasic.miners._types import ( # noqa - Ignore access to _module
M21S, M21S,
M21SV20, M21SV20,
M21SV60, M21SV60,
) # noqa - Ignore access to _module )
class BTMinerM21S(BTMiner, M21S): class BTMinerM21S(BTMiner, M21S):

View File

@@ -15,7 +15,6 @@
from .M20 import BTMinerM20, BTMinerM20V10 from .M20 import BTMinerM20, BTMinerM20V10
from .M20S import BTMinerM20S, BTMinerM20SV10, BTMinerM20SV20 from .M20S import BTMinerM20S, BTMinerM20SV10, BTMinerM20SV20
from .M20S_Plus import BTMinerM20SPlus from .M20S_Plus import BTMinerM20SPlus
from .M21 import BTMinerM21 from .M21 import BTMinerM21
from .M21S import BTMinerM21S, BTMinerM21SV20, BTMinerM21SV60 from .M21S import BTMinerM21S, BTMinerM21SV20, BTMinerM21SV60
from .M21S_Plus import BTMinerM21SPlus from .M21S_Plus import BTMinerM21SPlus

View File

@@ -13,13 +13,13 @@
# limitations under the License. # limitations under the License.
from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module
from pyasic.miners._types import ( from pyasic.miners._types import ( # noqa - Ignore access to _module
M30S, M30S,
M30SV50, M30SV50,
M30SVG20,
M30SVE20,
M30SVE10, M30SVE10,
) # noqa - Ignore access to _module M30SVE20,
M30SVG20,
)
class BTMinerM30S(BTMiner, M30S): class BTMinerM30S(BTMiner, M30S):

View File

@@ -13,12 +13,12 @@
# limitations under the License. # limitations under the License.
from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module
from pyasic.miners._types import ( from pyasic.miners._types import ( # noqa - Ignore access to _module
M30SPlus, M30SPlus,
M30SPlusVE40, M30SPlusVE40,
M30SPlusVF20, M30SPlusVF20,
M30SPlusVG60, M30SPlusVG60,
) # noqa - Ignore access to _module )
class BTMinerM30SPlus(BTMiner, M30SPlus): class BTMinerM30SPlus(BTMiner, M30SPlus):

View File

@@ -15,8 +15,8 @@
from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module
from pyasic.miners._types import ( # noqa - Ignore access to _module from pyasic.miners._types import ( # noqa - Ignore access to _module
M30SPlusPlus, M30SPlusPlus,
M30SPlusPlusVG40,
M30SPlusPlusVG30, M30SPlusPlusVG30,
M30SPlusPlusVG40,
M30SPlusPlusVH60, M30SPlusPlusVH60,
) )

View File

@@ -13,15 +13,15 @@
# limitations under the License. # limitations under the License.
from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module
from pyasic.miners._types import ( from pyasic.miners._types import ( # noqa - Ignore access to _module
M31SPlus, M31SPlus,
M31SPlusVE20,
M31SPlusV30, M31SPlusV30,
M31SPlusV40, M31SPlusV40,
M31SPlusV60, M31SPlusV60,
M31SPlusV80, M31SPlusV80,
M31SPlusV90, M31SPlusV90,
) # noqa - Ignore access to _module M31SPlusVE20,
)
class BTMinerM31SPlus(BTMiner, M31SPlus): class BTMinerM31SPlus(BTMiner, M31SPlus):

View File

@@ -13,9 +13,7 @@
# limitations under the License. # limitations under the License.
from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module
from pyasic.miners._types import ( from pyasic.miners._types import M32S # noqa - Ignore access to _module
M32S,
) # noqa - Ignore access to _module
class BTMinerM32S(BTMiner, M32S): class BTMinerM32S(BTMiner, M32S):

View File

@@ -13,10 +13,10 @@
# limitations under the License. # limitations under the License.
from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module
from pyasic.miners._types import ( from pyasic.miners._types import ( # noqa - Ignore access to _module
M34SPlus, M34SPlus,
M34SPlusVE10, M34SPlusVE10,
) # noqa - Ignore access to _module )
class BTMinerM34SPlus(BTMiner, M34SPlus): class BTMinerM34SPlus(BTMiner, M34SPlus):

View File

@@ -14,35 +14,33 @@
from .M30S import ( from .M30S import (
BTMinerM30S, BTMinerM30S,
BTMinerM30SV50,
BTMinerM30SVE10, BTMinerM30SVE10,
BTMinerM30SVE20, BTMinerM30SVE20,
BTMinerM30SVG20, BTMinerM30SVG20,
BTMinerM30SV50,
) )
from .M30S_Plus import ( from .M30S_Plus import (
BTMinerM30SPlus, BTMinerM30SPlus,
BTMinerM30SPlusVF20,
BTMinerM30SPlusVE40, BTMinerM30SPlusVE40,
BTMinerM30SPlusVF20,
BTMinerM30SPlusVG60, BTMinerM30SPlusVG60,
) )
from .M30S_Plus_Plus import ( from .M30S_Plus_Plus import (
BTMinerM30SPlusPlus, BTMinerM30SPlusPlus,
BTMinerM30SPlusPlusVG40,
BTMinerM30SPlusPlusVG30, BTMinerM30SPlusPlusVG30,
BTMinerM30SPlusPlusVG40,
BTMinerM30SPlusPlusVH60, BTMinerM30SPlusPlusVH60,
) )
from .M31S import BTMinerM31S from .M31S import BTMinerM31S
from .M31S_Plus import ( from .M31S_Plus import (
BTMinerM31SPlus, BTMinerM31SPlus,
BTMinerM31SPlusVE20,
BTMinerM31SPlusV30, BTMinerM31SPlusV30,
BTMinerM31SPlusV40, BTMinerM31SPlusV40,
BTMinerM31SPlusV60, BTMinerM31SPlusV60,
BTMinerM31SPlusV80, BTMinerM31SPlusV80,
BTMinerM31SPlusV90, BTMinerM31SPlusV90,
BTMinerM31SPlusVE20,
) )
from .M32 import BTMinerM32, BTMinerM32V20 from .M32 import BTMinerM32, BTMinerM32V20
from .M32S import BTMinerM32S from .M32S import BTMinerM32S
from .M34S_Plus import BTMinerM34SPlus, BTMinerM34SPlusVE10 from .M34S_Plus import BTMinerM34SPlus, BTMinerM34SPlusVE10

View File

@@ -12,7 +12,4 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .M50 import ( from .M50 import BTMinerM50, BTMinerM50VH50
BTMinerM50,
BTMinerM50VH50,
)

View File

@@ -12,13 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import ipaddress
import asyncio import asyncio
import ipaddress
import logging import logging
from typing import Union, List, AsyncIterator from typing import AsyncIterator, List, Union
from pyasic.miners.miner_factory import AnyMiner, MinerFactory
from pyasic.network.net_range import MinerNetworkRange from pyasic.network.net_range import MinerNetworkRange
from pyasic.miners.miner_factory import MinerFactory, AnyMiner
from pyasic.settings import PyasicSettings from pyasic.settings import PyasicSettings

View File

@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from typing import Union
import ipaddress import ipaddress
from typing import Union
class MinerNetworkRange: class MinerNetworkRange:

View File

@@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "pyasic" name = "pyasic"
version = "0.20.1" version = "0.21.9"
description = "A set of modules for interfacing with many common types of ASIC bitcoin miners, using both their API and SSH." description = "A set of modules for interfacing with many common types of ASIC bitcoin miners, using both their API and SSH."
authors = ["UpstreamData <brett@upstreamdata.ca>"] authors = ["UpstreamData <brett@upstreamdata.ca>"]
repository = "https://github.com/UpstreamData/pyasic" repository = "https://github.com/UpstreamData/pyasic"
@@ -20,6 +20,7 @@ optional = true
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
pre-commit = "^2.20.0" pre-commit = "^2.20.0"
isort = "^5.10.1"
[tool.poetry.group.docs] [tool.poetry.group.docs]
optional = true optional = true
@@ -32,3 +33,6 @@ mkdocstrings = {extras = ["python"], version = "^0.19.0"}
[build-system] [build-system]
requires = ["poetry-core>=1.0.0"] requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api" build-backend = "poetry.core.masonry.api"
[tool.isort]
profile = "black"

View File

@@ -13,9 +13,10 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
from tests.miners_tests import MinersTest, MinerFactoryTest
from tests.network_tests import NetworkTest
from tests.config_tests import ConfigTest from tests.config_tests import ConfigTest
from tests.miners_tests import MinerFactoryTest, MinersTest
from tests.network_tests import NetworkTest
if __name__ == "__main__": if __name__ == "__main__":
# `coverage run --source pyasic -m unittest discover` will give code coverage data # `coverage run --source pyasic -m unittest discover` will give code coverage data

View File

@@ -13,14 +13,15 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
from pyasic.config import MinerConfig, _PoolGroup, _Pool # noqa
from tests.test_data import ( from tests.test_data import (
bosminer_api_pools, bosminer_api_pools,
bosminer_config_pools,
x19_api_pools, x19_api_pools,
x19_web_pools, x19_web_pools,
bosminer_config_pools,
) )
from pyasic.config import MinerConfig, _Pool, _PoolGroup # noqa
class ConfigTest(unittest.TestCase): class ConfigTest(unittest.TestCase):
def setUp(self) -> None: def setUp(self) -> None:

View File

@@ -11,18 +11,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import unittest
from pyasic.miners.miner_factory import MINER_CLASSES
from pyasic.miners.base import BaseMiner
from pyasic.miners._backends import CGMiner
from pyasic.miners.miner_factory import MinerFactory
from pyasic.miners.miner_listener import MinerListener
import asyncio import asyncio
import inspect import inspect
import sys import sys
import unittest
from pyasic.miners._backends import CGMiner
from pyasic.miners.base import BaseMiner
from pyasic.miners.miner_factory import MINER_CLASSES, MinerFactory
from pyasic.miners.miner_listener import MinerListener
class MinersTest(unittest.TestCase): class MinersTest(unittest.TestCase):

View File

@@ -15,8 +15,8 @@
import ipaddress import ipaddress
import unittest import unittest
from pyasic.network.net_range import MinerNetworkRange
from pyasic.network import MinerNetwork from pyasic.network import MinerNetwork
from pyasic.network.net_range import MinerNetworkRange
class NetworkTest(unittest.TestCase): class NetworkTest(unittest.TestCase):