-
Notifications
You must be signed in to change notification settings - Fork 53
feat: MelleaSession.register for functional interface and MelleaSession.powerup for dynamic mixin (register all methods in a class) #224
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
feat: MelleaSession.register for functional interface and MelleaSession.powerup for dynamic mixin (register all methods in a class) #224
Conversation
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
98703d1 to
83b699a
Compare
jakelorocco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if these are just issues with my type-hinter / the default one in VSCode.
It may not be possible to dynamically create these methods while retaining basic intellisense and type hinting.
8923af3 to
6f64ff2
Compare
d5e5efd to
3155c9f
Compare
jakelorocco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this works for me; but doesn't offer any intellisense / tab completes / type hinting.
I don't think there's an extendable solution that updates the type completion. The best we could do is force modules to export a single protocol; something like:
class ThisSpecificPowerup(Protocol):
def hello():
...
class PoweredUp(ThisSpecificPowerup, MelleaSession):
...
def apply(m: MelleaSession) -> PowerdUp
... # do work here to apply
return m
m.hello() # this is properly type hinted / etc...
But this only works for one set of power ups at a time.
|
Well, now this PR does not remove any feature (like the one with |
jakelorocco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allows the methods to be called; I will give up on type-hinting / intellisense
3155c9f to
42b0d44
Compare
No description provided.