From 6633b5abc13813ac3720b8269e4f498527d11372 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Fri, 10 Dec 2021 19:04:14 +0300 Subject: state: add __contains__ --- ch1p/__init__.py | 2 +- ch1p/state.py | 5 ++++- setup.cfg | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ch1p/__init__.py b/ch1p/__init__.py index 878f8fa..c5906d1 100644 --- a/ch1p/__init__.py +++ b/ch1p/__init__.py @@ -1,2 +1,2 @@ from .functions import telegram_notify -from .state import State \ No newline at end of file +from .state import State diff --git a/ch1p/state.py b/ch1p/state.py index 1ea2373..587b31c 100644 --- a/ch1p/state.py +++ b/ch1p/state.py @@ -39,6 +39,9 @@ class State: def __setitem__(self, key, value): self._data[key] = value + def __contains__(self, key): + return key in self._data + def __delitem__(self, key): if key in self._data: - del self._data[key] \ No newline at end of file + del self._data[key] diff --git a/setup.cfg b/setup.cfg index ac92132..777413a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = ch1p -version = 0.0.5 +version = 0.0.6 author = Evgeny Zinoviev author_email = me@ch1p.io description = -- cgit v1.2.3