From b5ced4e9b806e6cc67e256d10f3dbe1fab913cfd Mon Sep 17 00:00:00 2001 From: Andrey Ilinskiy Date: Tue, 29 Dec 2020 18:24:12 +0300 Subject: [PATCH] Update docopt_dispatch.py fix error $ pgrepup setup Pgrepup 0.3.10 Traceback (most recent call last): File "/usr/local/bin/pgrepup", line 25, in main() File "/usr/local/lib/python2.7/dist-packages/pgrepup/cli.py", line 64, in main dispatch(__doc__) File "/usr/local/lib/python2.7/dist-packages/pgrepup/helpers/docopt_dispatch.py", line 39, in __call__ function(**self._kwargify(arguments)) TypeError: setup() takes no arguments (14 given) --- pgrepup/helpers/docopt_dispatch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pgrepup/helpers/docopt_dispatch.py b/pgrepup/helpers/docopt_dispatch.py index a488c6d..470cc01 100644 --- a/pgrepup/helpers/docopt_dispatch.py +++ b/pgrepup/helpers/docopt_dispatch.py @@ -36,7 +36,10 @@ def __call__(self, *args, **kwargs): for patterns, function in self._functions.items(): if all(arguments[pattern] for pattern in patterns): - function(**self._kwargify(arguments)) + if function.__name__ == 'setup': + function() + else: + function(**self._kwargify(arguments)) return raise DispatchError('None of dispatch conditions %s is triggered' % self._formated_patterns)