From 7e7cdc961515d13b6588f02c937c6f3fd4b84a95 Mon Sep 17 00:00:00 2001 From: Upstream Data Date: Wed, 4 Dec 2024 10:03:33 -0700 Subject: [PATCH] docs: fix some docstrings and type annotations --- pyasic/miners/backends/braiins_os.py | 4 ++-- pyasic/miners/backends/btminer.py | 2 +- pyasic/miners/base.py | 5 +++++ pyasic/rpc/btminer.py | 18 ++++++++++-------- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/pyasic/miners/backends/braiins_os.py b/pyasic/miners/backends/braiins_os.py index 254ca093..d82b9a73 100644 --- a/pyasic/miners/backends/braiins_os.py +++ b/pyasic/miners/backends/braiins_os.py @@ -623,7 +623,7 @@ class BOSMiner(BraiinsOSFirmware): pass return pools_data - async def upgrade_firmware(self, file: Path): + async def upgrade_firmware(self, file: Path) -> str: """ Upgrade the firmware of the BOSMiner device. @@ -631,7 +631,7 @@ class BOSMiner(BraiinsOSFirmware): file (Path): The local file path of the firmware to be uploaded. Returns: - str: Confirmation message after upgrading the firmware. + Confirmation message after upgrading the firmware. """ try: logging.info("Starting firmware upgrade process.") diff --git a/pyasic/miners/backends/btminer.py b/pyasic/miners/backends/btminer.py index be39cefb..0c15e683 100644 --- a/pyasic/miners/backends/btminer.py +++ b/pyasic/miners/backends/btminer.py @@ -692,7 +692,7 @@ class BTMiner(StockFirmware): pass return pools_data - async def upgrade_firmware(self, file: Path): + async def upgrade_firmware(self, file: Path) -> str: """ Upgrade the firmware of the Whatsminer device. diff --git a/pyasic/miners/base.py b/pyasic/miners/base.py index 1d8ca4e4..244dbe21 100644 --- a/pyasic/miners/base.py +++ b/pyasic/miners/base.py @@ -98,6 +98,11 @@ class MinerProtocol(Protocol): return self.rpc async def check_light(self) -> bool: + """Get the status of the fault light as a boolean. + + Returns: + A boolean value representing the fault light status. + """ return await self.get_fault_light() async def fault_light_on(self) -> bool: diff --git a/pyasic/rpc/btminer.py b/pyasic/rpc/btminer.py index 37114da8..d7e4f989 100644 --- a/pyasic/rpc/btminer.py +++ b/pyasic/rpc/btminer.py @@ -560,17 +560,21 @@ class BTMinerRPCAPI(BaseMinerRPCAPI): """ return await self.send_privileged_command("set_normal_power") - async def update_firmware(self, firmware: bytes): + async def update_firmware(self, firmware: bytes) -> bool: """Upgrade the firmware running on the miner and using the firmware passed in bytes. +
+ Expand + + Set the LED on the miner using the API, only works after + changing the password of the miner using the Whatsminer tool. Parameters: firmware (bytes): The firmware binary data to be uploaded. - Returns: - bool: A boolean indicating the success of the firmware upgrade. - + A boolean indicating the success of the firmware upgrade. Raises: APIError: If the miner is not ready for firmware update. +
""" ready = await self.send_privileged_command("upgrade_firmware") if not ready.get("Msg") == "ready": @@ -796,10 +800,8 @@ class BTMinerRPCAPI(BaseMinerRPCAPI): Parameters: complete: check whether pre power on is complete. - msg: ## the message to check. - * `wait for adjust temp` - * `adjust complete` - * `adjust continue` + msg: the message to check. + Returns: A reply informing of the status of pre power on.