mirror of
https://github.com/Andre0512/pyhOn.git
synced 2025-05-13 14:44:28 -04:00
Fix performance issues
This commit is contained in:
parent
dd61b24eed
commit
22cbd7474a
4 changed files with 29 additions and 22 deletions
|
@ -29,6 +29,7 @@ class HonCommand:
|
|||
self._protocol_type: str = attributes.pop("protocolType", "")
|
||||
self._parameters: Dict[str, HonParameter] = {}
|
||||
self._data: Dict[str, Any] = {}
|
||||
self._available_settings: Dict[str, HonParameter] = {}
|
||||
self._load_parameters(attributes)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
|
@ -46,6 +47,10 @@ class HonCommand:
|
|||
def parameters(self) -> Dict[str, HonParameter]:
|
||||
return self._parameters
|
||||
|
||||
@property
|
||||
def settings(self) -> Dict[str, HonParameter]:
|
||||
return self._parameters
|
||||
|
||||
@property
|
||||
def parameter_groups(self) -> Dict[str, Dict[str, Union[str, float]]]:
|
||||
result: Dict[str, Dict[str, Union[str, float]]] = {}
|
||||
|
@ -76,10 +81,8 @@ class HonCommand:
|
|||
self._data[name] = data
|
||||
return
|
||||
if self._category_name:
|
||||
if not self._categories:
|
||||
self._parameters["program"] = HonParameterProgram(
|
||||
"program", self, "custom"
|
||||
)
|
||||
name = "program" if "PROGRAM" in self._category_name else "category"
|
||||
self._parameters[name] = HonParameterProgram(name, self, "custom")
|
||||
|
||||
async def send(self) -> bool:
|
||||
params = self.parameter_groups["parameters"]
|
||||
|
@ -119,7 +122,7 @@ class HonCommand:
|
|||
return first
|
||||
|
||||
@property
|
||||
def settings(self) -> Dict[str, HonParameter]:
|
||||
def available_settings(self) -> Dict[str, HonParameter]:
|
||||
result: Dict[str, HonParameter] = {}
|
||||
for command in self.categories.values():
|
||||
for name, parameter in command.parameters.items():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue