Skip to content

Commit

Permalink
Sort praw.models.reddit.submission.SubmissionFlair.select arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
LilSpazJoekp committed Jan 8, 2022
1 parent 6cc5efa commit ab8e105
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions praw/models/reddit/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ def choices(self) -> List[Dict[str, Union[bool, list, str]]]:
url, data={"link": self.submission.fullname}
)["choices"]

def select(self, flair_template_id: str, text: Optional[str] = None):
@_deprecate_args("flair_template_id", "text")
def select(self, flair_template_id: str, *, text: Optional[str] = None):
"""Select flair for submission.
:param flair_template_id: The flair template to select. The possible
``flair_template_id`` values can be discovered through :meth:`.choices`.
:param flair_template_id: The flair template to select. The possible values can
be discovered through :meth:`.choices`.
:param text: If the template's ``flair_text_editable`` value is ``True``, this
value will set a custom text (default: ``None``).
Expand All @@ -64,7 +65,7 @@ def select(self, flair_template_id: str, text: Optional[str] = None):
choices = submission.flair.choices()
template_id = next(x for x in choices if x["flair_text_editable"])["flair_template_id"]
submission.flair.select(template_id, "my custom value")
submission.flair.select(template_id, text="my custom value")
"""
data = {
Expand Down Expand Up @@ -520,7 +521,7 @@ def flair(self) -> SubmissionFlair:
choices = submission.flair.choices()
template_id = next(x for x in choices if x["flair_text_editable"])["flair_template_id"]
submission.flair.select(template_id, "my custom value")
submission.flair.select(template_id, text="my custom value")
"""
return SubmissionFlair(self)
Expand Down

0 comments on commit ab8e105

Please sign in to comment.