Fix docs warnings

This commit is contained in:
Mads Marquart
2020-05-06 13:31:03 +02:00
parent 2545a01450
commit cce947b18c
7 changed files with 15 additions and 12 deletions

View File

@@ -15,4 +15,6 @@ python:
# Build documentation in the docs/ directory with Sphinx # Build documentation in the docs/ directory with Sphinx
sphinx: sphinx:
configuration: docs/conf.py 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

View File

@@ -65,6 +65,7 @@ from ._models import (
EmojiSize, EmojiSize,
Mention, Mention,
Message, Message,
MessageSnippet,
MessageData, MessageData,
) )

View File

@@ -4,8 +4,8 @@ import enum
from string import Formatter from string import Formatter
from . import _attachment, _location, _file, _quick_reply, _sticker from . import _attachment, _location, _file, _quick_reply, _sticker
from .._common import log, attrs_default from .._common import log, attrs_default
from .. import _exception, _util, _session, _threads from .. import _exception, _util
from typing import Optional, Mapping, Sequence from typing import Optional, Mapping, Sequence, Any
class EmojiSize(enum.Enum): class EmojiSize(enum.Enum):
@@ -85,7 +85,7 @@ class Message:
""" """
#: The thread that this message belongs to. #: The thread that this message belongs to.
thread = attr.ib(type="_threads.ThreadABC") thread = attr.ib()
#: The message ID. #: The message ID.
id = attr.ib(converter=str, type=str) id = attr.ib(converter=str, type=str)
@@ -277,7 +277,7 @@ class MessageData(Message):
#: Message ID you want to reply to #: Message ID you want to reply to
reply_to_id = attr.ib(None, type=Optional[str]) reply_to_id = attr.ib(None, type=Optional[str])
#: Replied message #: Replied message
replied_to = attr.ib(None, type=Optional["MessageData"]) replied_to = attr.ib(None, type=Optional[Any])
#: Whether the message was forwarded #: Whether the message was forwarded
forwarded = attr.ib(False, type=Optional[bool]) forwarded = attr.ib(False, type=Optional[bool])

View File

@@ -313,7 +313,7 @@ class ThreadABC(metaclass=abc.ABCMeta):
def search_messages( def search_messages(
self, query: str, limit: int self, query: str, limit: int
) -> Iterable["_models.MessageSnippet"]: ) -> Iterable[_models.MessageSnippet]:
"""Find and get message IDs by query. """Find and get message IDs by query.
Warning! If someone send a message to the thread that matches the query, while Warning! If someone send a message to the thread that matches the query, while

View File

@@ -180,7 +180,7 @@ class GroupData(Group):
""" """
#: The group's picture #: 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 #: The name of the group
name = attr.ib(None, type=Optional[str]) name = attr.ib(None, type=Optional[str])
#: When the group was last active / when the last message was sent #: 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 #: Number of messages in the group
message_count = attr.ib(None, type=Optional[int]) message_count = attr.ib(None, type=Optional[int])
#: Set `Plan` #: 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 #: The group thread's participant user ids
participants = attr.ib(factory=set, type=Set[str]) participants = attr.ib(factory=set, type=Set[str])
#: A dictionary, containing user nicknames mapped to their IDs #: A dictionary, containing user nicknames mapped to their IDs

View File

@@ -37,7 +37,7 @@ class PageData(Page):
""" """
#: The page's picture #: The page's picture
photo = attr.ib(type="_models.Image") photo = attr.ib(type=_models.Image)
#: The name of the page #: The name of the page
name = attr.ib(type=str) name = attr.ib(type=str)
#: When the thread was last active / when the last message was sent #: 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 #: Number of messages in the thread
message_count = attr.ib(None, type=Optional[int]) message_count = attr.ib(None, type=Optional[int])
#: Set `Plan` #: Set `Plan`
plan = attr.ib(None, type=Optional["_models.PlanData"]) plan = attr.ib(None, type=Optional[_models.PlanData])
#: The page's custom URL #: The page's custom URL
url = attr.ib(None, type=Optional[str]) url = attr.ib(None, type=Optional[str])
#: The name of the page's location city #: The name of the page's location city

View File

@@ -105,7 +105,7 @@ class UserData(User):
""" """
#: The user's picture #: The user's picture
photo = attr.ib(type="_models.Image") photo = attr.ib(type=_models.Image)
#: The name of the user #: The name of the user
name = attr.ib(type=str) name = attr.ib(type=str)
#: Whether the user and the client are friends #: Whether the user and the client are friends
@@ -119,7 +119,7 @@ class UserData(User):
#: Number of messages in the thread #: Number of messages in the thread
message_count = attr.ib(None, type=Optional[int]) message_count = attr.ib(None, type=Optional[int])
#: Set `Plan` #: 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 #: The profile URL. ``None`` for Messenger-only users
url = attr.ib(None, type=Optional[str]) url = attr.ib(None, type=Optional[str])
#: The user's gender #: The user's gender