clean code style

This commit is contained in:
Vadym Melnychuk 2023-07-24 18:02:00 +03:00
parent bab8bce804
commit 59943f1d4d

View File

@ -281,8 +281,7 @@ class HonAppliance:
self, self,
main: str, main: str,
target: Optional[List[str] | str] = None, target: Optional[List[str] | str] = None,
mandatory_only: bool = False, to_sync: Optional[List[str] | bool] = None,
target_parameters: Optional[List[str]] = None,
) -> None: ) -> None:
base: Optional[HonCommand] = self.commands.get(main) base: Optional[HonCommand] = self.commands.get(main)
if not base: if not base:
@ -294,13 +293,11 @@ class HonAppliance:
for name, target_param in data.parameters.items(): for name, target_param in data.parameters.items():
if not (base_param := base.parameters.get(name)): if not (base_param := base.parameters.get(name)):
continue continue
if to_sync and (
if mandatory_only and not target_param.mandatory: (isinstance(to_sync, list) and name not in to_sync)
or not target_param.mandatory
):
continue continue
if target_parameters and name not in target_parameters:
continue
self.sync_parameter(base_param, target_param) self.sync_parameter(base_param, target_param)
def sync_parameter(self, main: Parameter, target: Parameter) -> None: def sync_parameter(self, main: Parameter, target: Parameter) -> None: