Repository: Avaiga/taipy
File: taipy/core/notification/notifier.py (Python)

Code before:
        entity_type=entity_type,
        operation=operation,
        attribute_name=attribute_name,
        attribute_value=attribute_value,
        metadata=kwargs,
    )
    Notifier.publish(event)


class Notifier:
    """A class for managing event registrations and publishing `Core^` service events."""

    _topics_registrations_list: Dict[_Topic, Set[_Registration]] = {}

    @classmethod
    def register(
        cls,
        entity_type: Optional[EventEntityType] = None,
        entity_id: Optional[str] = None,
        operation: Optional[EventOperation] = None,
        attribute_name: Optional[str] = None,
    ) -> Tuple[str, SimpleQueue]:
        """Register a listener for a specific event topic.

        The topic is defined by the combination of the entity type, the entity id,
        the operation and the attribute name.

        Example usage:

        ```python
        registration_id, registered_queue = Notifier.register(
            entity_type=EventEntityType.CYCLE,
            entity_id="CYCLE_cycle_1",
            operation=EventOperation.CREATION
        )
        ```

        Parameters:
            entity_type (Optional[EventEntityType^]): If provided, the listener will
                be notified for all events related to this entity type. Otherwise,
                the listener will be notified for events related to all entity types.
                <br>
                The possible entity type values are defined in the `EventEntityType^`
                enum. The possible values are:
                <ul>
                    <li>CYCLE</li>
                    <li>SCENARIO</li>
                    <li>SEQUENCE</li>
                    <li>TASK</li>
                    <li>DATA_NODE</li>
                    <li>JOB</li>

Review comment (bug):
```suggestion
        The topic is defined by the combination of an optional entity type, an optional 
        entity id, an optional operation, and an optional attribute name. The purpose is
        to be as flexible as possible. For example, we can register to:
        
        - All scenario creations
        - A specific data node update
        - A sequence submission
        - A Scenario deletion
        - Job failures
```

Code after:
        entity_type=entity_type,
        operation=operation,
        attribute_name=attribute_name,
        attribute_value=attribute_value,
        metadata=kwargs,
    )
    Notifier.publish(event)


class Notifier:
    """A class for managing event registrations and publishing `Core^` service events."""

    _topics_registrations_list: Dict[_Topic, Set[_Registration]] = {}

    @classmethod
    def register(
        cls,
        entity_type: Optional[EventEntityType] = None,
        entity_id: Optional[str] = None,
        operation: Optional[EventOperation] = None,
        attribute_name: Optional[str] = None,
    ) -> Tuple[str, SimpleQueue]:
        """Register a listener for a specific event topic.

        The topic is defined by the combination of an optional entity type, an optional
        entity id, an optional operation, and an optional attribute name. The purpose is
        to be as flexible as possible. For example, we can register to:

        - All scenario creations
        - A specific data node update
        - A sequence submission
        - A Scenario deletion
        - Job failures

        Example usage:

        ```python
        registration_id, registered_queue = Notifier.register(
            entity_type=EventEntityType.SCENARIO,
            operation=EventOperation.CREATION
        )
        ```

        Parameters:
            entity_type (Optional[EventEntityType^]): If provided, the listener will
                be notified for all events related to this entity type. Otherwise,
                the listener will be notified for events related to all entity types.
                <br>
                The possible entity type values are defined in the `EventEntityType^`
                enum. The possible values are:
                <ul>