From 347cd1ef77e17f4f8563979555ae1b4e383f2d4f Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Thu, 16 Mar 2023 23:16:18 +0000 Subject: [PATCH] my.fbmessenger: add Sender protocol for consistency --- my/fbmessenger/common.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/my/fbmessenger/common.py b/my/fbmessenger/common.py index 1f82327..a498952 100644 --- a/my/fbmessenger/common.py +++ b/my/fbmessenger/common.py @@ -10,8 +10,16 @@ class Thread(Protocol): @property def id(self) -> str: ... - # todo hmm it doesn't like it because one from .export is just str, not Optional... - # name: Optional[str] + @property + def name(self) -> Optional[str]: ... + + +class Sender(Protocol): + @property + def id(self) -> str: ... + + @property + def name(self) -> Optional[str]: ... class Message(Protocol): @@ -27,6 +35,9 @@ class Message(Protocol): @property def thread(self) -> Thread: ... + @property + def sender(self) -> Sender: ... + from itertools import chain from more_itertools import unique_everseen