From 3ca7c39b736b5516fa492df5d42eed889d21e3b2 Mon Sep 17 00:00:00 2001 From: Marin Atanasov Nikolov Date: Mon, 26 Jan 2015 15:15:14 +0200 Subject: [PATCH] Implement __contains__() special method for TaskRegistry class --- src/vpoller/registry.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vpoller/registry.py b/src/vpoller/registry.py index ee94698..c259be7 100644 --- a/src/vpoller/registry.py +++ b/src/vpoller/registry.py @@ -38,6 +38,9 @@ class TaskRegistry(object): def __init__(self): self._registry = {} + def __contains__(self, item): + return item in self._registry + def register(self, name, required, fn): """ Register a new task