Skip to content

Commit

Permalink
Merge fb3441a into ace318f
Browse files Browse the repository at this point in the history
  • Loading branch information
LilSpazJoekp committed Dec 29, 2021
2 parents ace318f + fb3441a commit 5947203
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions praw/models/reddit/mixins/__init__.py
@@ -1,5 +1,6 @@
"""Package providing reddit class mixins."""
from json import dumps
from typing import TYPE_CHECKING, Optional

from ....const import API_PATH
from .editable import EditableMixin
Expand All @@ -13,13 +14,16 @@
from .savable import SavableMixin
from .votable import VotableMixin

if TYPE_CHECKING: # pragma: no cover
import praw


class ThingModerationMixin:
r"""Provides moderation methods for :class:`.Comment`\ s and :class:`.Submission`\ s."""

REMOVAL_MESSAGE_API = None

def _add_removal_reason(self, mod_note="", reason_id=None):
def _add_removal_reason(self, mod_note: str = "", reason_id: Optional[str] = None):
"""Add a removal reason for a :class:`.Comment` or :class:`.Submission`.
:param mod_note: A message for the other moderators.
Expand Down Expand Up @@ -62,7 +66,7 @@ def approve(self):
"""
self.thing._reddit.post(API_PATH["approve"], data={"id": self.thing.fullname})

def distinguish(self, how="yes", sticky=False):
def distinguish(self, how: str = "yes", sticky: bool = False):
"""Distinguish a :class:`.Comment` or :class:`.Submission`.
:param how: One of ``"yes"``, ``"no"``, ``"admin"``, or ``"special"``. ``"yes"``
Expand Down Expand Up @@ -142,7 +146,9 @@ def lock(self):
"""
self.thing._reddit.post(API_PATH["lock"], data={"id": self.thing.fullname})

def remove(self, spam=False, mod_note="", reason_id=None):
def remove(
self, spam: bool = False, mod_note: str = "", reason_id: Optional[str] = None
):
"""Remove a :class:`.Comment` or :class:`.Submission`.
:param mod_note: A message for the other moderators.
Expand Down Expand Up @@ -176,10 +182,10 @@ def remove(self, spam=False, mod_note="", reason_id=None):

def send_removal_message(
self,
message,
title="ignored",
type="public", # pylint: disable=redefined-builtin
):
message: str,
title: str = "ignored",
type: str = "public", # pylint: disable=redefined-builtin
) -> Optional["praw.models.Comment"]:
"""Send a removal message for a :class:`.Comment` or :class:`.Submission`.
.. warning::
Expand All @@ -192,7 +198,7 @@ def send_removal_message(
Reddit adds human-readable information about the object to the message.
:param type: One of ``"public"``, ``"private"``, or ``"private_exposed"``.
``"public"`` leaves a stickied comment on the post. "private" sends a
``"public"`` leaves a stickied comment on the post. ``"private"`` sends a
modmail message with hidden username. ``"private_exposed"`` sends a modmail
message without hidden username (default: ``"public"``).
:param title: The short reason given in the message. Ignored if type is
Expand Down

0 comments on commit 5947203

Please sign in to comment.