Update an existing event for the scan. This is the counterpart to :meth:`make_event` for modifying an existing :class:`bbot.core.event.base.BaseEvent` instance. Raises a validation error if the update could not be applied, unless ``raise_error`` is set to False.
(self, event, **kwargs)
| 538 | return event |
| 539 | |
| 540 | def update_event(self, event, **kwargs): |
| 541 | """Update an existing event for the scan. |
| 542 | |
| 543 | This is the counterpart to :meth:`make_event` for modifying an existing |
| 544 | :class:`bbot.core.event.base.BaseEvent` instance. |
| 545 | |
| 546 | Raises a validation error if the update could not be applied, unless |
| 547 | ``raise_error`` is set to False. |
| 548 | |
| 549 | Args: |
| 550 | event: The event object to update. |
| 551 | **kwargs: Keyword arguments to be passed to the scan's update_event method. |
| 552 | raise_error (bool, optional): Whether to raise a validation error if the event could not be updated. Defaults to False. |
| 553 | |
| 554 | Returns: |
| 555 | Event or None: The updated event, or None if a validation error occurred and raise_error was False. |
| 556 | |
| 557 | Raises: |
| 558 | ValidationError: If the event could not be validated and raise_error is True. |
| 559 | """ |
| 560 | raise_error = kwargs.pop("raise_error", False) |
| 561 | module = kwargs.pop("module", None) |
| 562 | if module is None and getattr(event, "module", None) is None: |
| 563 | kwargs["module"] = self |
| 564 | try: |
| 565 | updated = self.scan.update_event(event, **kwargs) |
| 566 | except ValidationError as e: |
| 567 | if raise_error: |
| 568 | raise |
| 569 | self.warning(f"{e}") |
| 570 | return |
| 571 | return updated |
| 572 | |
| 573 | async def emit_event(self, *args, **kwargs): |
| 574 | """Emit an event to the event queue and distribute it to interested modules. |
no test coverage detected