Fix first line of docstrings

- Use the imperative sense
- Use trailing dot
- Omit leading newline
- Grammar / vocabulary fixes
This commit is contained in:
Mads Marquart
2019-07-21 23:46:09 +02:00
parent 700cf14a50
commit 6b07f1d8b9
14 changed files with 226 additions and 335 deletions

View File

@@ -7,7 +7,7 @@ from . import _util
@attr.s(cmp=False) @attr.s(cmp=False)
class Attachment(object): class Attachment(object):
"""Represents a Facebook attachment""" """Represents a Facebook attachment."""
#: The attachment ID #: The attachment ID
uid = attr.ib(None) uid = attr.ib(None)
@@ -15,12 +15,12 @@ class Attachment(object):
@attr.s(cmp=False) @attr.s(cmp=False)
class UnsentMessage(Attachment): class UnsentMessage(Attachment):
"""Represents an unsent message attachment""" """Represents an unsent message attachment."""
@attr.s(cmp=False) @attr.s(cmp=False)
class ShareAttachment(Attachment): class ShareAttachment(Attachment):
"""Represents a shared item (eg. URL) that has been sent as a Facebook attachment""" """Represents a shared item (eg. URL) attachment."""
#: ID of the author of the shared post #: ID of the author of the shared post
author = attr.ib(None) author = attr.ib(None)

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,10 @@ from __future__ import unicode_literals
class FBchatException(Exception): class FBchatException(Exception):
"""Custom exception thrown by fbchat. All exceptions in the fbchat module inherits this""" """Custom exception thrown by fbchat.
All exceptions in the fbchat module inherits this.
"""
class FBchatFacebookError(FBchatException): class FBchatFacebookError(FBchatException):
@@ -54,4 +57,4 @@ class FBchatPleaseRefresh(FBchatFacebookError):
class FBchatUserError(FBchatException): class FBchatUserError(FBchatException):
"""Thrown by fbchat when wrong values are entered""" """Thrown by fbchat when wrong values are entered."""

View File

@@ -7,7 +7,7 @@ from ._attachment import Attachment
@attr.s(cmp=False) @attr.s(cmp=False)
class FileAttachment(Attachment): class FileAttachment(Attachment):
"""Represents a file that has been sent as a Facebook attachment""" """Represents a file that has been sent as a Facebook attachment."""
#: Url where you can download the file #: Url where you can download the file
url = attr.ib(None) url = attr.ib(None)
@@ -33,7 +33,7 @@ class FileAttachment(Attachment):
@attr.s(cmp=False) @attr.s(cmp=False)
class AudioAttachment(Attachment): class AudioAttachment(Attachment):
"""Represents an audio file that has been sent as a Facebook attachment""" """Represents an audio file that has been sent as a Facebook attachment."""
#: Name of the file #: Name of the file
filename = attr.ib(None) filename = attr.ib(None)
@@ -59,10 +59,10 @@ class AudioAttachment(Attachment):
@attr.s(cmp=False, init=False) @attr.s(cmp=False, init=False)
class ImageAttachment(Attachment): class ImageAttachment(Attachment):
"""Represents an image that has been sent as a Facebook attachment """Represents an image that has been sent as a Facebook attachment.
To retrieve the full image url, use: :func:`fbchat.Client.fetchImageUrl`, and pass To retrieve the full image url, use: `Client.fetchImageUrl`, and pass it the id of
it the uid of the image attachment the image attachment.
""" """
#: The extension of the original image (eg. 'png') #: The extension of the original image (eg. 'png')
@@ -170,7 +170,7 @@ class ImageAttachment(Attachment):
@attr.s(cmp=False, init=False) @attr.s(cmp=False, init=False)
class VideoAttachment(Attachment): class VideoAttachment(Attachment):
"""Represents a video that has been sent as a Facebook attachment""" """Represents a video that has been sent as a Facebook attachment."""
#: Size of the original video in bytes #: Size of the original video in bytes
size = attr.ib(None) size = attr.ib(None)

View File

@@ -8,7 +8,7 @@ from ._thread import ThreadType, Thread
@attr.s(cmp=False, init=False) @attr.s(cmp=False, init=False)
class Group(Thread): class Group(Thread):
"""Represents a Facebook group. Inherits `Thread`""" """Represents a Facebook group. Inherits `Thread`."""
#: Unique list (set) of the group thread's participant user IDs #: Unique list (set) of the group thread's participant user IDs
participants = attr.ib(factory=set, converter=lambda x: set() if x is None else x) participants = attr.ib(factory=set, converter=lambda x: set() if x is None else x)
@@ -107,7 +107,7 @@ class Group(Thread):
@attr.s(cmp=False, init=False) @attr.s(cmp=False, init=False)
class Room(Group): class Room(Group):
"""Deprecated. Use :class:`Group` instead""" """Deprecated. Use `Group` instead."""
# True is room is not discoverable # True is room is not discoverable
privacy_mode = attr.ib(None) privacy_mode = attr.ib(None)

View File

@@ -8,9 +8,9 @@ from . import _util
@attr.s(cmp=False) @attr.s(cmp=False)
class LocationAttachment(Attachment): class LocationAttachment(Attachment):
"""Represents a user location """Represents a user location.
Latitude and longitude OR address is provided by Facebook Latitude and longitude OR address is provided by Facebook.
""" """
#: Latitude of the location #: Latitude of the location
@@ -58,7 +58,7 @@ class LocationAttachment(Attachment):
@attr.s(cmp=False, init=False) @attr.s(cmp=False, init=False)
class LiveLocationAttachment(LocationAttachment): class LiveLocationAttachment(LocationAttachment):
"""Represents a live user location""" """Represents a live user location."""
#: Name of the location #: Name of the location
name = attr.ib(None) name = attr.ib(None)

View File

@@ -9,7 +9,7 @@ from ._core import Enum
class EmojiSize(Enum): class EmojiSize(Enum):
"""Used to specify the size of a sent emoji""" """Used to specify the size of a sent emoji."""
LARGE = "369239383222810" LARGE = "369239383222810"
MEDIUM = "369239343222814" MEDIUM = "369239343222814"
@@ -33,7 +33,7 @@ class EmojiSize(Enum):
class MessageReaction(Enum): class MessageReaction(Enum):
"""Used to specify a message reaction""" """Used to specify a message reaction."""
HEART = "" HEART = ""
LOVE = "😍" LOVE = "😍"
@@ -47,7 +47,7 @@ class MessageReaction(Enum):
@attr.s(cmp=False) @attr.s(cmp=False)
class Mention(object): class Mention(object):
"""Represents a @mention""" """Represents a ``@mention``."""
#: The thread ID the mention is pointing at #: The thread ID the mention is pointing at
thread_id = attr.ib() thread_id = attr.ib()
@@ -59,7 +59,7 @@ class Mention(object):
@attr.s(cmp=False) @attr.s(cmp=False)
class Message(object): class Message(object):
"""Represents a Facebook message""" """Represents a Facebook message."""
#: The actual message #: The actual message
text = attr.ib(None) text = attr.ib(None)
@@ -98,7 +98,7 @@ class Message(object):
def formatMentions(cls, text, *args, **kwargs): def formatMentions(cls, text, *args, **kwargs):
"""Like `str.format`, but takes tuples with a thread id and text instead. """Like `str.format`, but takes tuples with a thread id and text instead.
Returns a `Message` object, with the formatted string and relevant mentions. Return a `Message` object, with the formatted string and relevant mentions.
>>> Message.formatMentions("Hey {!r}! My name is {}", ("1234", "Peter"), ("4321", "Michael")) >>> Message.formatMentions("Hey {!r}! My name is {}", ("1234", "Peter"), ("4321", "Michael"))
<Message (None): "Hey 'Peter'! My name is Michael", mentions=[<Mention 1234: offset=4 length=7>, <Mention 4321: offset=24 length=7>] emoji_size=None attachments=[]> <Message (None): "Hey 'Peter'! My name is Michael", mentions=[<Mention 1234: offset=4 length=7>, <Mention 4321: offset=24 length=7>] emoji_size=None attachments=[]>

View File

@@ -8,7 +8,7 @@ from ._thread import ThreadType, Thread
@attr.s(cmp=False, init=False) @attr.s(cmp=False, init=False)
class Page(Thread): class Page(Thread):
"""Represents a Facebook page. Inherits `Thread`""" """Represents a Facebook page. Inherits `Thread`."""
#: The page's custom url #: The page's custom url
url = attr.ib(None) url = attr.ib(None)

View File

@@ -14,7 +14,7 @@ class GuestStatus(Enum):
@attr.s(cmp=False) @attr.s(cmp=False)
class Plan(object): class Plan(object):
"""Represents a plan""" """Represents a plan."""
#: ID of the plan #: ID of the plan
uid = attr.ib(None, init=False) uid = attr.ib(None, init=False)

View File

@@ -6,7 +6,7 @@ import attr
@attr.s(cmp=False) @attr.s(cmp=False)
class Poll(object): class Poll(object):
"""Represents a poll""" """Represents a poll."""
#: Title of the poll #: Title of the poll
title = attr.ib() title = attr.ib()
@@ -29,7 +29,7 @@ class Poll(object):
@attr.s(cmp=False) @attr.s(cmp=False)
class PollOption(object): class PollOption(object):
"""Represents a poll option""" """Represents a poll option."""
#: Text of the poll option #: Text of the poll option
text = attr.ib() text = attr.ib()

View File

@@ -7,7 +7,7 @@ from ._attachment import Attachment
@attr.s(cmp=False) @attr.s(cmp=False)
class QuickReply(object): class QuickReply(object):
"""Represents a quick reply""" """Represents a quick reply."""
#: Payload of the quick reply #: Payload of the quick reply
payload = attr.ib(None) payload = attr.ib(None)
@@ -21,7 +21,7 @@ class QuickReply(object):
@attr.s(cmp=False, init=False) @attr.s(cmp=False, init=False)
class QuickReplyText(QuickReply): class QuickReplyText(QuickReply):
"""Represents a text quick reply""" """Represents a text quick reply."""
#: Title of the quick reply #: Title of the quick reply
title = attr.ib(None) title = attr.ib(None)
@@ -38,7 +38,7 @@ class QuickReplyText(QuickReply):
@attr.s(cmp=False, init=False) @attr.s(cmp=False, init=False)
class QuickReplyLocation(QuickReply): class QuickReplyLocation(QuickReply):
"""Represents a location quick reply (Doesn't work on mobile)""" """Represents a location quick reply (Doesn't work on mobile)."""
#: Type of the quick reply #: Type of the quick reply
_type = "location" _type = "location"
@@ -50,7 +50,7 @@ class QuickReplyLocation(QuickReply):
@attr.s(cmp=False, init=False) @attr.s(cmp=False, init=False)
class QuickReplyPhoneNumber(QuickReply): class QuickReplyPhoneNumber(QuickReply):
"""Represents a phone number quick reply (Doesn't work on mobile)""" """Represents a phone number quick reply (Doesn't work on mobile)."""
#: URL of the quick reply image (optional) #: URL of the quick reply image (optional)
image_url = attr.ib(None) image_url = attr.ib(None)
@@ -64,7 +64,7 @@ class QuickReplyPhoneNumber(QuickReply):
@attr.s(cmp=False, init=False) @attr.s(cmp=False, init=False)
class QuickReplyEmail(QuickReply): class QuickReplyEmail(QuickReply):
"""Represents an email quick reply (Doesn't work on mobile)""" """Represents an email quick reply (Doesn't work on mobile)."""
#: URL of the quick reply image (optional) #: URL of the quick reply image (optional)
image_url = attr.ib(None) image_url = attr.ib(None)

View File

@@ -7,7 +7,7 @@ from ._attachment import Attachment
@attr.s(cmp=False, init=False) @attr.s(cmp=False, init=False)
class Sticker(Attachment): class Sticker(Attachment):
"""Represents a Facebook sticker that has been sent to a thread as an attachment""" """Represents a Facebook sticker that has been sent to a thread as an attachment."""
#: The sticker-pack's ID #: The sticker-pack's ID
pack = attr.ib(None) pack = attr.ib(None)

View File

@@ -6,7 +6,10 @@ from ._core import Enum
class ThreadType(Enum): class ThreadType(Enum):
"""Used to specify what type of Facebook thread is being used. See :ref:`intro_threads` for more info""" """Used to specify what type of Facebook thread is being used.
See :ref:`intro_threads` for more info.
"""
USER = 1 USER = 1
GROUP = 2 GROUP = 2
@@ -24,7 +27,7 @@ class ThreadLocation(Enum):
class ThreadColor(Enum): class ThreadColor(Enum):
"""Used to specify a thread colors""" """Used to specify a thread colors."""
MESSENGER_BLUE = "#0084ff" MESSENGER_BLUE = "#0084ff"
VIKING = "#44bec7" VIKING = "#44bec7"
@@ -60,7 +63,7 @@ class ThreadColor(Enum):
@attr.s(cmp=False, init=False) @attr.s(cmp=False, init=False)
class Thread(object): class Thread(object):
"""Represents a Facebook thread""" """Represents a Facebook thread."""
#: The unique identifier of the thread. Can be used a ``thread_id``. See :ref:`intro_threads` for more info #: The unique identifier of the thread. Can be used a ``thread_id``. See :ref:`intro_threads` for more info
uid = attr.ib(converter=str) uid = attr.ib(converter=str)

View File

@@ -38,7 +38,7 @@ GENDERS = {
class TypingStatus(Enum): class TypingStatus(Enum):
"""Used to specify whether the user is typing or has stopped typing""" """Used to specify whether the user is typing or has stopped typing."""
STOPPED = 0 STOPPED = 0
TYPING = 1 TYPING = 1
@@ -46,7 +46,7 @@ class TypingStatus(Enum):
@attr.s(cmp=False, init=False) @attr.s(cmp=False, init=False)
class User(Thread): class User(Thread):
"""Represents a Facebook user. Inherits `Thread`""" """Represents a Facebook user. Inherits `Thread`."""
#: The profile url #: The profile url
url = attr.ib(None) url = attr.ib(None)