Skip to content

Commit

Permalink
Refactor CommentForrest to CommentForest (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan6erbond authored Jul 9, 2020
2 parents f0be715 + 1e9e5b4 commit 838f594
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ...reddit import Reddit


class CommentForrest(Listing):
class CommentForest(Listing):

def __init__(self, reddit: 'Reddit', data: Dict, link_id: str, subreddit: Subreddit = None):
super().__init__(reddit, data, subreddit, link_id=link_id)
Expand Down
8 changes: 4 additions & 4 deletions apraw/models/reddit/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
if TYPE_CHECKING:
from ...reddit import Reddit
from .submission import Submission
from ..helpers.comment_forrest import CommentForrest
from ..helpers.comment_forest import CommentForest


@all_reactive(not_type=(aPRAWBase, datetime, PostModeration))
Expand Down Expand Up @@ -126,7 +126,7 @@ class Comment(aPRAWBase, DeletableMixin, HideableMixin, ReplyableMixin, SavableM
"""

def __init__(self, reddit: 'Reddit', data: Dict, submission: 'Submission' = None,
author: Redditor = None, subreddit: Subreddit = None, replies: Union['CommentForrest', List] = None):
author: Redditor = None, subreddit: Subreddit = None, replies: Union['CommentForest', List] = None):
"""
Create an instance of a comment.
Expand Down Expand Up @@ -202,8 +202,8 @@ def _update(self, _data: Union[List, Dict[str, Any]]):
if isinstance(_data, dict) or isinstance(_data, list):
data = _data if isinstance(_data, dict) else _data[0]["data"]
if isinstance(_data, list):
from ..helpers.comment_forrest import CommentForrest
self.replies = CommentForrest(self._reddit, _data[1]["data"], data["link_id"])
from ..helpers.comment_forest import CommentForest
self.replies = CommentForest(self._reddit, _data[1]["data"], data["link_id"])

self._data = data

Expand Down
4 changes: 2 additions & 2 deletions apraw/models/reddit/listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ def __getitem__(self, index: int) -> aPRAWBase:
return Subreddit(self._reddit, item["data"])
elif item["kind"] == self._reddit.comment_kind:
if item["data"]["replies"] and item["data"]["replies"]["kind"] == self._reddit.listing_kind:
from ..helpers.comment_forrest import CommentForrest
replies = CommentForrest(self._reddit, item["data"]["replies"]["data"], item["data"]["link_id"])
from ..helpers.comment_forest import CommentForest
replies = CommentForest(self._reddit, item["data"]["replies"]["data"], item["data"]["link_id"])
else:
replies = []
return Comment(self._reddit, item["data"], subreddit=self._subreddit, replies=replies)
Expand Down
4 changes: 2 additions & 2 deletions apraw/models/reddit/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ def _update(self, _data: Union[List, Dict[str, Any]]):
if isinstance(_data, dict):
data = _data
else:
from ..helpers.comment_forrest import CommentForrest
self.comments = CommentForrest(self._reddit, _data[1]["data"], self.fullname)
from ..helpers.comment_forest import CommentForest
self.comments = CommentForest(self._reddit, _data[1]["data"], self.fullname)
data = _data[0]["data"]["children"][0]

data["original_content"] = data.get("is_original_content", False)
Expand Down

0 comments on commit 838f594

Please sign in to comment.