@@ -33,14 +33,14 @@ def on(self, success=None, error=None):
3333 If a callback returns an :obj:`Effect`, the result of that
3434 :obj:`Effect` will be passed to the next callback.
3535 """
36- return Effect (self .intent ,
37- callbacks = self .callbacks + [(success , error )])
36+ return Effect (self .intent , callbacks = self .callbacks + [(success , error )])
3837
3938
4039class _Box (object ):
4140 """
4241 An object into which an effect dispatcher can place a result.
4342 """
43+
4444 def __init__ (self , cont ):
4545 """
4646 :param callable cont: Called with (bool is_error, result)
@@ -119,13 +119,14 @@ def perform(dispatcher, effect):
119119 ``box.succeed(result)`` or ``box.fail(exc)``, where ``exc`` is
120120 an exception. Decorators like :func:`sync_performer` simply abstract this away.
121121 """
122+
122123 def _run_callbacks (bouncer , chain , result ):
123124 is_error , value = result
124125
125126 if type (value ) is Effect :
126127 bouncer .bounce (
127- _perform ,
128- Effect ( value . intent , callbacks = value . callbacks + chain ) )
128+ _perform , Effect ( value . intent , callbacks = value . callbacks + chain )
129+ )
129130 return
130131
131132 if not chain :
@@ -146,8 +147,8 @@ def _perform(bouncer, effect):
146147 performer (
147148 dispatcher ,
148149 effect .intent ,
149- _Box (partial (bouncer .bounce ,
150- _run_callbacks , effect . callbacks )) )
150+ _Box (partial (bouncer .bounce , _run_callbacks , effect . callbacks )),
151+ )
151152 except Exception as e :
152153 _run_callbacks (bouncer , effect .callbacks , (True , e ))
153154
@@ -164,10 +165,12 @@ def catch(exc_type, callable):
164165 If any exception other than a ``SpecificException`` is thrown, it will be
165166 ignored by this handler and propogate further down the chain of callbacks.
166167 """
168+
167169 def catcher (error ):
168170 if isinstance (error , exc_type ):
169171 return callable (error )
170172 raise error
173+
171174 return catcher
172175
173176
0 commit comments