You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Decorators could be added to willie, so that modules could use those as a standard way of declaring willie callables. They would simply add the attributes to a function, so all old modules would still work. They could later be extended to do other things, such as wrapping functions to a WillieCallable object or something.
This would also have the benefit of working nicely with IDEs, as you would get docstrings and code-completion for the decorators.
Make decorators for adding attributes to willie callables
I think a new module should be made for these, meant to house things that are imported from willie modules. I would suggest "willie.module". Optionally, these could be imported to willie package for shorter syntax, but I would rather not import willie itself into a module, even if that doesn't do any harm.
importwillie# import willie.module # I like this better.@willie.rule(".*")@willie.module.rule(".*")defmy_callable(bot, trigger):
Convert all basic modules to the new format.
As an example for those that want to make willie modules. As I think it is preferable to adding magic attributes to function objects.
Add type-checking to the new decorators.
The interface for some of these attributes is a bit complicated, so I think it would be nice to be able to run the individual module without willie and see that they are indeed in a format accepted by willie. I'm mostly talking about rule here, as it can be a regexp string or one of a few different kinds of tupples.
The text was updated successfully, but these errors were encountered:
Decorators could be added to willie, so that modules could use those as a standard way of declaring willie callables. They would simply add the attributes to a function, so all old modules would still work. They could later be extended to do other things, such as wrapping functions to a WillieCallable object or something.
This would also have the benefit of working nicely with IDEs, as you would get docstrings and code-completion for the decorators.
I think a new module should be made for these, meant to house things that are imported from willie modules. I would suggest "willie.module". Optionally, these could be imported to willie package for shorter syntax, but I would rather not import willie itself into a module, even if that doesn't do any harm.
As an example for those that want to make willie modules. As I think it is preferable to adding magic attributes to function objects.
The interface for some of these attributes is a bit complicated, so I think it would be nice to be able to run the individual module without willie and see that they are indeed in a format accepted by willie. I'm mostly talking about rule here, as it can be a regexp string or one of a few different kinds of tupples.
The text was updated successfully, but these errors were encountered: