Formatted with Ruff
This commit is contained in:
parent
27aec769a2
commit
9fd8fc37f1
19 changed files with 680 additions and 392 deletions
|
|
@ -3,12 +3,14 @@ OpenFlexure Microscope system control Thing
|
|||
|
||||
This module defines a Thing that can shut down or restart the host computer.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import os
|
||||
from labthings_fastapi.thing import Thing
|
||||
from labthings_fastapi.decorators import thing_action, thing_property
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class CommandOutput(BaseModel):
|
||||
output: str
|
||||
error: str
|
||||
|
|
@ -16,7 +18,7 @@ class CommandOutput(BaseModel):
|
|||
|
||||
class SystemControlThing(Thing):
|
||||
"""
|
||||
Attempt to shutdown the device
|
||||
Attempt to shutdown the device
|
||||
"""
|
||||
|
||||
@thing_action
|
||||
|
|
@ -39,7 +41,7 @@ class SystemControlThing(Thing):
|
|||
Checks if we are running on a Raspberry Pi.
|
||||
"""
|
||||
return os.path.exists("/usr/bin/raspi-config")
|
||||
|
||||
|
||||
@thing_action
|
||||
def reboot(self) -> CommandOutput:
|
||||
"""Attempt to reboot the device"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue