wrapt icon indicating copy to clipboard operation
wrapt copied to clipboard

Signature Changing Decorators issue

Open subsurfaceiodev opened this issue 2 years ago • 1 comments

Hey there! First of all, thanks for this wonderful package. We are currently facing an issue when dealing with "Signature Changing Decorators" functionality,

Currently, wrapt allows you to change wrapped function's signature via the argspec_factory adapter and it works. The question is, how can you send current args / kwargs to this argspec_factory adapter so you can change the function´s signature depending on the value(s) of current args / kwargs. So, for example, if user gives input "consider_port_is_present" = False, then we could change wrapped function's signature depending on that value (e.g. adding "port" argument to argspec only if consider_port_is_present is True).

subsurfaceiodev avatar Mar 10 '23 15:03 subsurfaceiodev

Can you show any rough code you have now? I don't need the full body of your decorator, but do need to see how using argspec_factory now and whether you are creating a decorator which takes arguments. If not creating a decorator with arguments I don't understand where consider_port_is_present argument is being supplied.

GrahamDumpleton avatar Mar 10 '23 23:03 GrahamDumpleton