From 06e7875c89ab6b936a9e7b86b01fde72b6294a49 Mon Sep 17 00:00:00 2001 From: Romain Dorgueil Date: Mon, 1 May 2017 18:51:46 +0200 Subject: [PATCH] Removes dead code. My pleasure. --- bonobo/util/lifecycle.py | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 bonobo/util/lifecycle.py diff --git a/bonobo/util/lifecycle.py b/bonobo/util/lifecycle.py deleted file mode 100644 index c497f41..0000000 --- a/bonobo/util/lifecycle.py +++ /dev/null @@ -1,34 +0,0 @@ -from bonobo.basics import noop - - -def _create_lifecycle_functions(noun, verb): - getter = lambda c: getattr(c, verb, noop) - getter.__name__ = 'get_' + noun - - def setter(f): - nonlocal noun, verb - assert callable(f), 'You must provide a callable to decorate with {}.'.format(noun) - - def wrapper(c): - nonlocal verb, f - setattr(f, verb, c) - return f - - return wrapper - - setter.__name__ = 'set_' + noun - - return getter, setter - - -get_initializer, set_initializer = _create_lifecycle_functions('initializer', 'initialize') -get_finalizer, set_finalizer = _create_lifecycle_functions('finalizer', 'finalize') - - -class Contextual: - _with_context = True - - -def with_context(cls_or_func): - cls_or_func._with_context = True - return cls_or_func