Skip to content

Commit

Permalink
Merge pull request #1215 from PokestarFan/add-types-message
Browse files Browse the repository at this point in the history
(#1164) Add types to reddit/message.py
  • Loading branch information
bboe committed Dec 29, 2019
2 parents bc975fc + 82e77ae commit f352b1c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions praw/models/reddit/message.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
"""Provide the Message class."""
from typing import Any, Dict, TypeVar

from ...const import API_PATH
from .base import RedditBase
from .mixins import FullnameMixin, InboxableMixin, ReplyableMixin
from .redditor import Redditor
from .subreddit import Subreddit

Reddit = TypeVar("Reddit")


class Message(InboxableMixin, ReplyableMixin, FullnameMixin, RedditBase):
"""A class for private messages.
Expand Down Expand Up @@ -42,7 +46,7 @@ class Message(InboxableMixin, ReplyableMixin, FullnameMixin, RedditBase):
STR_FIELD = "id"

@classmethod
def parse(cls, data, reddit):
def parse(cls, data: Dict[str, Any], reddit: Reddit):
"""Return an instance of Message or SubredditMessage from ``data``.
:param data: The structured data.
Expand Down Expand Up @@ -76,7 +80,7 @@ def _kind(self):
"""Return the class's kind."""
return self._reddit.config.kinds["message"]

def __init__(self, reddit, _data):
def __init__(self, reddit: Reddit, _data: Dict[str, Any]):
"""Construct an instance of the Message object."""
super().__init__(reddit, _data=_data)
self._fetched = True
Expand Down

0 comments on commit f352b1c

Please sign in to comment.