docs: fix some docstrings and type annotations

This commit is contained in:
Upstream Data
2024-12-04 10:03:33 -07:00
parent b6fb0fd2b9
commit 7e7cdc9615
4 changed files with 18 additions and 11 deletions

View File

@@ -623,7 +623,7 @@ class BOSMiner(BraiinsOSFirmware):
pass pass
return pools_data 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. 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. file (Path): The local file path of the firmware to be uploaded.
Returns: Returns:
str: Confirmation message after upgrading the firmware. Confirmation message after upgrading the firmware.
""" """
try: try:
logging.info("Starting firmware upgrade process.") logging.info("Starting firmware upgrade process.")

View File

@@ -692,7 +692,7 @@ class BTMiner(StockFirmware):
pass pass
return pools_data 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. Upgrade the firmware of the Whatsminer device.

View File

@@ -98,6 +98,11 @@ class MinerProtocol(Protocol):
return self.rpc return self.rpc
async def check_light(self) -> bool: 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() return await self.get_fault_light()
async def fault_light_on(self) -> bool: async def fault_light_on(self) -> bool:

View File

@@ -560,17 +560,21 @@ class BTMinerRPCAPI(BaseMinerRPCAPI):
""" """
return await self.send_privileged_command("set_normal_power") 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. """Upgrade the firmware running on the miner and using the firmware passed in bytes.
<details>
<summary>Expand</summary>
Set the LED on the miner using the API, only works after
changing the password of the miner using the Whatsminer tool.
Parameters: Parameters:
firmware (bytes): The firmware binary data to be uploaded. firmware (bytes): The firmware binary data to be uploaded.
Returns: Returns:
bool: A boolean indicating the success of the firmware upgrade. A boolean indicating the success of the firmware upgrade.
Raises: Raises:
APIError: If the miner is not ready for firmware update. APIError: If the miner is not ready for firmware update.
</details>
""" """
ready = await self.send_privileged_command("upgrade_firmware") ready = await self.send_privileged_command("upgrade_firmware")
if not ready.get("Msg") == "ready": if not ready.get("Msg") == "ready":
@@ -796,10 +800,8 @@ class BTMinerRPCAPI(BaseMinerRPCAPI):
Parameters: Parameters:
complete: check whether pre power on is complete. complete: check whether pre power on is complete.
msg: ## the message to check. msg: the message to check.
* `wait for adjust temp`
* `adjust complete`
* `adjust continue`
Returns: Returns:
A reply informing of the status of pre power on. A reply informing of the status of pre power on.
</details> </details>