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
Thanks for developing Gossip. I love it!
I'm currently using it as part of a framework I'm writing, so I'm pre-defining a lot of hooks I use in different places. I always store the hook object and use it directly for registration (to have the hook name defined in only one place), but I'm hitting a wall when using arguments with these objects. I'm using strict groups.
# Works fine
myhook = gossip.define("mygroup.testhook", arg_names=["some_arg"])
@myhook.register
def some_function(some_arg):
pass
# Does not work:
myhook = gossip.define("mygroup.testhook", arg_names=["some_arg"], tags=["test"])
@myhook.register(tags=["test"])
def some_function(some_arg):
pass
I always end up with the following TypeError: register() takes at least 2 arguments (2 given)
Do I need to wrap the register() call to get the functionality I want?
Cheers!
Tim
The text was updated successfully, but these errors were encountered:
First, glad to know that you like it! Thanks for the kind words.
Regarding your question -- the register method on hook objects is stricter than the global register, and this means it's not as convenient to be used as a decorator.
I'm open to a PR making it more convenient though - there's no objective reason why your example shouldn't be allowed.
Hi Rotem,
Thanks for developing Gossip. I love it!
I'm currently using it as part of a framework I'm writing, so I'm pre-defining a lot of hooks I use in different places. I always store the hook object and use it directly for registration (to have the hook name defined in only one place), but I'm hitting a wall when using arguments with these objects. I'm using strict groups.
I always end up with the following
TypeError: register() takes at least 2 arguments (2 given)
Do I need to wrap the register() call to get the functionality I want?
Cheers!
Tim
The text was updated successfully, but these errors were encountered: