1
0
mirror of https://github.com/craigerl/aprsd.git synced 2025-09-02 21:27:56 -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:
Hemna 2024-11-27 11:40:53 -05:00
parent d4ae72608b
commit d94a3e7b90

View File

@ -88,6 +88,13 @@ class APRSDThreadList:
cls.threads_list = []
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:
stats = {}
for th in self.threads_list: