HydroRoll-Team / HydroRoll-Team/HydroRollCore
[TODO]: builtin hook function in every rules packages
- Dominant language
- Python
- Stars
- 5
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
[`14368`]__refactor:__ Comment hook function while running the rules packages
builtin hook function in every rules packages.
https://github.com/HydroRoll-Team/HydroRollCore/compare/fae8d2273dfa...14368e5a7bdc
```py3
try:
##########################################################
# @TODO: builtin hook function in every rules packages.
##########################################################
# for _rule in self.rules:
# for rule_enable_hook_func in self._rule_enable_hooks:
# await rule_enable_hook_func(_rule)
# try:
# await _rule.enable()
# except Exception as e:
# self.error_or_exception(
# f"Enable rule {_rule!r} failed:", e)
# for _rule in self.rules:
# for rule_run_hook_func in self._rule_run_hooks:
# await rule_run_hook_func(_rule)
# _rule_task = asyncio.create_task(_rule.safe_run())
# self._rule_tasks.add(_rule_task)
# _rule_task.add_done_callback(self._rule_tasks.discard)
await self.should_exit.wait()
if hot_reload_task is not None: # pragma: no cover
await hot_reload_task
finally:
# for _rule in self.rules:
# for rule_disable_hook_func in self._rule_disable_hooks:
# await rule_disable_hook_func(_rule)
# await _rule.disable()
```
### hook types
- rule_enable_hook_func
- rule_run_hook_func
- rule_disable_hook_func
Contributor guide
Assessment
This issue has not been assessed yet.