mirror of
https://github.com/craigerl/aprsd.git
synced 2025-09-05 14:47:53 -04:00
Added __contains__ to threadlist
This patch adds the __contains__ to the APRSDThreadList class so we can do things like if name in APRSDThreadList: # do something
This commit is contained in:
parent
d4ae72608b
commit
d94a3e7b90
@ -88,6 +88,13 @@ class APRSDThreadList:
|
|||||||
cls.threads_list = []
|
cls.threads_list = []
|
||||||
return cls._instance
|
return cls._instance
|
||||||
|
|
||||||
|
def __contains__(self, name):
|
||||||
|
"""See if we have a thread in our list"""
|
||||||
|
for t in self.threads_list:
|
||||||
|
if t.name == name:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def stats(self, serializable=False) -> dict:
|
def stats(self, serializable=False) -> dict:
|
||||||
stats = {}
|
stats = {}
|
||||||
for th in self.threads_list:
|
for th in self.threads_list:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user