mirror of
https://github.com/Andre0512/pyhOn.git
synced 2025-05-18 00:54:25 -04:00
Add more type hints
This commit is contained in:
parent
ad0d065b03
commit
9eb99f283b
30 changed files with 392 additions and 243 deletions
|
@ -1,15 +1,25 @@
|
|||
from typing import Dict, Any, TYPE_CHECKING
|
||||
|
||||
from pyhon.parameter.program import HonParameterProgram
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pyhon.appliance import HonAppliance
|
||||
|
||||
|
||||
class ApplianceBase:
|
||||
def __init__(self, appliance):
|
||||
def __init__(self, appliance: "HonAppliance"):
|
||||
self.parent = appliance
|
||||
|
||||
def attributes(self, data):
|
||||
def attributes(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
||||
program_name = "No Program"
|
||||
if program := int(str(data.get("parameters", {}).get("prCode", "0"))):
|
||||
if start_cmd := self.parent.settings.get("startProgram.program"):
|
||||
if ids := start_cmd.ids:
|
||||
if isinstance(start_cmd, HonParameterProgram) and (
|
||||
ids := start_cmd.ids
|
||||
):
|
||||
program_name = ids.get(program, program_name)
|
||||
data["programName"] = program_name
|
||||
return data
|
||||
|
||||
def settings(self, settings):
|
||||
def settings(self, settings: Dict[str, Any]) -> Dict[str, Any]:
|
||||
return settings
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue