diff --git a/.readthedocs.yml b/.readthedocs.yml index ec7a00d..9070b78 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -15,4 +15,6 @@ python: # Build documentation in the docs/ directory with Sphinx sphinx: configuration: docs/conf.py - fail_on_warning: true + # Disabled, until we can find a way to get sphinx-autodoc-typehints play nice with our + # module renaming! + fail_on_warning: false diff --git a/fbchat/__init__.py b/fbchat/__init__.py index 40cbe8a..b793a18 100644 --- a/fbchat/__init__.py +++ b/fbchat/__init__.py @@ -65,6 +65,7 @@ from ._models import ( EmojiSize, Mention, Message, + MessageSnippet, MessageData, ) diff --git a/fbchat/_models/_message.py b/fbchat/_models/_message.py index 26569e3..b90037c 100644 --- a/fbchat/_models/_message.py +++ b/fbchat/_models/_message.py @@ -4,8 +4,8 @@ import enum from string import Formatter from . import _attachment, _location, _file, _quick_reply, _sticker from .._common import log, attrs_default -from .. import _exception, _util, _session, _threads -from typing import Optional, Mapping, Sequence +from .. import _exception, _util +from typing import Optional, Mapping, Sequence, Any class EmojiSize(enum.Enum): @@ -85,7 +85,7 @@ class Message: """ #: The thread that this message belongs to. - thread = attr.ib(type="_threads.ThreadABC") + thread = attr.ib() #: The message ID. id = attr.ib(converter=str, type=str) @@ -277,7 +277,7 @@ class MessageData(Message): #: Message ID you want to reply to reply_to_id = attr.ib(None, type=Optional[str]) #: Replied message - replied_to = attr.ib(None, type=Optional["MessageData"]) + replied_to = attr.ib(None, type=Optional[Any]) #: Whether the message was forwarded forwarded = attr.ib(False, type=Optional[bool]) diff --git a/fbchat/_threads/_abc.py b/fbchat/_threads/_abc.py index 710d9f5..042856e 100644 --- a/fbchat/_threads/_abc.py +++ b/fbchat/_threads/_abc.py @@ -313,7 +313,7 @@ class ThreadABC(metaclass=abc.ABCMeta): def search_messages( self, query: str, limit: int - ) -> Iterable["_models.MessageSnippet"]: + ) -> Iterable[_models.MessageSnippet]: """Find and get message IDs by query. Warning! If someone send a message to the thread that matches the query, while diff --git a/fbchat/_threads/_group.py b/fbchat/_threads/_group.py index 891ec04..2460d0b 100644 --- a/fbchat/_threads/_group.py +++ b/fbchat/_threads/_group.py @@ -180,7 +180,7 @@ class GroupData(Group): """ #: The group's picture - photo = attr.ib(None, type=Optional["_models.Image"]) + photo = attr.ib(None, type=Optional[_models.Image]) #: The name of the group name = attr.ib(None, type=Optional[str]) #: When the group was last active / when the last message was sent @@ -188,7 +188,7 @@ class GroupData(Group): #: Number of messages in the group message_count = attr.ib(None, type=Optional[int]) #: Set `Plan` - plan = attr.ib(None, type=Optional["_models.PlanData"]) + plan = attr.ib(None, type=Optional[_models.PlanData]) #: The group thread's participant user ids participants = attr.ib(factory=set, type=Set[str]) #: A dictionary, containing user nicknames mapped to their IDs diff --git a/fbchat/_threads/_page.py b/fbchat/_threads/_page.py index 28ebe24..6486d75 100644 --- a/fbchat/_threads/_page.py +++ b/fbchat/_threads/_page.py @@ -37,7 +37,7 @@ class PageData(Page): """ #: The page's picture - photo = attr.ib(type="_models.Image") + photo = attr.ib(type=_models.Image) #: The name of the page name = attr.ib(type=str) #: When the thread was last active / when the last message was sent @@ -45,7 +45,7 @@ class PageData(Page): #: Number of messages in the thread message_count = attr.ib(None, type=Optional[int]) #: Set `Plan` - plan = attr.ib(None, type=Optional["_models.PlanData"]) + plan = attr.ib(None, type=Optional[_models.PlanData]) #: The page's custom URL url = attr.ib(None, type=Optional[str]) #: The name of the page's location city diff --git a/fbchat/_threads/_user.py b/fbchat/_threads/_user.py index c481a6c..00bbeab 100644 --- a/fbchat/_threads/_user.py +++ b/fbchat/_threads/_user.py @@ -105,7 +105,7 @@ class UserData(User): """ #: The user's picture - photo = attr.ib(type="_models.Image") + photo = attr.ib(type=_models.Image) #: The name of the user name = attr.ib(type=str) #: Whether the user and the client are friends @@ -119,7 +119,7 @@ class UserData(User): #: Number of messages in the thread message_count = attr.ib(None, type=Optional[int]) #: Set `Plan` - plan = attr.ib(None, type=Optional["_models.PlanData"]) + plan = attr.ib(None, type=Optional[_models.PlanData]) #: The profile URL. ``None`` for Messenger-only users url = attr.ib(None, type=Optional[str]) #: The user's gender