richlanc / argspander

Python package that enables object argument expanding
0 stars 0 forks source link

Argspander does not work on functions accepting no args #3

Open vext01 opened 9 years ago

vext01 commented 9 years ago

In PassOut we have the function:

@argspander.expand
def cmd_ls(*args, **kwargs):
    for p in sorted(passout.get_password_names()):
        print(p)

The args are not used, so we should be able to do:

@argspander.expand
def cmd_ls(*args, **kwargs):
    ...

But alas:

wilfred:passout> passout ls
Traceback (most recent call last):
  File "/home/edd/eck2/bin/passout", line 108, in <module>
    entrypoint()
  File "/home/edd/eck2/bin/passout", line 105, in entrypoint
    args.func(args, expand=True)
  File "/home/edd/.local/lib/python2.7/site-packages/argspander/__init__.py", line 77, in _inner
    return func(*args, **kwargs)
TypeError: cmd_ls() takes no arguments (2 given)
richlanc commented 9 years ago

Thanks for letting me know, will look into it!