Skip to content

Typed self.on for charm objects #2412

@dimaqq

Description

@dimaqq

So that the charmers don't have to write:

https://github.com/canonical/git-integrator/blob/e2ae8dbcf59c0990a9839f3061f297b76bb74807/lib/charms/git_integrator/v0/git.py#L309-L314


class GitRequirerEventHandler(data_interfaces.EventHandlers, typing.Generic[TGitProviderModel]):
    """Event Handler for Git requirer."""

    on = GitProvidesEvents[TGitProviderModel]()

...

    def on_foo(self, ...):
        getattr(self.on, "git_connection_information_updated").emit(
            relation,
            app=relation.app,
            unit=remote_unit,
            content=content,
        )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions