Skip to content

Commit 9654088

Browse files
committed
Added inline comment to hook purpose and fixed style issue with unused dictionary key.
1 parent 0afaf2a commit 9654088

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

app/api/v2/managers/operation_api_manager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,11 @@ async def create_potential_link(self, operation_id: str, data: dict, access: Bas
100100
raise JsonHttpBadRequest(f'Agent {agent.paw} missing specified executor')
101101
executor = self.build_executor(data=data.pop('executor', {}), agent=agent)
102102
ability = self.build_ability(data=data.pop('ability', {}), executor=executor)
103-
for hook, fcall in executor.HOOKS.items():
103+
"""This dictionary provides plugins a way to hook into abilities at runtime"""
104+
for _hook, fcall in executor.HOOKS.items():
104105
await fcall(ability, executor)
105106
encoded_command = self._encode_string(agent.replace(self._encode_string(data['executor']['command']),
106-
file_svc=self.services['file_svc']))
107+
file_svc=self.services['file_svc']))
107108
link = Link.load(dict(command=encoded_command, plaintext_command=encoded_command, paw=agent.paw, ability=ability, executor=executor,
108109
status=operation.link_status(), score=data.get('score', 0), jitter=data.get('jitter', 0),
109110
cleanup=data.get('cleanup', 0), pin=data.get('pin', 0),

app/service/planning_svc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ async def _generate_new_links(self, operation, agent, abilities, link_status):
351351
executor = await agent.get_preferred_executor(ability)
352352
if not executor:
353353
continue
354-
355-
for hook, fcall in executor.HOOKS.items():
354+
"""This dictionary provides plugins a way to hook into abilities at runtime"""
355+
for _hook, fcall in executor.HOOKS.items():
356356
await fcall(ability, executor)
357357
if executor.command:
358358
link = Link.load(dict(command=self.encode_string(executor.test), paw=agent.paw, score=0,

0 commit comments

Comments
 (0)