items.py: rebase fix

This commit is contained in:
miruka 2020-02-12 06:27:21 -04:00
parent e982de1c61
commit 7020706ff1

View File

@ -12,7 +12,6 @@ from uuid import UUID
import lxml # nosec import lxml # nosec
import nio import nio
from ..html_markdown import HTML_PROCESSOR
from ..utils import AutoStrEnum, auto from ..utils import AutoStrEnum, auto
from .model_item import ModelItem from .model_item import ModelItem
@ -168,16 +167,17 @@ class Event(ModelItem):
id: str = field() id: str = field()
event_id: str = field() event_id: str = field()
event_type: Type[nio.Event] = field()
source: Optional[nio.Event] = field() source: Optional[nio.Event] = field()
date: datetime = field() date: datetime = field()
sender_id: str = field() sender_id: str = field()
sender_name: str = field() sender_name: str = field()
sender_avatar: str = field() sender_avatar: str = field()
content: str = "" content: str = ""
inline_content: str = "" inline_content: str = ""
reason: str = "" reason: str = ""
links: List[Dict[str, Any]] = field(default_factory=list) links: List[str] = field(default_factory=list)
type_specifier: TypeSpecifier = TypeSpecifier.Unset type_specifier: TypeSpecifier = TypeSpecifier.Unset
@ -208,13 +208,13 @@ class Event(ModelItem):
return self.date > other.date return self.date > other.date
@staticmethod @staticmethod
def parse_links(text: str) -> List[Dict[str, Any]]: def parse_links(text: str) -> List[str]:
"""Return list of URLs (`<a href=...>` tags) present in the text.""" """Return list of URLs (`<a href=...>` tags) present in the text."""
if not text.strip(): if not text.strip():
return [] return []
return [{"url": link[2]} for link in lxml.html.iterlinks(text)] return [link[2] for link in lxml.html.iterlinks(text)]
@property @property
def serialized(self) -> Dict[str, Any]: def serialized(self) -> Dict[str, Any]: