projects
/
tweepy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1ffc8cd
)
Override Mapping.__contains__ in DataMapping
author
Harmon
<Harmon758@gmail.com>
Thu, 24 Feb 2022 19:46:08 +0000
(13:46 -0600)
committer
Harmon
<Harmon758@gmail.com>
Thu, 24 Feb 2022 19:46:08 +0000
(13:46 -0600)
This allows membership tests to check for existence within data, rather than existence of the attribute at all
tweepy/mixins.py
patch
|
blob
|
blame
|
history
diff --git
a/tweepy/mixins.py
b/tweepy/mixins.py
index ecd5b5713a9e06c51ba5f778e09639d35c8a6a5f..5884ff47e267211b9aa38881cb7bda764b3c5d9a 100644
(file)
--- a/
tweepy/mixins.py
+++ b/
tweepy/mixins.py
@@
-25,6
+25,9
@@
class HashableID(EqualityComparableID):
class DataMapping(Mapping):
__slots__ = ()
+ def __contains__(self, item):
+ return item in self.data
+
def __getattr__(self, name):
try:
return self.data[name]