Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type annotate PebbleReadyEvent.workload #962

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions ops/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,13 +637,15 @@ class WorkloadEvent(HookEvent):

Workload events are generated for all containers that the charm
expects in metadata. Workload containers currently only trigger
a PebbleReadyEvent.
a :class:`PebbleReadyEvent`.
"""

workload: 'Container'
"""The workload involved in this event.

Attributes:
workload: The :class:`~ops.model.Container` involved in this event.
Workload currently only can be a Container but in future may
be other types that represent the specific workload type e.g.
a Machine.
Workload currently only can be a :class:`Container <model.Container>`, but
in future may be other types that represent the specific workload type,
for example a machine.
"""

def __init__(self, handle: 'Handle', workload: 'Container'):
Expand All @@ -670,7 +672,7 @@ def restore(self, snapshot: Dict[str, Any]):
if container_name:
self.workload = self.framework.model.unit.get_container(container_name)
else:
self.workload = None
self.workload = None # type: ignore


class PebbleReadyEvent(WorkloadEvent):
Expand Down