EventHandler should normalize entities into iterable type
Open
@wjwwood is already working on this.
Since Mar 6, 2025.
- Dominant language
- Python
- Stars
- 155
- Forks
- 182
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 6
Description
The problem
In above code, entities: Optional[SomeEntitiesType] = None, entities is marked as SomeEntitiesType. It is not normalized in the __init__ function. In the describe function below, it is used as an iterable actions.extend(self.entities).
Besides, noting that in ExecuteLocal, entities is set to a single LaunchDescriptionEntity many times:
EventHandler(
matcher=lambda event: is_a_subclass(event, SignalProcess),
entities=OpaqueFunction(function=self.__on_signal_process_event),
)
Proposed fix
I plan to fix this by always making the __entities member an iterable (if not None):
if isinstance(entities, LaunchDescriptionEntity):
self.__entities = (entities,)
else:
self.__entities = entities
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.