1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- from __future__ import annotations
- from typing import Any, List, Set
- from pydantic import BaseModel
- from million.model.message import Message
- from million.model.participant import Participant
-
-
- class Image(BaseModel):
- creation_timestamp: int
- uri: str
-
- def __eq__(self, other: Image) -> bool:
- return self.creation_timestamp == other.creation_timestamp \
- and self.uri == other.uri
-
- class JoinableMode(BaseModel):
- mode: int
- link: str
-
- class FacebookExport(BaseModel):
- messages: List[Message]
- participants: Set[Participant]
- title: str
- is_still_participant: bool
- thread_path: str
- magic_words: Set[Any]
- image: Image
- joinable_mode: JoinableMode
-
-
- def merge(self, other: FacebookExport) -> None:
- if self == other:
- self.messages.extend(other.messages)
- self.participants.update(other.participants)
- self.magic_words.update(other.magic_words)
-
- def sort(self) -> None:
- self.messages.sort(key = lambda m: m.date_time)
-
-
- def __eq__(self, other: FacebookExport) -> bool:
- # NOTE Toughen equality conditions ?
- return self.title == other.title \
- and self.image == other.image
|