From ca0ab5887ec99e5979998968f1ba664f7698d0bf Mon Sep 17 00:00:00 2001 From: Aldur Date: Tue, 23 Sep 2014 11:02:09 +0200 Subject: [PATCH] make uwsgidecorators pep8 friendly --- uwsgidecorators.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/uwsgidecorators.py b/uwsgidecorators.py index e1fa71b7..61b0b34e 100644 --- a/uwsgidecorators.py +++ b/uwsgidecorators.py @@ -48,6 +48,7 @@ uwsgi.post_fork_hook = postfork_chain_hook class postfork(object): + def __init__(self, f): if callable(f): self.wid = 0 @@ -56,6 +57,7 @@ class postfork(object): self.f = None self.wid = f postfork_chain.append(self) + def __call__(self, *args, **kwargs): if self.f: if self.wid > 0 and self.wid != uwsgi.worker_id(): @@ -79,7 +81,8 @@ class _spoolraw(object): if key in kwargs: spooler_args.update({key: kwargs.pop(key)}) arguments.update(spooler_args) - arguments.update({'args': pickle.dumps(args), 'kwargs': pickle.dumps(kwargs)}) + arguments.update( + {'args': pickle.dumps(args), 'kwargs': pickle.dumps(kwargs)}) return uwsgi.spool(arguments) # For backward compatibility (uWSGI < 1.9.13) @@ -234,6 +237,7 @@ class mule_brainloop(mule_brain): class mule(object): + def __init__(self, num): self.num = num @@ -242,6 +246,7 @@ class mule(object): class muleloop(mule): + def __call__(self, f): postfork_chain.append(mule_brainloop(f, self.num)) @@ -261,6 +266,7 @@ class mulemsg_loop(object): class mulemsg(object): + def __init__(self, num): self.num = num @@ -306,7 +312,7 @@ class cron(object): def __call__(self, f): uwsgi.register_signal(self.num, self.target, f) uwsgi.add_cron(self.num, self.minute, self.hour, - self.day, self.month, self.dayweek) + self.day, self.month, self.dayweek) return f @@ -347,6 +353,7 @@ class erlang(object): class lock(object): + def __init__(self, f): self.f = f