[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [sbws/master] Implement get method in State
commit f41f9134973b47ebd6dc72e7142348ca755e55c2
Author: juga0 <juga@xxxxxxxxxx>
Date: Tue Oct 23 10:19:38 2018 +0000
Implement get method in State
---
sbws/util/state.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/sbws/util/state.py b/sbws/util/state.py
index ce3dbb9..58da699 100644
--- a/sbws/util/state.py
+++ b/sbws/util/state.py
@@ -63,6 +63,13 @@ class State:
self._state = self._read()
return self._state.__len__()
+ def get(self, key):
+ if not isinstance(key, str):
+ raise TypeError(
+ 'Keys must be strings. %s is a %s' % (key, type(key)))
+ self._state = self._read()
+ return self._state.get(key)
+
def __getitem__(self, key):
if not isinstance(key, str):
raise TypeError(
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits