From 965408859db9f29415432da156a76def625d93b7 Mon Sep 17 00:00:00 2001 From: Blaine Jeffries Date: Wed, 18 Dec 2024 20:16:11 +0000 Subject: [PATCH] Added inline comment to hook purpose and fixed style issue with unused dictionary key. --- app/api/v2/managers/operation_api_manager.py | 5 +++-- app/service/planning_svc.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/api/v2/managers/operation_api_manager.py b/app/api/v2/managers/operation_api_manager.py index e08ee9a8d..f30c4b85e 100644 --- a/app/api/v2/managers/operation_api_manager.py +++ b/app/api/v2/managers/operation_api_manager.py @@ -100,10 +100,11 @@ async def create_potential_link(self, operation_id: str, data: dict, access: Bas raise JsonHttpBadRequest(f'Agent {agent.paw} missing specified executor') executor = self.build_executor(data=data.pop('executor', {}), agent=agent) ability = self.build_ability(data=data.pop('ability', {}), executor=executor) - for hook, fcall in executor.HOOKS.items(): + """This dictionary provides plugins a way to hook into abilities at runtime""" + for _hook, fcall in executor.HOOKS.items(): await fcall(ability, executor) encoded_command = self._encode_string(agent.replace(self._encode_string(data['executor']['command']), - file_svc=self.services['file_svc'])) + file_svc=self.services['file_svc'])) link = Link.load(dict(command=encoded_command, plaintext_command=encoded_command, paw=agent.paw, ability=ability, executor=executor, status=operation.link_status(), score=data.get('score', 0), jitter=data.get('jitter', 0), cleanup=data.get('cleanup', 0), pin=data.get('pin', 0), diff --git a/app/service/planning_svc.py b/app/service/planning_svc.py index 5a71cfc07..755ff2da5 100644 --- a/app/service/planning_svc.py +++ b/app/service/planning_svc.py @@ -351,8 +351,8 @@ async def _generate_new_links(self, operation, agent, abilities, link_status): executor = await agent.get_preferred_executor(ability) if not executor: continue - - for hook, fcall in executor.HOOKS.items(): + """This dictionary provides plugins a way to hook into abilities at runtime""" + for _hook, fcall in executor.HOOKS.items(): await fcall(ability, executor) if executor.command: link = Link.load(dict(command=self.encode_string(executor.test), paw=agent.paw, score=0,