-
-
Notifications
You must be signed in to change notification settings - Fork 625
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
3.9: Remove docstring shenanigans from events #3837
Comments
Oh, that would be nice! |
@AstraLuma could you explain what has been changed a bit? |
From the 3.9 changes:
|
Ok. I don't see dropping 3.8 anytime soon. Though I find this following pattern very easier to read and reason with. # any new event can create an empty function with the correct signature
def autovox_policy(path: "Path") -> "str|Path|None":
"""
Register a policy with autovox.
Parameters
-----------
...
"""
# we can then use this register function to wrap `EventManager.doc`
def register(self, func):
"""
wraps ``EventManager.doc``
Parameters
----------
func
extract name and doc from the function
"""
name = func.__name__
doc = inspect.getdoc(func)
sign = inspect.signature(func)
return self.doc(name, f"{name}{sign}\n\n{doc}") I have this locally and planning to create a PR later. |
Yeah, I thought about doing a function-based version of event definition as well. But the existing system was already established and I didn't think the incremental improvement over it was worth it. |
I want to create an entrypoint based xontrib loading mechanism. Where I want to remove any global access. It would be helpful in that time. |
Not all event handlers come from xontribs. |
Python 3.9.0 changed the way docstrings are searched, which I believe means we no longer need the dynamic type shenanigans in
xonsh.events
.The text was updated successfully, but these errors were encountered: