From bd2a2069405717d967129230deb487a0fe7480d1 Mon Sep 17 00:00:00 2001 From: Andrey Golovizin Date: Wed, 3 Sep 2014 21:06:17 +0200 Subject: [PATCH] Add utils.pipe(). --- pixelocr/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pixelocr/utils.py b/pixelocr/utils.py index 0253761..c4c3d85 100644 --- a/pixelocr/utils.py +++ b/pixelocr/utils.py @@ -63,3 +63,9 @@ def neighbourhood(lst, index, window=5): before = lst[:index] after = lst[index + 1:] return before[-window:] + after[:window] + + +def pipe(value, *funcs): + for func in funcs: + value = func(value) + return value