Skip to content

Commit

Permalink
fix: correct the signature of .events() (#1342)
Browse files Browse the repository at this point in the history
Fixes #1341
  • Loading branch information
PietroPasotti committed Aug 26, 2024
1 parent a0b1480 commit 7969187
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ops/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def _event_kinds(self) -> List[str]:
event_kinds.append(attr_name)
return event_kinds

def events(self) -> Dict[str, EventSource]:
def events(self) -> Dict[str, BoundEvent]:
"""Return a mapping of event_kinds to bound_events for all available events."""
return {event_kind: getattr(self, event_kind) for event_kind in self._event_kinds()}

Expand Down
4 changes: 2 additions & 2 deletions ops/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _exe_path(path: Path) -> Optional[Path]:

def _create_event_link(
charm: 'ops.charm.CharmBase',
bound_event: 'ops.framework.EventSource',
bound_event: 'ops.framework.BoundEvent',
link_to: Union[str, Path],
):
"""Create a symlink for a particular event.
Expand All @@ -66,7 +66,7 @@ def _create_event_link(
link_to: What the event link should point to
"""
# type guard
assert bound_event.event_kind, f'unbound EventSource {bound_event}'
assert bound_event.event_kind, f'unbound BoundEvent {bound_event}'

if issubclass(bound_event.event_type, ops.charm.HookEvent):
event_dir = charm.framework.charm_dir / 'hooks'
Expand Down

0 comments on commit 7969187

Please sign in to comment.