
    {iY                      S r SSKJr  SSKrSSKJr  SSKJr  SSKJ	r	  SSK
JrJr  SSKJr  SS	KJrJrJrJr  SS
KJr  SSKJr  SSKJr  SSKrSSKJr  SSKJr  SSKJ r   SSK!J"r"J#r#  SSK$J%r%J&r&J'r'J(r(J)r)J*r*  SSK+J,r,J-r-  SSK.J/r/  SSK0J1r1  SSK+J2r2J3r3  SSK4J5r5  SSK6J7r7  SSK8J9r9J:r:  SSK;J<r<  SSK=J>r>  SSK?J@r@  SSKAJBrBJCrC  SS KDJErE  \(       a
  SS!KFJGrG  SSKHrI " S" S#5      rJ " S$ S%5      rK " S& S'5      rL " S( S)5      rM " S* S+5      rN " S, S-5      rO " S. S/5      rP " S0 S15      rQ " S2 S35      rR " S4 S55      rS " S6 S75      rT " S8 S9\Q5      rU " S: S;\Q5      rV " S< S=\:\1\9\55      rW\W\ClX         " S> S?\M5      rY " S@ SA\M5      rZg)BzProvide the Subreddit class.    )annotationsN)deepcopy)writer)StringIO)dumpsloads)Path)TYPE_CHECKINGAny	GeneratorIterator)urljoin)warn)XML)Redirect)ServerError)	HTTPError   )API_PATHJPEG_HEADER)ClientExceptionInvalidFlairTemplateIDMediaPostFailedRedditAPIExceptionTooLargeMediaExceptionWebSocketException)_deprecate_argscachedproperty   )ListingGenerator)SubredditListingMixin)permissions_stringstream_generator   )
RedditBaseSubredditEmoji)FullnameMixinMessageableMixin)ModmailConversation)SubredditRemovalReasonsSubredditRules)SubredditWidgetsWidgetEncoder)WikiPage)Responsec                     \ rS rSrSr S     SS jjrSS jr  SS jr\" SS	5      SSS
.     SS jj5       r	\" SSSS	5      SSSSS.           SS jj5       r
\" SSSS5      SS.         SS jj5       rS S jrS!S jrSrg)"Modmail1   a,  Provides modmail functions for a :class:`.Subreddit`.

For example, to send a new modmail from r/test to u/spez with the subject ``"test"``
along with a message body of ``"hello"``:

.. code-block:: python

    reddit.subreddit("test").modmail.create(subject="test", body="hello", recipient="spez")

NFc                >    [        U R                  R                  XS9$ )a  Return an individual conversation.

:param id: A reddit base36 conversation ID, e.g., ``"2gmz"``.
:param mark_read: If ``True``, conversation is marked as read (default:
    ``False``).

For example:

.. code-block:: python

    reddit.subreddit("test").modmail("2gmz", mark_read=True)

To print all messages from a conversation as Markdown source:

.. code-block:: python

    conversation = reddit.subreddit("test").modmail("2gmz", mark_read=True)
    for message in conversation.messages:
        print(message.body_markdown)

``ModmailConversation.user`` is a special instance of :class:`.Redditor` with
extra attributes describing the non-moderator user's recent posts, comments, and
modmail messages within the subreddit, as well as information on active bans and
mutes. This attribute does not exist on internal moderator discussions.

For example, to print the user's ban status:

.. code-block:: python

    conversation = reddit.subreddit("test").modmail("2gmz", mark_read=True)
    print(conversation.user.ban_status)

To print a list of recent submissions by the user:

.. code-block:: python

    conversation = reddit.subreddit("test").modmail("2gmz", mark_read=True)
    print(conversation.user.recent_posts)

)id	mark_read)r*   	subreddit_reddit)selfr6   r7   s      V/home/james-whalen/.local/lib/python3.13/site-packages/praw/models/reddit/subreddit.py__call__Modmail.__call__=   s    V #4>>#9#9bVV    c                    Xl         g)z(Initialize a :class:`.Modmail` instance.Nr8   r:   r8   s     r;   __init__Modmail.__init__j   s    "r>   other_subredditsc                d    U R                   /U=(       d    / -   nSR                  S U 5       5      $ )z9Return a comma-separated list of subreddit display names.,c              3  8   #    U  H  n[        U5      v   M     g 7fN)str).0r8   s     r;   	<genexpr>0Modmail._build_subreddit_list.<locals>.<genexpr>s   s     C
9I
   )r8   join)r:   rD   
subredditss      r;   _build_subreddit_listModmail._build_subreddit_listn   s0     nn%)9)?R@
xxC
CCCr>   state)rD   rR   c                   SU R                  U5      0nU(       a  X#S'   U R                  R                  R                  [        S   US9nUS    Vs/ s H
  oP" U5      PM     sn$ s  snf )a  Mark conversations for subreddit(s) as read.

.. note::

    Due to server-side restrictions, r/all is not a valid subreddit for this
    method. Instead, use :meth:`~.Modmail.subreddits` to get a list of
    subreddits using the new modmail.

:param other_subreddits: A list of :class:`.Subreddit` instances for which to
    mark conversations (default: ``None``).
:param state: Can be one of: ``"all"``, ``"archived"``, or ``"highlighted"``,
    ``"inprogress"``, ``"join_requests"``, ``"mod"``, ``"new"``,
    ``"notifications"``, or ``"appeals"`` (default: ``"all"``). ``"all"`` does
    not include internal, archived, or appeals conversations.

:returns: A list of :class:`.ModmailConversation` instances that were marked
    read.

For example, to mark all notifications for a subreddit as read:

.. code-block:: python

    subreddit = reddit.subreddit("test")
    subreddit.modmail.bulk_read(state="notifications")

entityrR   modmail_bulk_readparamsconversation_ids)rP   r8   r9   postr   )r:   rD   rR   rW   responseconversation_ids         r;   	bulk_readModmail.bulk_readu   s    B D667GHI#7O>>))..()& / 
 :BBT9U
9UoD!9U
 	
 
s   A%aftersort)r^   rD   r_   rR   c                  0 nU(       a  [        S[        SS9  XS'   U R                  S:w  a  U R                  U5      US'   [        R
                  " S
USX4S.UD6  [        U R                  R                  [        S	   40 UD6$ )a(  Generate :class:`.ModmailConversation` objects for subreddit(s).

:param after: A base36 modmail conversation id. When provided, the listing
    begins after this conversation (default: ``None``).

    .. deprecated:: 7.4.0

        This parameter is deprecated and will be removed in PRAW 8.0. This
        method will automatically fetch the next batch. Please pass it in the
        ``params`` argument like so:

        .. code-block:: python

            for convo in subreddit.modmail.conversations(params={"after": "qovbn"}):
                # process conversation
                ...

:param other_subreddits: A list of :class:`.Subreddit` instances for which to
    fetch conversations (default: ``None``).
:param sort: Can be one of: ``"mod"``, ``"recent"``, ``"unread"``, or ``"user"``
    (default: ``"recent"``).
:param state: Can be one of: ``"all"``, ``"archived"``, ``"highlighted"``,
    ``"inprogress"``, ``"join_requests"``, ``"mod"``, ``"new"``,
    ``"notifications"``, or ``"appeals"`` (default: ``"all"``). ``"all"`` does
    not include internal, archived, or appeals conversations.

Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.

For example:

.. code-block:: python

    conversations = reddit.subreddit("all").modmail.conversations(state="mod")

z[The 'after' argument is deprecated and should be moved to the 'params' dictionary argument.r   category
stacklevelr^   allrT   rW   )	argumentskeyr_   rR   modmail_conversations )	r   DeprecationWarningr8   rP   	Subreddit_safely_add_argumentsr    r9   r   )r:   r^   rD   r_   rR   generator_kwargsrW   s          r;   conversationsModmail.conversations   s    \ (+	 $7O>>U"#99:JKF8'' 	
&H4	
PV	
  NN"",-
 
 	
r>   subjectbody	recipientauthor_hidden)rr   c               |    UUU R                   UUS.nU R                   R                  R                  [        S   US9$ )ab  Create a new :class:`.ModmailConversation`.

:param author_hidden: When ``True``, author is hidden from non-moderators
    (default: ``False``).
:param body: The message body. Cannot be empty.
:param recipient: The recipient; a username or an instance of
    :class:`.Redditor`.
:param subject: The message subject. Cannot be empty.

:returns: A :class:`.ModmailConversation` object for the newly created
    conversation.

.. code-block:: python

    subreddit = reddit.subreddit("test")
    redditor = reddit.redditor("bboe")
    subreddit.modmail.create(subject="Subject", body="Body", recipient=redditor)

)rp   isAuthorHiddensrNamero   torg   data)r8   r9   rY   r   )r:   rr   rp   rq   ro   rx   s         r;   createModmail.create   sG    : +nn
 ~~%%**84K+LSW*XXr>   c              #    #    U R                   R                  R                  [        S   5      nUS   R	                  5        H9  nU R                   R                  R                  US   5      nUS   Ul        Uv   M;     g7f)zYield subreddits using the new modmail that the user moderates.

For example:

.. code-block:: python

    subreddits = reddit.subreddit("all").modmail.subreddits()

modmail_subredditsrO   display_namelastUpdatedN)r8   r9   getr   valueslast_updated)r:   rZ   valuer8   s       r;   rO   Modmail.subreddits  sp      >>))--h7K.LMl+224E..88~9NOI%*=%9I"O 5s   A>B c                Z    U R                   R                  R                  [        S   5      $ )a  Return unread conversation count by conversation state.

At time of writing, possible states are: ``"archived"``, ``"highlighted"``,
``"inprogress"``, ``"join_requests"``, ``"mod"``, ``"new"``,
``"notifications"``, or ``"appeals"``.

:returns: A dict mapping conversation states to unread counts.

For example, to print the count of unread moderator discussions:

.. code-block:: python

    subreddit = reddit.subreddit("test")
    unread_counts = subreddit.modmail.unread_count()
    print(unread_counts["mod"])

modmail_unread_count)r8   r9   r   r   r:   s    r;   unread_countModmail.unread_count  s%    $ ~~%%))(3I*JKKr>   r@   )NF)r6   
str | Noner7   boolreturnr*   r8   praw.models.SubredditrD   "list[praw.models.Subreddit] | None)rD   z(list[praw.models.Subreddit | str] | NonerR   r   r   zlist[ModmailConversation])r^   r   rD   r   r_   r   rR   r   rl   r   r   zIterator[ModmailConversation])
rr   r   rp   rI   rq   str | praw.models.Redditorro   rI   r   r*   r   z,Generator[praw.models.Subreddit, None, None])r   zdict[str, int])__name__
__module____qualname____firstlineno____doc__r<   rB   rP   r   r\   rm   ry   rO   r   __static_attributes__rh   r>   r;   r3   r3   1   s^   	 8=+W+W04+W	+WZ#D BD '1 FJ 	(
 C(
 	(

 
#(
 2(
T W0&'B !?C ?
 ?
 =	?

 ?
 ?
  ?
 
'?
 C?
B Y_E $"Y "Y 	"Y
 ."Y "Y 
"Y F"YH Lr>   r3   c                  @    \ rS rSrSrS	S jrS
S jrSS jrSS jrSr	g)SubredditFiltersi,  a  Provide functions to interact with the special :class:`.Subreddit`'s filters.

Members of this class should be utilized via :meth:`.Subreddit.filters`. For
example, to add a filter, run:

.. code-block:: python

    reddit.subreddit("all").filters.add("test")

c                    Xl         g)zInitialize a :class:`.SubredditFilters` instance.

:param subreddit: The special subreddit whose filters to work with.

As of this writing filters can only be used with the special subreddits ``all``
and ``mod``.

Nr@   rA   s     r;   rB   SubredditFilters.__init__8  s	     #r>   c              #  \  #    [         S   R                  U R                  U R                  R                  R                  R                  5       S9nSU R                  R                  R                  0nU R                  R                  R                  XS9nUR                   Sh  vN   g N7f)zIterate through the special :class:`.Subreddit`'s filters.

This method should be invoked as:

.. code-block:: python

    for subreddit in reddit.subreddit("test").filters:
        ...

subreddit_filter_list)specialuseruniquerV   N)	r   formatr8   r9   r   me_next_uniquer   rO   )r:   urlrW   response_datas       r;   __iter__SubredditFilters.__iter__C  s      ./66NN)?)?)D)D)G)G)I 7 
 DNN22??@..2232F ++++s   B"B,$B*%B,c           
        [         S   R                  U R                  U R                  R                  R                  R                  5       US9nU R                  R                  R                  US[        S[        U5      05      0S9  g)a  Add ``subreddit`` to the list of filtered subreddits.

:param subreddit: The subreddit to add to the filter list.

Items from subreddits added to the filtered list will no longer be included when
obtaining listings for r/all.

Alternatively, you can filter a subreddit temporarily from a special listing in
a manner like so:

.. code-block:: python

    reddit.subreddit("all-redditdev-learnpython")

:raises: ``prawcore.NotFound`` when calling on a non-special subreddit.

subreddit_filterr   r   r8   modelnamerw   N)	r   r   r8   r9   r   r   putr   rI   r:   r8   r   s      r;   addSubredditFilters.addU  sw    $ )*11NN'',,//1 2 

 	""3gufc)n=U7V-W"Xr>   c                    [         S   R                  U R                  U R                  R                  R                  R                  5       [        U5      S9nU R                  R                  R                  U5        g)zRemove ``subreddit`` from the list of filtered subreddits.

:param subreddit: The subreddit to remove from the filter list.

:raises: ``prawcore.NotFound`` when calling on a non-special subreddit.

r   r   N)r   r   r8   r9   r   r   rI   deleter   s      r;   removeSubredditFilters.removen  sc     )*11NN'',,//1)n 2 

 	%%c*r>   r@   Nr   r   )r8   zpraw.models.Subreddit | str)
r   r   r   r   r   rB   r   r   r   r   rh   r>   r;   r   r   ,  s    		#,$Y2+r>   r   c                  B   \ rS rSrSr\  SS j5       r\  SS j5       r S      S!S jjrS"S jr	\
" S	S
SS5      SSSSS.         S#S jj5       rS$S jrS%S jr\
" SSSS5      SSSS.       S&S jj5       r\
" SSS5      SSS.       S'S jj5       rSrg)(SubredditFlairi~  zJProvide a set of functions to interact with a :class:`.Subreddit`'s flair.c                ,    [        U R                  5      $ )a  Provide an instance of :class:`.SubredditLinkFlairTemplates`.

Use this attribute for interacting with a :class:`.Subreddit`'s link flair
templates. For example to list all the link flair templates for a subreddit
which you have the ``flair`` moderator permission on try:

.. code-block:: python

    for template in reddit.subreddit("test").flair.link_templates:
        print(template)

)SubredditLinkFlairTemplatesr8   r   s    r;   link_templatesSubredditFlair.link_templates  s      +4>>::r>   c                ,    [        U R                  5      $ )az  Provide an instance of :class:`.SubredditRedditorFlairTemplates`.

Use this attribute for interacting with a :class:`.Subreddit`'s flair templates.
For example to list all the flair templates for a subreddit which you have the
``flair`` moderator permission on try:

.. code-block:: python

    for template in reddit.subreddit("test").flair.templates:
        print(template)

)SubredditRedditorFlairTemplatesr8   r   s    r;   	templatesSubredditFlair.templates  s      /t~~>>r>   Nredditorc                    [         R                  USUS9  UR                  SS5        [        S   R	                  U R
                  S9n[        U R
                  R                  U40 UD6$ )a  Return a :class:`.ListingGenerator` for Redditors and their flairs.

:param redditor: When provided, yield at most a single :class:`.Redditor`
    instance (default: ``None``).

Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.

Usage:

.. code-block:: python

    for flair in reddit.subreddit("test").flair(limit=None):
        print(flair)

rW   )re   rf   r   limitN	flairlistr@   )rj   rk   
setdefaultr   r   r8   r    r9   r:   r   rl   r   s       r;   r<   SubredditFlair.__call__  si    * 	''&H8 	( 	
 	##GT2{#**T^^*D 6 6P?OPPr>   c                    Xl         g)zlInitialize a :class:`.SubredditFlair` instance.

:param subreddit: The subreddit whose flair to work with.

Nr@   rA   s     r;   rB   SubredditFlair.__init__  	     #r>   positionself_assignlink_positionlink_self_assignleftFright)r   r   r   r   c                   [        U5      U=(       d    SUU=(       d    SUS.nUR                  U5        [        S   R                  U R                  S9nU R                  R
                  R                  XvS9  g)a  Update the :class:`.Subreddit`'s flair configuration.

:param link_position: One of ``"left"``, ``"right"``, or ``False`` to disable
    (default: ``"left"``).
:param link_self_assign: Permit self assignment of link flair (default:
    ``False``).
:param position: One of ``"left"``, ``"right"``, or ``False`` to disable
    (default: ``"right"``).
:param self_assign: Permit self assignment of user flair (default: ``False``).

.. code-block:: python

    subreddit = reddit.subreddit("test")
    subreddit.flair.configure(link_position="right", self_assign=True)

Additional keyword arguments can be provided to handle new settings as Reddit
introduces them.

r    )flair_enabledflair_positionflair_self_assign_enabledlink_flair_positionlink_flair_self_assign_enabledflairconfigr@   rw   N)r   updater   r   r8   r9   rY   )r:   r   r   r   r   settingsrx   r   s           r;   	configureSubredditFlair.configure  sm    < "(^&1')4#0#6B.>
 	H}%,,t~~,F##C#3r>   c                    [         S   R                  U R                  S9nU R                  R                  R	                  US[        U5      0S9  g)zDelete flair for a :class:`.Redditor`.

:param redditor: A redditor name or :class:`.Redditor` instance.

.. seealso::

    :meth:`~.SubredditFlair.update` to delete the flair of many redditors at
    once.

deleteflairr@   r   rw   N)r   r   r8   r9   rY   rI   )r:   r   r   s      r;   r   SubredditFlair.delete  sF     }%,,t~~,F##Cvs8}.E#Fr>   c                <    U R                  S U " 5        5       5      $ )zDelete all :class:`.Redditor` flair in the :class:`.Subreddit`.

:returns: List of dictionaries indicating the success or failure of each delete.

c              3  *   #    U  H	  oS    v   M     g7f)r   Nrh   )rJ   xs     r;   rK   ,SubredditFlair.delete_all.<locals>.<genexpr>  s     5fV9fs   )r   r   s    r;   
delete_allSubredditFlair.delete_all  s     {{5df555r>   text	css_classflair_template_idr   )r   r   r   c               ,   U(       a  Ub  Sn[        U5      e[        U5      US.nUb%  X6S'   [        S   R                  U R                  S9nO$X&S'   [        S   R                  U R                  S9nU R                  R
                  R                  XvS	9  g)
ai  Set flair for a :class:`.Redditor`.

:param redditor: A redditor name or :class:`.Redditor` instance.
:param text: The flair text to associate with the :class:`.Redditor` or
    :class:`.Submission` (default: ``""``).
:param css_class: The css class to associate with the flair html (default:
    ``""``). Use either this or ``flair_template_id``.
:param flair_template_id: The ID of the flair template to be used (default:
    ``None``). Use either this or ``css_class``.

This method can only be used by an authenticated user who is a moderator of the
associated :class:`.Subreddit`.

For example:

.. code-block:: python

    reddit.subreddit("test").flair.set("bboe", text="PRAW author", css_class="mods")
    template = "6bd28436-1aa7-11e9-9902-0e05ab0fad46"
    reddit.subreddit("test").flair.set(
        "spez", text="Reddit CEO", flair_template_id=template
    )

NzMParameter 'css_class' cannot be used in conjunction with 'flair_template_id'.)r   r   r   select_flairr@   r   flairrw   )	TypeErrorrI   r   r   r8   r9   rY   )r:   r   r   r   r   msgrx   r   s           r;   setSubredditFlair.set  s    B *6aCC. Ht4((9$%>*11DNN1KC )7#**T^^*DC##C#3r>   
flair_list)r   r   c          	        [        5       nU H  n[        U[        5      (       aK  [        U5      R	                  [        US   5      UR                  SU5      UR                  SU5      /5        Mc  [        U5      R	                  [        U5      X#/5        M     UR                  5       R                  5       nUR                  5         / n[        S   R                  U R                  S9nU(       aV  SSR                  USS	 5      0n	UR                  U R                  R                  R!                  XS
95        US	S nU(       a  MV  U$ )a&  Set or clear the flair for many redditors at once.

:param flair_list: Each item in this list should be either:

    - The name of a redditor.
    - An instance of :class:`.Redditor`.
    - A dictionary mapping keys ``"user"``, ``"flair_text"``, and
      ``"flair_css_class"`` to their respective values. The ``"user"`` key
      should map to a redditor, as described above. When a dictionary isn't
      provided, or the dictionary is missing either ``"flair_text"`` or
      ``"flair_css_class"`` keys, the default values will come from the other
      arguments.
:param css_class: The css class to use when not explicitly provided in
    ``flair_list`` (default: ``""``).
:param text: The flair text to use when not explicitly provided in
    ``flair_list`` (default: ``""``).

:returns: List of dictionaries indicating the success or failure of each update.

For example, to clear the flair text, and set the ``"praw"`` flair css class on
a few users try:

.. code-block:: python

    subreddit.flair.update(["bboe", "spez", "spladug"], css_class="praw")

r   
flair_textflair_css_classflaircsvr@   	flair_csv
Nd   rw   )r   
isinstancedictr   writerowrI   r   getvalue
splitlinescloser   r   r8   rN   extendr9   rY   )
r:   r   r   r   
temp_linesitemlinesrZ   r   rx   s
             r;   r   SubredditFlair.update4  s!   J Z
D$%%z"++DL)t4!2I> z"++SY,HI  ##%002z"))DNN)C5#;!78DOODNN22777GH#$KE e r>   r@   )r   z8praw.models.reddit.subreddit.SubredditLinkFlairTemplates)r   z<praw.models.reddit.subreddit.SubredditRedditorFlairTemplatesrH   )r   !praw.models.Redditor | str | Nonerl   r   r   Iterator[praw.models.Redditor]r   )
r   rI   r   r   r   rI   r   r   r   r   )r   praw.models.Redditor | str)r   ,list[dict[str, str | bool | dict[str, str]]])r   r  r   rI   r   r   r   rI   )r   zLIterator[str | praw.models.Redditor | dict[str, str | praw.models.Redditor]]r   rI   r   rI   r   r  )r   r   r   r   r   r   r   r   r<   rB   r   r   r   r   r   r   r   rh   r>   r;   r   r   ~  sw   T;	A; ;" ?	E? ?& 7;Q3Q  Q 
(	Q8# ZAST $!&!%4 %4 	%4
 %4 %4 %4 U%4NG6 Z6IJ
 (,*4,*4 	*4
 &*4 *4 K*4X \6;7 9
9 9 9 
69 89r>   r   c                     \ rS rSrSr\SS j5       rSS jrS rSSSSSSSSS	.                 SS jjr	SS.S S jjr
SS.S!S jjrS"S jr\" SSSSSSSS
SS5
      SSSSSSSSSS.	                   S#S jj5       rSrg)$SubredditFlairTemplatesiq  zKProvide functions to interact with a :class:`.Subreddit`'s flair templates.c                    U (       a  S$ S$ )zKReturn ``"LINK_FLAIR"`` or ``"USER_FLAIR"`` depending on ``is_link`` value.
LINK_FLAIR
USER_FLAIRrh   is_links    r;   
flair_type"SubredditFlairTemplates.flair_typet  s      '|8L8r>   c                    Xl         g)aJ  Initialize a :class:`.SubredditFlairTemplates` instance.

:param subreddit: The subreddit whose flair templates to work with.

.. note::

    This class should not be initialized directly. Instead, obtain an instance
    via: ``reddit.subreddit("test").flair.templates`` or
    ``reddit.subreddit("test").flair.link_templates``.

Nr@   rA   s     r;   rB    SubredditFlairTemplates.__init__y  	     #r>   c                    [         e)z*Abstract method to return flair templates.)NotImplementedErrorr   s    r;   r    SubredditFlairTemplates.__iter__  s    !!r>   Nr   F)allowable_contentbackground_colorr   r  
max_emojismod_only
text_colortext_editabler  r  r   r  r  r   r  r  c       	            [         S   R                  U R                  S9n
UUUU R                  U5      U[	        U5      UU[	        U	5      S.	nU R                  R
                  R                  XS9  g )Nflairtemplate_v2r@   )	r  r  r   r  r  r  r   r  r  rw   )r   r   r8   r  r   r9   rY   )r:   r  r  r   r  r  r  r   r  r  r   rx   s               r;   _addSubredditFlairTemplates._add  sr     )*11DNN1K!2 0"//'2$X$!-0

 	##C#3r>   r
  c                   [         S   R                  U R                  S9nU R                  R                  R	                  USU R                  U5      0S9  g )Nflairtemplateclearr@   r  rw   )r   r   r8   r9   rY   r  )r:   r  r   s      r;   _clearSubredditFlairTemplates._clear  sJ    +,33dnn3M##C|T__W=U.V#Wr>   c                   [         S   R                  U R                  S9nU R                  R                  R	                  UU R                  U5      U R                  R                  S.US9  g )Nflairtemplatereorderr@   )r  r8   )rW   json)r   r   r8   r9   patchr  r}   )r:   r   r  r   s       r;   _reorder SubredditFlairTemplates._reorder  sb    -.555O$$"oog6!^^88  	% 	
r>   template_idc                    [         S   R                  U R                  S9nU R                  R                  R	                  USU0S9  g)a  Remove a flair template provided by ``template_id``.

For example, to delete the first :class:`.Redditor` flair template listed, try:

.. code-block:: python

    template_info = list(subreddit.flair.templates)[0]
    subreddit.flair.templates.delete(template_info["id"])

flairtemplatedeleter@   r   rw   Nr   r   r8   r9   rY   )r:   r(  r   s      r;   r   SubredditFlairTemplates.delete  sD     ,-44t~~4N##C/BK.P#Qr>   fetchT)	r  r  r   r-  r  r  r   r  r  c       	   
        [         S   R                  U R                  S9nUUUUUUUU	U
S.	nU(       aw  [        U 5       Vs/ s H  oS   U:X  d  M  UPM     nn[	        U5      S:w  a  [        U5      eUS   nUR                  5        H  u  nnUR                  U5      b  M  UUU'   M!     U R                  R                  R                  XS9  gs  snf )	a  Update the flair template provided by ``template_id``.

:param template_id: The flair template to update. If not valid then an exception
    will be thrown.
:param allowable_content: If specified, most be one of ``"all"``, ``"emoji"``,
    or ``"text"`` to restrict content to that type. If set to ``"emoji"`` then
    the ``"text"`` param must be a valid emoji string, for example,
    ``":snoo:"``.
:param background_color: The flair template's new background color, as a hex
    color.
:param css_class: The flair template's new css_class (default: ``""``).
:param fetch: Whether PRAW will fetch existing information on the existing flair
    before updating (default: ``True``).
:param max_emojis: Maximum emojis in the flair (Reddit defaults this value to
    ``10``).
:param mod_only: Indicate if the flair can only be used by moderators.
:param text: The flair template's new text.
:param text_color: The flair template's new text color, either ``"light"`` or
    ``"dark"``.
:param text_editable: Indicate if the flair text can be modified for each
    redditor that sets it (default: ``False``).

.. warning::

    If parameter ``fetch`` is set to ``False``, all parameters not provided will
    be reset to their default (``None`` or ``False``) values.

For example, to make a user flair template text editable, try:

.. code-block:: python

    template_info = list(subreddit.flair.templates)[0]
    subreddit.flair.templates.update(
        template_info["id"],
        text=template_info["flair_text"],
        text_editable=True,
    )

r  r@   )	r  r  r   r   r  r  r   r  r  r6   r$   r   Nrw   )
r   r   r8   iterlenr   itemsr   r9   rY   )r:   r(  r  r  r   r-  r  r  r   r  r  r   rx   template_existing_dataexisting_datarf   r   s                     r;   r   SubredditFlairTemplates.update  s    B )*11DNN1K!2 0"!,$ $*

 )-d)3X~7T   >"a',[99*1-M+113
U88C=( %DI 4 	##C#3s   CCr@   )r  r   r   rI   r   )r  r   r  r   r   rI   r  bool | Noner  
int | Noner  r6  r   rI   r  r   r  r   )r  r6  )r   listr  r6  )r(  rI   )r(  rI   r  r   r  r   r   r   r-  r   r  r7  r  r6  r   r   r  r   r  r6  )r   r   r   r   r   staticmethodr  rB   r   r  r   r&  r   r   r   r   rh   r>   r;   r  r  q  sy   U9 9#" )-'+#!% $!%#4 &4 %	4
 4 4 4 4 4 4 46 04 X DH 	
R   )-'+ $!% $!%%)K4K4 &	K4
 %K4 K4 K4 K4 K4 K4 K4 #K4K4r>   r  c                     \ rS rSrSr\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
SS jrS	 r\" S5      S
S.     SS jj5       rS S jr\" SS5      S
S
S.       S!S jj5       r\" S5      S
S.     S"S jj5       r\" S5      S
S.     S"S jj5       rS#S jr\" S5      S
S.     S"S jj5       rS$S jrS S jrS%S jrSrg
)&SubredditModerationi  zProvides a set of moderation functions to a :class:`.Subreddit`.

For example, to accept a moderation invite from r/test:

.. code-block:: python

    reddit.subreddit("test").mod.accept_invite()

onlyc                H    Ub  US:X  a  Sn[         R                  " U SUS9  g g )NsubmissionslinksrW   )re   rf   r<  )r%   rk   rl   r<  s     r;   _handle_only SubredditModeration._handle_only(  s/    }$,,*t r>   c                X    SSK Jn  U" U R                  R                  U R                  S9$ )az  Provide an instance of :class:`.SubredditModNotes`.

This provides an interface for managing moderator notes for this subreddit.

For example, all the notes for u/spez in r/test can be iterated through like so:

.. code-block:: python

    subreddit = reddit.subreddit("test")

    for note in subreddit.mod.notes.redditors("spez"):
        print(f"{note.label}: {note.note}")

r   )SubredditModNotesr@   )praw.models.mod_notesrD  r8   r9   )r:   rD  s     r;   notesSubredditModeration.notes1  s"      	< !7!74>>RRr>   c                ,    [        U R                  5      $ )a  Provide an instance of :class:`.SubredditRemovalReasons`.

Use this attribute for interacting with a :class:`.Subreddit`'s removal reasons.
For example to list all the removal reasons for a subreddit which you have the
``posts`` moderator permission on, try:

.. code-block:: python

    for removal_reason in reddit.subreddit("test").mod.removal_reasons:
        print(removal_reason)

A single removal reason can be lazily retrieved via:

.. code-block:: python

    reddit.subreddit("test").mod.removal_reasons["reason_id"]

.. note::

    Attempting to access attributes of an nonexistent removal reason will result
    in a :class:`.ClientException`.

)r+   r8   r   s    r;   removal_reasons#SubredditModeration.removal_reasonsE  s    2 't~~66r>   c                ,    [        U R                  5      $ )aV  Provide an instance of :class:`.SubredditModerationStream`.

Streams can be used to indefinitely retrieve Moderator only items from
:class:`.SubredditModeration` made to moderated subreddits, like:

.. code-block:: python

    for log in reddit.subreddit("mod").mod.stream.log():
        print(f"Mod: {log.mod}, Subreddit: {log.subreddit}")

)SubredditModerationStreamr8   r   s    r;   streamSubredditModeration.stream`  s     )88r>   c                    Xl         SU l        g)zdInitialize a :class:`.SubredditModeration` instance.

:param subreddit: The subreddit to moderate.

N)r8   _streamrA   s     r;   rB   SubredditModeration.__init__o  s     #r>   c                    [         S   R                  U R                  S9nU R                  R                  R	                  U5        g)z5Accept an invitation as a moderator of the community.accept_mod_inviter@   Nr+  r:   r   s     r;   accept_invite!SubredditModeration.accept_invitex  s7    *+22T^^2L##C(r>   Nr<  c                   U R                  X!S9  [        U R                  R                  [        S   R                  U R                  S940 UD6$ )a  Return a :class:`.ListingGenerator` for edited comments and submissions.

:param only: If specified, one of ``"comments"`` or ``"submissions"`` to yield
    only results of that type.

Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.

To print all items in the edited queue try:

.. code-block:: python

    for item in reddit.subreddit("mod").mod.edited(limit=None):
        print(item)

r@  about_editedr@   rA  r    r8   r9   r   r   r:   r<  rl   s      r;   editedSubredditModeration.edited}  sT    ( 	+;GNN""^$++dnn+E
 
 	
r>   c                    [        S[        SS9  [        U R                  R                  [
        S   R                  U R                  S940 UD6$ )a  Return a :class:`.ListingGenerator` for moderator messages.

.. warning::

    Legacy modmail is being deprecated in June 2021. Please see
    https://www.reddit.com/r/modnews/comments/mar9ha/even_more_modmail_improvements/
    for more info.

Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.

.. seealso::

    :meth:`.unread` for unread moderator messages.

To print the last 5 moderator mail messages and their replies, try:

.. code-block:: python

    for message in reddit.subreddit("mod").mod.inbox(limit=5):
        print(f"From: {message.author}, Body: {message.body}")
        for reply in message.replies:
            print(f"From: {reply.author}, Body: {reply.body}")

Legacy modmail is being deprecated in June 2021. Please see https://www.reddit.com/r/modnews/comments/mar9ha/even_more_modmail_improvements/ for more info.r   ra   moderator_messagesr@   r   ri   r    r8   r9   r   r   r:   rl   s     r;   inboxSubredditModeration.inbox  sZ    4 	 (	
  NN"")*11DNN1K
 
 	
r>   actionmodre  rf  c                   U(       a  [        U5      OUUS.n[        R                  " SUSS.UD6  [        U R                  R
                  [        S   R                  U R                  S940 UD6$ )a  Return a :class:`.ListingGenerator` for moderator log entries.

:param action: If given, only return log entries for the specified action.
:param mod: If given, only return log entries for actions made by the passed in
    redditor.

Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.

To print the moderator and subreddit of the last 5 modlog entries try:

.. code-block:: python

    for log in reddit.subreddit("mod").mod.log(limit=5):
        print(f"Mod: {log.mod}, Subreddit: {log.subreddit}")

)rf  typerW   )re   rf   	about_logr@   rh   )rI   rj   rk   r    r8   r9   r   r   )r:   re  rf  rl   rW   s        r;   logSubredditModeration.log  sv    2 &)Sc6B'' 	
&H	
8>	
  NN""[!((4>>(B
 
 	
r>   c                   U R                  X!S9  [        U R                  R                  [        S   R                  U R                  S940 UD6$ )a  Return a :class:`.ListingGenerator` for modqueue items.

:param only: If specified, one of ``"comments"`` or ``"submissions"`` to yield
    only results of that type.

Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.

To print all modqueue items try:

.. code-block:: python

    for item in reddit.subreddit("mod").mod.modqueue(limit=None):
        print(item)

r@  about_modqueuer@   rZ  r[  s      r;   modqueueSubredditModeration.modqueue  sU    ( 	+;GNN""%&---G
 
 	
r>   c                   U R                  X!S9  [        U R                  R                  [        S   R                  U R                  S940 UD6$ )a-  Return a :class:`.ListingGenerator` for reported comments and submissions.

:param only: If specified, one of ``"comments"`` or ``"submissions"`` to yield
    only results of that type.

Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.

To print the user and mod report reasons in the report queue try:

.. code-block:: python

    for reported_item in reddit.subreddit("mod").mod.reports():
        print(f"User Reports: {reported_item.user_reports}")
        print(f"Mod Reports: {reported_item.mod_reports}")

r@  about_reportsr@   rZ  r[  s      r;   reportsSubredditModeration.reports  sT    * 	+;GNN""_%,,t~~,F
 
 	
r>   c                    [         S   R                  U R                  S9nU R                  R                  R	                  U5      S   $ )zBReturn a dictionary of the :class:`.Subreddit`'s current settings.subreddit_settingsr@   rx   r   r   r8   r9   r   rT  s     r;   r   SubredditModeration.settings  s?    +,33dnn3M~~%%))#.v66r>   c                   U R                  X!S9  [        U R                  R                  [        S   R                  U R                  S940 UD6$ )a  Return a :class:`.ListingGenerator` for spam comments and submissions.

:param only: If specified, one of ``"comments"`` or ``"submissions"`` to yield
    only results of that type.

Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.

To print the items in the spam queue try:

.. code-block:: python

    for item in reddit.subreddit("mod").mod.spam():
        print(item)

r@  
about_spamr@   rZ  r[  s      r;   spamSubredditModeration.spam  sT    ( 	+;GNN""\"))DNN)C
 
 	
r>   c                    [        U R                  R                  [        S   R	                  U R                  S940 UD6$ )a:  Return a :class:`.ListingGenerator` for unmoderated submissions.

Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.

To print the items in the unmoderated queue try:

.. code-block:: python

    for item in reddit.subreddit("mod").mod.unmoderated():
        print(item)

about_unmoderatedr@   )r    r8   r9   r   r   rb  s     r;   unmoderatedSubredditModeration.unmoderated9  sC      NN""()004>>0J
 
 	
r>   c                    [        S[        SS9  [        U R                  R                  [
        S   R                  U R                  S940 UD6$ )aP  Return a :class:`.ListingGenerator` for unread moderator messages.

.. warning::

    Legacy modmail is being deprecated in June 2021. Please see
    https://www.reddit.com/r/modnews/comments/mar9ha/even_more_modmail_improvements/
    for more info.

Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.

.. seealso::

    :meth:`.inbox` for all messages.

To print the mail in the unread modmail queue try:

.. code-block:: python

    for message in reddit.subreddit("mod").mod.unread():
        print(f"From: {message.author}, To: {message.dest}")

r_  r   ra   moderator_unreadr@   ra  rb  s     r;   unreadSubredditModeration.unreadM  sZ    0 	 (	
  NN""'(//$../I
 
 	
r>   c                   SSSSSS.nUR                  5        VVs0 s H  u  p4UR                  X35      U_M     nnnU R                  R                  US'   U R                  R                  R                  [        S   US	9$ s  snnf )
a  Update the :class:`.Subreddit`'s settings.

See https://www.reddit.com/dev/api#POST_api_site_admin for the full list.

:param all_original_content: Mandate all submissions to be original content
    only.
:param allow_chat_post_creation: Allow users to create chat submissions.
:param allow_images: Allow users to upload images using the native image
    hosting.
:param allow_polls: Allow users to post polls to the subreddit.
:param allow_post_crossposts: Allow users to crosspost submissions from other
    subreddits.
:param allow_videos: Allow users to upload videos using the native image
    hosting.
:param collapse_deleted_comments: Collapse deleted and removed comments on
    comments pages by default.
:param comment_score_hide_mins: The number of minutes to hide comment scores.
:param content_options: The types of submissions users can make. One of
    ``"any"``, ``"link"``, or ``"self"``.
:param crowd_control_chat_level: Controls the crowd control level for chat
    rooms. Goes from 0-3.
:param crowd_control_level: Controls the crowd control level for submissions.
    Goes from 0-3.
:param crowd_control_mode: Enables/disables crowd control.
:param default_set: Allow the subreddit to appear on r/all as well as the
    default and trending lists.
:param disable_contributor_requests: Specifies whether redditors may send
    automated modmail messages requesting approval as a submitter.
:param exclude_banned_modqueue: Exclude posts by site-wide banned users from
    modqueue/unmoderated.
:param free_form_reports: Allow users to specify custom reasons in the report
    menu.
:param header_hover_text: The text seen when hovering over the snoo.
:param hide_ads: Don't show ads within this subreddit. Only applies to
    Premium-user only subreddits.
:param key_color: A 6-digit rgb hex color (e.g., ``"#AABBCC"``), used as a
    thematic color for your subreddit on mobile.
:param language: A valid IETF language tag (underscore separated).
:param original_content_tag_enabled: Enables the use of the ``original content``
    label for submissions.
:param over_18: Viewers must be over 18 years old (i.e., NSFW).
:param public_description: Public description blurb. Appears in search results
    and on the landing page for private subreddits.
:param restrict_commenting: Specifies whether approved users have the ability to
    comment.
:param restrict_posting: Specifies whether approved users have the ability to
    submit posts.
:param show_media: Show thumbnails on submissions.
:param show_media_preview: Expand media previews on comments pages.
:param spam_comments: Spam filter strength for comments. One of ``"all"``,
    ``"low"``, or ``"high"``.
:param spam_links: Spam filter strength for links. One of ``"all"``, ``"low"``,
    or ``"high"``.
:param spam_selfposts: Spam filter strength for selfposts. One of ``"all"``,
    ``"low"``, or ``"high"``.
:param spoilers_enabled: Enable marking posts as containing spoilers.
:param submit_link_label: Custom label for submit link button (``None`` for
    default).
:param submit_text: Text to show on submission page.
:param submit_text_label: Custom label for submit text post button (``None`` for
    default).
:param subreddit_type: One of ``"archived"``, ``"employees_only"``,
    ``"gold_only"``, ``gold_restricted``, ``"private"``, ``"public"``, or
    ``"restricted"``.
:param suggested_comment_sort: All comment threads will use this sorting method
    by default. Leave ``None``, or choose one of ``"confidence"``,
    ``"controversial"``, ``"live"``, ``"new"``, ``"old"``, ``"qa"``,
    ``"random"``, or ``"top"``.
:param title: The title of the subreddit.
:param welcome_message_enabled: Enables the subreddit welcome message.
:param welcome_message_text: The text to be used as a welcome message. A welcome
    message is sent to all new subscribers by a Reddit bot.
:param wiki_edit_age: Account age, in days, required to edit and create wiki
    pages.
:param wiki_edit_karma: Subreddit karma required to edit and create wiki pages.
:param wikimode: One of ``"anyone"``, ``"disabled"``, or ``"modonly"``.

.. note::

    Updating the subreddit sidebar on old reddit (``description``) is no longer
    supported using this method. You can update the sidebar by editing the
    ``"config/sidebar"`` wiki page. For example:

    .. code-block:: python

        sidebar = reddit.subreddit("test").wiki["config/sidebar"]
        sidebar.edit(content="new sidebar content")

Additional keyword arguments can be provided to handle new settings as Reddit
introduces them.

Settings that are documented here and aren't explicitly set by you in a call to
:meth:`.SubredditModeration.update` should retain their current value. If they
do not, please file a bug.

	link_type	allow_topheader_titlelangri  )content_optionsdefault_setheader_hover_textlanguagesubreddit_typesrupdate_settingsr$  )r1  r   r8   fullnamer9   r%  r   )r:   r   remaprf   r   s        r;   r   SubredditModeration.updater  s    F  +&!/$
 BJAQRAQ:3EIIc'.AQR00~~%%++H5F,Gh+WW Ss   B)rP  r8   )rl   dict[str, Any]r<  r   )r   zpraw.models.SubredditModNotes)r   r+   )r   z6praw.models.reddit.subreddit.SubredditModerationStreamr   )r<  r   rl   r   r   z6Iterator[praw.models.Comment | praw.models.Submission])rl   r   r   z&Iterator[praw.models.SubredditMessage])re  r   rf  r  rl   r   r   zIterator[praw.models.ModAction])r<  r   rl   r   r   z6Iterator[praw.models.Submission | praw.models.Comment]r   dict[str, str | int | bool])rl   r   r    Iterator[praw.models.Submission])r   zstr | int | boolr   r  )r   r   r   r   r   r9  rA  r   rF  rI  rM  rB   rU  r   r\  rc  rk  ro  rs  r   r{  r  r  r   r   rh   r>   r;   r;  r;    s      S S& 7 74 9 9)
 V$(
!
>A
	?
 
4%
N Xu% "15	 
  
 /	 

   
 
) 
 & 
D V$(
!
>A
	?
 
4 V$(
!
>A
	?
 
67
 V$(
!
>A
	?
 
4
(#
JkXr>   r;  c                     \ rS rSrSrSS jr\" S5      SS.     SS jj5       r\" SS	5      SSS
.       SS jj5       r\" SSS5      SSSS.         SS jj5       r	\" S5      SS.     SS jj5       r
\" S5      SS.     SS jj5       r\" S5      SS.     SS jj5       r    SS jr    SS jrSrg)rL  i  zProvides moderator streams.c                    Xl         g)zInitialize a :class:`.SubredditModerationStream` instance.

:param subreddit: The moderated subreddit associated with the streams.

Nr@   rA   s     r;   rB   "SubredditModerationStream.__init__  r   r>   r<  NrW  c               Z    [        U R                  R                  R                  4SU0UD6$ )a  Yield edited comments and submissions as they become available.

:param only: If specified, one of ``"comments"`` or ``"submissions"`` to yield
    only results of that type.

Keyword arguments are passed to :func:`.stream_generator`.

For example, to retrieve all new edited submissions/comments made to all
moderated subreddits, try:

.. code-block:: python

    for item in reddit.subreddit("mod").mod.stream.edited():
        print(item)

r<  )r#   r8   rf  r\  r:   r<  stream_optionss      r;   r\   SubredditModerationStream.edited  s)    (   2 2 9 9WWWWr>   re  rf  rg  c               ^    [        U R                  R                  R                  4SUUS.UD6$ )a  Yield moderator log entries as they become available.

:param action: If given, only return log entries for the specified action.
:param mod: If given, only return log entries for actions made by the passed in
    redditor.

For example, to retrieve all new mod actions made to all moderated subreddits,
try:

.. code-block:: python

    for log in reddit.subreddit("mod").mod.stream.log():
        print(f"Mod: {log.mod}, Subreddit: {log.subreddit}")

r6   )attribute_namere  rf  )r#   r8   rf  rk  )r:   re  rf  r  s       r;   rk  SubredditModerationStream.log  s<    .  NN""
	

 
 	
r>   rD   r_   rR   )rD   r_   rR   c          	         U R                   S:X  a*  U R                   R                  R                  S5      U l         [        U R                   R                  R                  4SSUUUS.UD6$ )a  Yield new-modmail conversations as they become available.

:param other_subreddits: A list of :class:`.Subreddit` instances for which to
    fetch conversations (default: ``None``).
:param sort: Can be one of: ``"mod"``, ``"recent"``, ``"unread"``, or ``"user"``
    (default: ``"recent"``).
:param state: Can be one of: ``"all"``, ``"appeals"``, ``"archived"``,
    ``"default"``, ``"highlighted"``, ``"inbox"``, ``"inprogress"``,
    ``"join_requests"``, ``"mod"``, ``"new"``, or ``"notifications"`` (default:
    ``"all"``). ``"all"`` does not include mod or archived conversations.
    ``"inbox"`` does not include appeals conversations.

Keyword arguments are passed to :func:`.stream_generator`.

To print new mail in the unread modmail queue try:

.. code-block:: python

    subreddit = reddit.subreddit("all")
    for message in subreddit.mod.stream.modmail_conversations():
        print(f"From: {message.owner}, To: {message.participant}")

rf  rd   r6   T)r  exclude_beforerD   r_   rR   )r8   r9   r#   modmailrm   )r:   rD   r_   rR   r  s        r;   rg   /SubredditModerationStream.modmail_conversations   sk    @ >>U"!^^33==eDDNNN""00
-
 
 	
r>   c               Z    [        U R                  R                  R                  4SU0UD6$ )a  Yield :class:`.Comment`\ s and :class:`.Submission`\ s in the modqueue as they become available.

:param only: If specified, one of ``"comments"`` or ``"submissions"`` to yield
    only results of that type.

Keyword arguments are passed to :func:`.stream_generator`.

To print all new modqueue items try:

.. code-block:: python

    for item in reddit.subreddit("mod").mod.stream.modqueue():
        print(item)

r<  )r#   r8   rf  ro  r  s      r;   ro  "SubredditModerationStream.modqueueL  s4    &  NN''
.2
6D
 	
r>   c               Z    [        U R                  R                  R                  4SU0UD6$ )a  Yield reported :class:`.Comment`\ s and :class:`.Submission`\ s as they become available.

:param only: If specified, one of ``"comments"`` or ``"submissions"`` to yield
    only results of that type.

Keyword arguments are passed to :func:`.stream_generator`.

To print new user and mod report reasons in the report queue try:

.. code-block:: python

    for item in reddit.subreddit("mod").mod.stream.reports():
        print(item)

r<  )r#   r8   rf  rs  r  s      r;   rs  !SubredditModerationStream.reportsc  s)    &   2 2 : :XXXXr>   c               Z    [        U R                  R                  R                  4SU0UD6$ )a  Yield spam :class:`.Comment`\ s and :class:`.Submission`\ s as they become available.

:param only: If specified, one of ``"comments"`` or ``"submissions"`` to yield
    only results of that type.

Keyword arguments are passed to :func:`.stream_generator`.

To print new items in the spam queue try:

.. code-block:: python

    for item in reddit.subreddit("mod").mod.stream.spam():
        print(item)

r<  )r#   r8   rf  r{  r  s      r;   r{  SubredditModerationStream.spamx  s)    &   2 2 7 7UdUnUUr>   c                V    [        U R                  R                  R                  40 UD6$ )a"  Yield unmoderated :class:`.Submission`\ s as they become available.

Keyword arguments are passed to :func:`.stream_generator`.

To print new items in the unmoderated queue try:

.. code-block:: python

    for item in reddit.subreddit("mod").mod.stream.unmoderated():
        print(item)

)r#   r8   rf  r  r:   r  s     r;   r  %SubredditModerationStream.unmoderated  s$       2 2 > >Q.QQr>   c                V    [        U R                  R                  R                  40 UD6$ )a  Yield unread old modmail messages as they become available.

Keyword arguments are passed to :func:`.stream_generator`.

.. seealso::

    :meth:`.SubredditModeration.inbox` for all messages.

To print new mail in the unread modmail queue try:

.. code-block:: python

    for message in reddit.subreddit("mod").mod.stream.unread():
        print(f"From: {message.author}, To: {message.dest}")

)r#   r8   rf  r  r  s     r;   r   SubredditModerationStream.unread  s$    &   2 2 9 9L^LLr>   r@   r   )r<  r   r  r   r   zCGenerator[praw.models.Comment | praw.models.Submission, None, None])re  r   rf  !str | praw.models.Redditor | Noner  r   r   z,Generator[praw.models.ModAction, None, None])
rD   r   r_   r   rR   r   r  r   r   z*Generator[ModmailConversation, None, None]r  r   r   z-Generator[praw.models.Submission, None, None])r  r   r   z3Generator[praw.models.SubredditMessage, None, None])r   r   r   r   r   rB   r   r\  rk  rg   ro  rs  r{  r  r  r   rh   r>   r;   rL  rL    s   %# V$(X!X<?X	LX X* Xu% "15	
 
 /	

 
 
6
 &
< '9 @D )
 =)
 	)

 )
 )
 
4)
 :)
V V$(
!
<?
	L
 
, V$(Y!Y<?Y	LY Y( V$(V!V<?V	LV V(R #R	6R"M #M	<Mr>   rL  c                  .    \ rS rSrSrSS jrS rS rSrg)	SubredditQuarantinei  zProvides subreddit quarantine related methods.

To opt-in into a quarantined subreddit:

.. code-block:: python

    reddit.subreddit("test").quaran.opt_in()

c                    Xl         g)zInitialize a :class:`.SubredditQuarantine` instance.

:param subreddit: The :class:`.Subreddit` associated with the quarantine.

Nr@   rA   s     r;   rB   SubredditQuarantine.__init__  r   r>   c                    SU R                   0n[        R                  " [        5         U R                   R                  R                  [        S   US9  SSS5        g! , (       d  f       g= f)a  Permit your user access to the quarantined subreddit.

Usage:

.. code-block:: python

    subreddit = reddit.subreddit("QUESTIONABLE")
    next(subreddit.hot())  # Raises prawcore.Forbidden

    subreddit.quaran.opt_in()
    next(subreddit.hot())  # Returns Submission

sr_namequarantine_opt_inrw   Nr8   
contextlibsuppressr   r9   rY   r   r:   rx   s     r;   opt_inSubredditQuarantine.opt_in  sO     4>>*  *NN""''1D(ED'Q +**   ,A
A,c                    SU R                   0n[        R                  " [        5         U R                   R                  R                  [        S   US9  SSS5        g! , (       d  f       g= f)a  Remove access to the quarantined subreddit.

Usage:

.. code-block:: python

    subreddit = reddit.subreddit("QUESTIONABLE")
    next(subreddit.hot())  # Returns Submission

    subreddit.quaran.opt_out()
    next(subreddit.hot())  # Raises prawcore.Forbidden

r  quarantine_opt_outrw   Nr  r  s     r;   opt_outSubredditQuarantine.opt_out  sO     4>>*  *NN""''1E(FT'R +**r  r@   Nr   )	r   r   r   r   r   rB   r  r  r   rh   r>   r;   r  r    s    #R$Sr>   r  c                  P    \ rS rSrSr S	     S
S jjrSS jrSS jrSS jrSr	g)SubredditRelationshipi  a~  Represents a relationship between a :class:`.Redditor` and :class:`.Subreddit`.

Instances of this class can be iterated through in order to discover the Redditors
that make up the relationship.

For example, banned users of a subreddit can be iterated through like so:

.. code-block:: python

    for ban in reddit.subreddit("test").banned():
        print(f"{ban}: {ban.note}")

Nc                    [         R                  USUS9  [        SU R                   3   R	                  U R
                  S9n[        U R
                  R                  U40 UD6$ )a  Return a :class:`.ListingGenerator` for :class:`.Redditor`\ s in the relationship.

:param redditor: When provided, yield at most a single :class:`.Redditor`
    instance. This is useful to confirm if a relationship exists, or to fetch
    the metadata associated with a particular relationship (default: ``None``).

Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.

rW   )re   rf   r   list_r@   )rj   rk   r   relationshipr   r8   r    r9   r   s       r;   r<   SubredditRelationship.__call__  sg     	''&H8 	( 	
 t00123::T^^:T 6 6P?OPPr>   c                    X l         Xl        g)zInitialize a :class:`.SubredditRelationship` instance.

:param subreddit: The :class:`.Subreddit` for the relationship.
:param relationship: The name of the relationship.

Nr  r8   )r:   r8   r  s      r;   rB   SubredditRelationship.__init__  s     )"r>   c                    [        U5      U R                  S.nUR                  U5        [        S   R	                  U R
                  S9nU R
                  R                  R                  XCS9  g)zjAdd ``redditor`` to this relationship.

:param redditor: A redditor name or :class:`.Redditor` instance.

r   ri  friendr@   rw   N)rI   r  r   r   r   r8   r9   rY   )r:   r   other_settingsrx   r   s        r;   r   SubredditRelationship.add  s[     Ht/@/@AN#x ''$..'A##C#3r>   c                    [        U5      U R                  S.n[        S   R                  U R                  S9nU R                  R
                  R                  X2S9  g)zoRemove ``redditor`` from this relationship.

:param redditor: A redditor name or :class:`.Redditor` instance.

r  unfriendr@   rw   N)rI   r  r   r   r8   r9   rY   r:   r   rx   r   s       r;   r   SubredditRelationship.remove%  sO     Ht/@/@Az"))DNN)C##C#3r>   r  rH   r   r  rl   r   r   r  )r8   r   r  rI   )r   r   r  r   r   r   )
r   r   r   r   r   r<   rB   r   r   r   rh   r>   r;   r  r    s@      7;Q3Q  Q 
(	Q*#	44r>   r  c                  F    \ rS rSrSrSS jr    S	S jr    S
S jrSrg)SubredditStreami0  z(Provides submission and comment streams.c                    Xl         g)zpInitialize a :class:`.SubredditStream` instance.

:param subreddit: The subreddit associated with the streams.

Nr@   rA   s     r;   rB   SubredditStream.__init__3  r   r>   c                B    [        U R                  R                  40 UD6$ )a  Yield new comments as they become available.

Comments are yielded oldest first. Up to 100 historical comments will initially
be returned.

Keyword arguments are passed to :func:`.stream_generator`.

.. note::

    While PRAW tries to catch all new comments, some high-volume streams,
    especially the r/all stream, may drop some comments.

For example, to retrieve all new comments made to r/test, try:

.. code-block:: python

    for comment in reddit.subreddit("test").stream.comments():
        print(comment)

To only retrieve new submissions starting when the stream is created, pass
``skip_existing=True``:

.. code-block:: python

    subreddit = reddit.subreddit("test")
    for comment in subreddit.stream.comments(skip_existing=True):
        print(comment)

)r#   r8   commentsr  s     r;   r  SubredditStream.comments;  s    @   7 7J>JJr>   c                B    [        U R                  R                  40 UD6$ )a3  Yield new :class:`.Submission`\ s as they become available.

Submissions are yielded oldest first. Up to 100 historical submissions will
initially be returned.

Keyword arguments are passed to :func:`.stream_generator`.

.. note::

    While PRAW tries to catch all new submissions, some high-volume streams,
    especially the r/all stream, may drop some submissions.

For example, to retrieve all new submissions made to all of Reddit, try:

.. code-block:: python

    for submission in reddit.subreddit("all").stream.submissions():
        print(submission)

)r#   r8   newr  s     r;   r>  SubredditStream.submissions]  s    .   2 2EnEEr>   r@   Nr   )r  r   r   z*Generator[praw.models.Comment, None, None]r  )	r   r   r   r   r   rB   r  r>  r   rh   r>   r;   r  r  0  s;    2# K # K	3 KDF #F	6Fr>   r  c                  B   \ rS rSrSrS"S jrS#S jrS$S jr      S%S jrS&S jr	S	 r
S
 rS rS rS'S jrS rS rS r\" SS5      SS.S(S jj5       r\" SS5      S)S j5       rS*S jr\" SS5      SS.   S+S jj5       rS*S jrS,S jrS*S jrS,S jrS,S  jrS!rg)-SubredditStylesheetiw  ah  Provides a set of stylesheet functions to a :class:`.Subreddit`.

For example, to add the css data ``.test{color:blue}`` to the existing stylesheet:

.. code-block:: python

    subreddit = reddit.subreddit("test")
    stylesheet = subreddit.stylesheet()
    stylesheet.stylesheet += ".test{color:blue}"
    subreddit.stylesheet.update(stylesheet.stylesheet)

c                    [         S   R                  U R                  S9nU R                  R                  R	                  U5      $ )zReturn the :class:`.Subreddit`'s stylesheet.

To be used as:

.. code-block:: python

    stylesheet = reddit.subreddit("test").stylesheet()

about_stylesheetr@   rw  rT  s     r;   r<   SubredditStylesheet.__call__  s<     )*11DNN1K~~%%))#..r>   c                    Xl         g)zInitialize a :class:`.SubredditStylesheet` instance.

:param subreddit: The :class:`.Subreddit` associated with the stylesheet.

An instance of this class is provided as:

.. code-block:: python

    reddit.subreddit("test").stylesheet

Nr@   rA   s     r;   rB   SubredditStylesheet.__init__  r  r>   c                    [         S   R                  U R                  S9nU R                  R                  R	                  X!S9  g )Nstructured_stylesr@   rw   )r   r   r8   r9   r%  )r:   
style_datar   s      r;   _update_structured_styles-SubredditStylesheet._update_structured_styles  s:    *+22T^^2L$$S$:r>   
image_pathc                  [        U5      R                  S5       nUR                  [        [        5      5      nUR                  S5        U[        :X  a  SOSUS'   [        S   R                  U R                  S9nU R                  R                  R                  XQSU0S	9nUS
   (       a9  US
   S   nUR                  SS/5      S   nUS;   d   S5       e[        XxS //5      eUsS S S 5        $ ! , (       d  f       g = f)Nrbr   jpgpngimg_typeupload_imager@   filerx   fileserrorserrors_valuesr   )BAD_CSS_NAMEIMAGE_ERRORzPlease file a bug with PRAW.)r	   openreadr0  r   seekr   r   r8   r9   rY   r   r   )	r:   rx   r  imageheaderr   rZ   
error_typeerror_values	            r;   _upload_image!SubredditStylesheet._upload_image  s    *""4(EZZK 01FJJqM(.+(=u5D>*11DNN1KC~~--22vuo 3 H !%h/2
&ll?RDA!D! &  2 22  ):D*I)JKK! )((s   CC00
C>c               ~   [        U5      nX#R                  S.nSUS'   UR                  5       R                  S5      (       a  SUS'   [        S   R                  U R                  S9nU R                  R                  R                  XTS9S	   nUS
    Vs0 s H  owS   US   _M     nnSUS    3n	UR                  S5       n
U R                  R                  R                  R                  R                  R                  XSU
0S9nS S S 5        WR                  5         U	 SUS    3$ s  snf ! , (       d  f       N-= f)N)	imagetypefilepath
image/jpegmimetypez.png	image/pngstyle_asset_leaser@   rw   s3UploadLeasefieldsr   r   https:re  r  r  r  /rf   )r	   r   lowerendswithr   r   r8   r9   rY   r  _core
_requestor_httpraise_for_status)r:   r  
image_typer  rx   r   upload_leaser   upload_data
upload_urlr  rZ   s               r;   _upload_style_asset'SubredditStylesheet._upload_style_asset  s=   J'YY?'Z&&v..*D*+22T^^2L~~--2232B?S?KH?UV?UtF|T']2?UVl8456
YYt_~~--33>>DDIIVUO J H  	!!#Q{51233 W _s   D)AD..
D<c                .    SS0nU R                  U5        g)zRemove the current :class:`.Subreddit` (redesign) banner image.

Succeeds even if there is no banner image.

For example:

.. code-block:: python

    reddit.subreddit("test").stylesheet.delete_banner()

bannerBackgroundImager   Nr  r  s     r;   delete_banner!SubredditStylesheet.delete_banner  s     (,&&t,r>   c                0    SSS.nU R                  U5        g)a  Remove the current :class:`.Subreddit` (redesign) banner additional image.

Succeeds even if there is no additional image. Will also delete any configured
hover image.

For example:

.. code-block:: python

    reddit.subreddit("test").stylesheet.delete_banner_additional_image()

r   )bannerPositionedImagesecondaryBannerPositionedImageNr   r  s     r;   delete_banner_additional_image2SubredditStylesheet.delete_banner_additional_image  s     *,rR&&t,r>   c                .    SS0nU R                  U5        g)zRemove the current :class:`.Subreddit` (redesign) banner hover image.

Succeeds even if there is no hover image.

For example:

.. code-block:: python

    reddit.subreddit("test").stylesheet.delete_banner_hover_image()

r%  r   Nr   r  s     r;   delete_banner_hover_image-SubredditStylesheet.delete_banner_hover_image  s     1"5&&t,r>   c                    [         S   R                  U R                  S9nU R                  R                  R	                  U5        g)zRemove the current :class:`.Subreddit` header image.

Succeeds even if there is no header image.

For example:

.. code-block:: python

    reddit.subreddit("test").stylesheet.delete_header()

delete_sr_headerr@   Nr+  rT  s     r;   delete_header!SubredditStylesheet.delete_header  9     )*11DNN1K##C(r>   r   c                    [         S   R                  U R                  S9nU R                  R                  R	                  USU0S9  g)zRemove the named image from the :class:`.Subreddit`.

Succeeds even if the named image does not exist.

For example:

.. code-block:: python

    reddit.subreddit("test").stylesheet.delete_image("smile")

delete_sr_imager@   img_namerw   Nr+  )r:   r   r   s      r;   delete_image SubredditStylesheet.delete_image
  sC     ()004>>0J##Cz4.@#Ar>   c                .    SS0nU R                  U5        g)zRemove the current :class:`.Subreddit` (redesign) mobile banner.

Succeeds even if there is no mobile banner.

For example:

.. code-block:: python

    subreddit = reddit.subreddit("test")
    subreddit.stylesheet.delete_banner_hover_image()

mobileBannerImager   Nr   r  s     r;   delete_mobile_banner(SubredditStylesheet.delete_mobile_banner  s     $R(&&t,r>   c                    [         S   R                  U R                  S9nU R                  R                  R	                  U5        g)zRemove the current :class:`.Subreddit` mobile header.

Succeeds even if there is no mobile header.

For example:

.. code-block:: python

    reddit.subreddit("test").stylesheet.delete_mobile_header()

r,  r@   Nr+  rT  s     r;   delete_mobile_header(SubredditStylesheet.delete_mobile_header)  r/  r>   c                    [         S   R                  U R                  S9nU R                  R                  R	                  U5        g)zRemove the current :class:`.Subreddit` mobile icon.

Succeeds even if there is no mobile icon.

For example:

.. code-block:: python

    reddit.subreddit("test").stylesheet.delete_mobile_icon()

delete_sr_iconr@   Nr+  rT  s     r;   delete_mobile_icon&SubredditStylesheet.delete_mobile_icon8  s9     '(//$../I##C(r>   
stylesheetreasonNrA  c                   SX!S.n[         S   R                  U R                  S9nU R                  R                  R	                  XCS9  g)a/  Update the :class:`.Subreddit`'s stylesheet.

:param stylesheet: The CSS for the new stylesheet.
:param reason: The reason for updating the stylesheet.

For example:

.. code-block:: python

    reddit.subreddit("test").stylesheet.update(
        "p { color: green; }", reason="color text green"
    )

save)oprA  stylesheet_contentssubreddit_stylesheetr@   rw   Nr+  )r:   r@  rA  rx   r   s        r;   r   SubredditStylesheet.updateG  sF      R-.555O##C#3r>   c               (    U R                  USS.US9$ )a  Upload an image to the :class:`.Subreddit`.

:param image_path: A path to a jpeg or png image.
:param name: The name to use for the image. If an image already exists with the
    same name, it will be replaced.

:returns: A dictionary containing a link to the uploaded image under the key
    ``img_src``.

:raises: ``prawcore.TooLarge`` if the overall request body is too large.
:raises: :class:`.RedditAPIException` if there are other issues with the
    uploaded image. Unfortunately the exception info might not be very specific,
    so try through the website with the same image to see what the problem
    actually might be.

For example:

.. code-block:: python

    reddit.subreddit("test").stylesheet.upload(name="smile", image_path="img.png")

img)r   upload_typerx   r  r  )r:   r  r   s      r;   uploadSubredditStylesheet.upload[  s&    0 !!u5* " 
 	
r>   c                J    SnU R                  XS9nU R                  X#05        g)a,  Upload an image for the :class:`.Subreddit`'s (redesign) banner image.

:param image_path: A path to a jpeg or png image.

:raises: ``prawcore.TooLarge`` if the overall request body is too large.
:raises: :class:`.RedditAPIException` if there are other issues with the
    uploaded image. Unfortunately the exception info might not be very specific,
    so try through the website with the same image to see what the problem
    actually might be.

For example:

.. code-block:: python

    reddit.subreddit("test").stylesheet.upload_banner("banner.png")

r  r  r  Nr  r  r:   r  r  	image_urls       r;   upload_banner!SubredditStylesheet.upload_bannerw  s4    $ -
,,! - 
	 	&&
'>?r>   align)rW  c                   0 nUb  US;  a  Sn[        U5      eX#S'   SnU R                  XS9nXV0nU(       a  UR                  U5        U R                  U5        g)a  Upload an image for the :class:`.Subreddit`'s (redesign) additional image.

:param image_path: A path to a jpeg or png image.
:param align: Either ``"left"``, ``"centered"``, or ``"right"``. (default:
    ``"left"``).

:raises: ``prawcore.TooLarge`` if the overall request body is too large.
:raises: :class:`.RedditAPIException` if there are other issues with the
    uploaded image. Unfortunately the exception info might not be very specific,
    so try through the website with the same image to see what the problem
    actually might be.

For example:

.. code-block:: python

    subreddit = reddit.subreddit("test")
    subreddit.stylesheet.upload_banner_additional_image("banner.png")

N>   r   r   centeredz>'align' argument must be either 'left', 'centered', or 'right'bannerPositionedImagePositionr$  rQ  )
ValueErrorr  r   r  )r:   r  rW  	alignmentr   r  rT  r  s           r;   upload_banner_additional_image2SubredditStylesheet.upload_banner_additional_image  sv    6 	99V o%9>56,
,,! - 
	 !,
i(&&z2r>   c                J    SnU R                  XS9nU R                  X#05        g)a  Upload an image for the :class:`.Subreddit`'s (redesign) additional image.

:param image_path: A path to a jpeg or png image.

Fails if the :class:`.Subreddit` does not have an additional image defined.

:raises: ``prawcore.TooLarge`` if the overall request body is too large.
:raises: :class:`.RedditAPIException` if there are other issues with the
    uploaded image. Unfortunately the exception info might not be very specific,
    so try through the website with the same image to see what the problem
    actually might be.

For example:

.. code-block:: python

    subreddit = reddit.subreddit("test")
    subreddit.stylesheet.upload_banner_hover_image("banner.png")

r%  rQ  NrR  rS  s       r;   upload_banner_hover_image-SubredditStylesheet.upload_banner_hover_image  s4    * 6
,,! - 
	 	&&
'>?r>   c                &    U R                  SS0US9$ )a  Upload an image to be used as the :class:`.Subreddit`'s header image.

:param image_path: A path to a jpeg or png image.

:returns: A dictionary containing a link to the uploaded image under the key
    ``img_src``.

:raises: ``prawcore.TooLarge`` if the overall request body is too large.
:raises: :class:`.RedditAPIException` if there are other issues with the
    uploaded image. Unfortunately the exception info might not be very specific,
    so try through the website with the same image to see what the problem
    actually might be.

For example:

.. code-block:: python

    reddit.subreddit("test").stylesheet.upload_header("header.png")

rK  r  rL  rM  r:   r  s     r;   upload_header!SubredditStylesheet.upload_header      * !!x'@Z!XXr>   c                J    SnU R                  XS9nU R                  X#05        g)a  Upload an image for the :class:`.Subreddit`'s (redesign) mobile banner.

:param image_path: A path to a JPEG or PNG image.

For example:

.. code-block:: python

    subreddit = reddit.subreddit("test")
    subreddit.stylesheet.upload_mobile_banner("banner.png")

Fails if the :class:`.Subreddit` does not have an additional image defined.

:raises: ``prawcore.TooLarge`` if the overall request body is too large.
:raises: :class:`.RedditAPIException` if there are other issues with the
    uploaded image. Unfortunately the exception info might not be very specific,
    so try through the website with the same image to see what the problem
    actually might be.

r6  rQ  NrR  rS  s       r;   upload_mobile_banner(SubredditStylesheet.upload_mobile_banner  s4    * )
,,! - 
	 	&&
'>?r>   c                &    U R                  SS0US9$ )a  Upload an image to be used as the :class:`.Subreddit`'s mobile header.

:param image_path: A path to a jpeg or png image.

:returns: A dictionary containing a link to the uploaded image under the key
    ``img_src``.

:raises: ``prawcore.TooLarge`` if the overall request body is too large.
:raises: :class:`.RedditAPIException` if there are other issues with the
    uploaded image. Unfortunately the exception info might not be very specific,
    so try through the website with the same image to see what the problem
    actually might be.

For example:

.. code-block:: python

    reddit.subreddit("test").stylesheet.upload_mobile_header("header.png")

rK  bannerrL  rM  rc  s     r;   upload_mobile_header(SubredditStylesheet.upload_mobile_header  rf  r>   c                &    U R                  SS0US9$ )a  Upload an image to be used as the :class:`.Subreddit`'s mobile icon.

:param image_path: A path to a jpeg or png image.

:returns: A dictionary containing a link to the uploaded image under the key
    ``img_src``.

:raises: ``prawcore.TooLarge`` if the overall request body is too large.
:raises: :class:`.RedditAPIException` if there are other issues with the
    uploaded image. Unfortunately the exception info might not be very specific,
    so try through the website with the same image to see what the problem
    actually might be.

For example:

.. code-block:: python

    reddit.subreddit("test").stylesheet.upload_mobile_icon("icon.png")

rK  iconrL  rM  rc  s     r;   upload_mobile_icon&SubredditStylesheet.upload_mobile_icon  s    * !!v'>:!VVr>   r@   )r   zpraw.models.Stylesheetr   )r  dict[str, str | Any])rx   rr  r  rI   r   r  )r  rI   r  rI   r   rI   )r   rI   )r@  rI   rA  r   )r  rI   r   rI   r   dict[str, str])r  rI   )r  rI   rW  r   )r  rI   r   rs  )r   r   r   r   r   r<   rB   r  r  r  r!  r&  r)  r-  r3  r7  r:  r>  r   r   rN  rU  r]  r`  rd  rh  rl  rp  r   rh   r>   r;   r  r  w  s    /#;+9<	*4(-- -)B- )) \8,>B 4 -4& V\*
 +
6@0 \7+
 !	(3(3 	(3 ,(3T@6Y.@6Y.Wr>   r  c                  ~    \ rS rSrSrSS jrSS jrSS jr\" SSS5      S	S
.         SS jj5       r	SS jr
Srg	)SubredditWikii6  z:Provides a set of wiki functions to a :class:`.Subreddit`.c                t    [        U R                  R                  U R                  UR                  5       5      $ )a  Lazily return the :class:`.WikiPage` for the :class:`.Subreddit` named ``page_name``.

This method is to be used to fetch a specific wikipage, like so:

.. code-block:: python

    wikipage = reddit.subreddit("test").wiki["proof"]
    print(wikipage.content_md)

)r0   r8   r9   r  )r:   	page_names     r;   __getitem__SubredditWiki.__getitem__9  s(     ..	@QRRr>   c                T    [        US5      U l        [        US5      U l        Xl        g)zjInitialize a :class:`.SubredditWiki` instance.

:param subreddit: The subreddit whose wiki to work with.


wikibannedwikicontributorN)r  bannedcontributorr8   rA   s     r;   rB   SubredditWiki.__init__F  s'     ,I|D0<MN"r>   c              #  B  #    U R                   R                  R                  [        S   R	                  U R                   S9SU R                   R                  R
                  0S9nUS    H0  n[        U R                   R                  U R                   U5      v   M2     g7f)zIterate through the pages of the wiki.

This method is to be used to discover all wikipages for a subreddit:

.. code-block:: python

    for wikipage in reddit.subreddit("test").wiki:
        print(wikipage)


wiki_pagesr@   r   rV   rx   N)r8   r9   r   r   r   r   r0   )r:   rZ   rw  s      r;   r   SubredditWiki.__iter__P  s      >>))--\"))DNN)Cdnn44AAB . 
 "&)I4>>114>>9MM *s   BBr   contentrA  NrB  c                   UR                  SS5      R                  5       n[        U R                  R                  U R                  U5      nUR
                  " SXS.UD6  U$ )a  Create a new :class:`.WikiPage`.

:param name: The name of the new :class:`.WikiPage`. This name will be
    normalized.
:param content: The content of the new :class:`.WikiPage`.
:param reason: The reason for the creation.
:param other_settings: Additional keyword arguments to pass.

To create the wiki page ``"praw_test"`` in r/test try:

.. code-block:: python

    reddit.subreddit("test").wiki.create(
        name="praw_test", content="wiki body text", reason="PRAW Test Creation"
    )

 _)r  rA  rh   )replacer  r0   r8   r9   edit)r:   r  r   rA  r  r  s         r;   ry   SubredditWiki.createb  sR    4 ||C%++-t~~--t~~tDBB>B
r>   c                    [         S   R                  U R                  S9n[        R                  " XR                  US9$ )aR  Return a :class:`.ListingGenerator` for recent wiki revisions.

Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.

To view the wiki revisions for ``"praw_test"`` in r/test try:

.. code-block:: python

    for item in reddit.subreddit("test").wiki["praw_test"].revisions():
        print(item)

wiki_revisionsr@   )rl   r8   r   )r   r   r8   r0   _revision_generator)r:   rl   r   s      r;   	revisionsSubredditWiki.revisions  s=    $ '(//$../I++-S
 	
r>   )r}  r~  r8   )rw  rI   r   r0   r   )r   zGenerator[WikiPage, None, None])
r  rI   r   rI   rA  r   r  r   r   r0   )rl   r   r   z[Generator[dict[str, praw.models.Redditor | WikiPage | str | int | bool | None], None, None])r   r   r   r   r   rx  rB   r   r   ry   r  r   rh   r>   r;   ru  ru  6  so    DS#N$ VY1 "  	
   
 2<
r>   ru  c                      \ rS rSrSrS rSrg)ContributorRelationshipi  a/  Provides methods to interact with a :class:`.Subreddit`'s contributors.

Contributors are also known as approved submitters.

Contributors of a subreddit can be iterated through like so:

.. code-block:: python

    for contributor in reddit.subreddit("test").contributor():
        print(contributor)

c                    U R                   R                  R                  [        S   SU R                   R                  0S9  g)z"Abdicate the contributor position.leavecontributorr6   rw   N)r8   r9   rY   r   r  r   s    r;   leaveContributorRelationship.leave  s9    ##'(dnn6M6M/N 	$ 	
r>   rh   N)r   r   r   r   r   r  r   rh   r>   r;   r  r    s    
r>   r  c                  v  ^  \ rS rSrSr1 Skr\SSS.     SS jj5       r S   SS	 jjr\	" SS5      SS
.     SU 4S jjj5       r
\	" SS5      SS
.     SS jj5       r\	" S5      SS.     SS jj5       rS rSS jr\	" SS5      SS
.   SS jj5       r\	" SS5      SS
.   SS jj5       rSrU =r$ )ModeratorRelationshipi  zProvides methods to interact with a :class:`.Subreddit`'s moderators.

Moderators of a subreddit can be iterated through like so:

.. code-block:: python

    for moderator in reddit.subreddit("test").moderator():
        print(moderator)

>   mailwikir   postsaccessconfigchat_configchat_operatorNr  permissionsr  c                d    U (       a  [        U 5      O0 n [        [        R                  US9U S'   U $ )N)known_permissionsr  r  )r   r"   r  PERMISSIONSr  s     r;   _handle_permissions)ModeratorRelationship._handle_permissions  s5     6D.1(:3??[)
}% r>   r   c                    Uc  0 OSU0n[         SU R                   3   R                  U R                  S9nU R                  R                  R                  X2S9$ )a  Return a list of :class:`.Redditor`\ s who are moderators.

:param redditor: When provided, return a list containing at most one
    :class:`.Redditor` instance. This is useful to confirm if a relationship
    exists, or to fetch the metadata associated with a particular relationship
    (default: ``None``).

.. note::

    To help mitigate targeted moderator harassment, this call requires the
    :class:`.Reddit` instance to be authenticated i.e., :attr:`.read_only` must
    return ``False``. This call, however, only makes use of the ``read`` scope.
    For more information on why the moderator list is hidden can be found here:
    https://reddit.zendesk.com/hc/en-us/articles/360049499032-Why-is-the-moderator-list-hidden-

.. note::

    Unlike other relationship callables, this relationship is not paginated.
    Thus, it simply returns the full list, rather than an iterator for the
    results.

To be used like:

.. code-block:: python

    moderators = reddit.subreddit("test").moderator()

For example, to list the moderators along with their permissions try:

.. code-block:: python

    for moderator in reddit.subreddit("test").moderator():
        print(f"{moderator}: {moderator.mod_permissions}")

r   r  r@   rV   )r   r  r   r8   r9   r   )r:   r   rW   r   s       r;   r<   ModeratorRelationship.__call__  s^    L  'fh-?t00123::T^^:T~~%%))#)==r>   )r  c               F   > U R                  X2S9n[        TU ]  " U40 UD6  g)a  Add or invite ``redditor`` to be a moderator of the :class:`.Subreddit`.

:param redditor: A redditor name or :class:`.Redditor` instance.
:param permissions: When provided (not ``None``), permissions should be a list
    of strings specifying which subset of permissions to grant. An empty list
    ``[]`` indicates no permissions, and when not provided ``None``, indicates
    full permissions (default: ``None``).

An invite will be sent unless the user making this call is an admin user.

For example, to invite u/spez with ``"posts"`` and ``"mail"`` permissions to
r/test, try:

.. code-block:: python

    reddit.subreddit("test").moderator.add("spez", permissions=["posts", "mail"])

r  N)r  superr   )r:   r   r  r  	__class__s       r;   r   ModeratorRelationship.add  s0    4 11) 2 
 	H//r>   c                   U R                  X2S9nUR                  [        U5      SS.5        [        S   R	                  U R
                  S9nU R
                  R                  R                  XTS9  g)ad  Invite ``redditor`` to be a moderator of the :class:`.Subreddit`.

:param redditor: A redditor name or :class:`.Redditor` instance.
:param permissions: When provided (not ``None``), permissions should be a list
    of strings specifying which subset of permissions to grant. An empty list
    ``[]`` indicates no permissions, and when not provided ``None``, indicates
    full permissions (default: ``None``).

For example, to invite u/spez with ``"posts"`` and ``"mail"`` permissions to
r/test, try:

.. code-block:: python

    reddit.subreddit("test").moderator.invite("spez", permissions=["posts", "mail"])

r  moderator_inviter  r  r@   rw   N)r  r   rI   r   r   r8   r9   rY   )r:   r   r  r  rx   r   s         r;   inviteModeratorRelationship.invite	  sk    0 '') ( 
 	S]4FGHx ''$..'A##C#3r>   )r   c                   U(       a  SU0OSUS'   [         S   R                  U R                  S9n[        U R                  R                  U40 UD6$ )a  Return a :class:`.ListingGenerator` for :class:`.Redditor`\ s invited to be moderators.

:param redditor: When provided, return a list containing at most one
    :class:`.Redditor` instance. This is useful to confirm if a relationship
    exists, or to fetch the metadata associated with a particular relationship
    (default: ``None``).

Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.

.. note::

    Unlike other usages of :class:`.ListingGenerator`, ``limit`` has no effect
    in the quantity returned. This endpoint always returns moderators in batches
    of 25 at a time regardless of what ``limit`` is set to.

Usage:

.. code-block:: python

    for invited_mod in reddit.subreddit("test").moderator.invited():
        print(invited_mod)

usernameNrW   list_invited_moderatorr@   )r   r   r8   r    r9   r   s       r;   invitedModeratorRelationship.invited9	  sT    > @Hj(%;T"/077$..7Q 6 6P?OPPr>   c                    U R                  U R                  R                  R                  R                  =(       d.    U R                  R                  R
                  R                  5       5        g)zAbdicate the moderator position (use with care).

For example:

.. code-block:: python

    reddit.subreddit("test").moderator.leave()

N)r   r8   r9   r  r  r   r   r   s    r;   r  ModeratorRelationship.leave\	  sG     	NN""))22Vdnn6L6L6Q6Q6T6T6V	
r>   c                    [        U5      SS.n[        S   R                  U R                  S9nU R                  R                  R                  X2S9  g)zRemove the moderator invite for ``redditor``.

:param redditor: A redditor name or :class:`.Redditor` instance.

For example:

.. code-block:: python

    reddit.subreddit("test").moderator.remove_invite("spez")

r  r  r  r@   rw   N)rI   r   r   r8   r9   rY   r  s       r;   remove_invite#ModeratorRelationship.remove_invitej	  sJ     H/ABz"))DNN)C##C#3r>   c                   [         S   R                  U R                  S9nU R                  [	        U5      SS.US9nU R                  R
                  R                  X4S9  g)a  Update the moderator permissions for ``redditor``.

:param redditor: A redditor name or :class:`.Redditor` instance.
:param permissions: When provided (not ``None``), permissions should be a list
    of strings specifying which subset of permissions to grant. An empty list
    ``[]`` indicates no permissions, and when not provided, ``None``, indicates
    full permissions (default: ``None``).

For example, to add all permissions to the moderator, try:

.. code-block:: python

    subreddit.moderator.update("spez")

To remove all permissions from the moderator, try:

.. code-block:: python

    subreddit.moderator.update("spez", permissions=[])

setpermissionsr@   	moderatorr  r  rw   Nr   r   r8   r  rI   r9   rY   r:   r   r  r   rx   s        r;   r   ModeratorRelationship.updatez	  sb    8 '(//$../I''$'M;G# ( 
 	##C#3r>   c                   [         S   R                  U R                  S9nU R                  [	        U5      SS.US9nU R                  R
                  R                  X4S9  g)aZ  Update the moderator invite permissions for ``redditor``.

:param redditor: A redditor name or :class:`.Redditor` instance.
:param permissions: When provided (not ``None``), permissions should be a list
    of strings specifying which subset of permissions to grant. An empty list
    ``[]`` indicates no permissions, and when not provided, ``None``, indicates
    full permissions (default: ``None``).

For example, to grant the ``"flair"`` and ``"mail"`` permissions to the
moderator invite, try:

.. code-block:: python

    subreddit.moderator.update_invite("spez", permissions=["flair", "mail"])

r  r@   r  r  r  rw   Nr  r  s        r;   update_invite#ModeratorRelationship.update_invite	  sc    . '(//$../I''$'M;MN# ( 
 	##C#3r>   rh   )r  zdict | Noner  list[str] | Noner   r  rH   )r   r  r   zlist[praw.models.Redditor])r   r   r  r  r  r   r  r  )r   r   r  r  )r   r   r   r   r   r  r9  r  r<   r   r   r  r  r  r  r   r  r   __classcell__r  s   @r;   r  r    s   		K  '+(,	#	 &	 
		 	 =A(>9(>	#(>T Z/
 )-	0,0 &	0
 0 00< Z/
 )-	4,4 &	4
 4 04< Z  7; Q 4 Q  	 Q
 
( Q ! QD
4  Z/
 )-	 4, 4 &	 4 0 4D Z/
 )-	4,4 &	4 04r>   r  c            #        ^  \ rS rSrSrSrSr\SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.!                                                                     S_S jj5       r\      S`S
 j5       r	\SaS j5       r
\SbS j5       r\ScS j5       r\SdS j5       r\SeS j5       r\SfS j5       r\SgS j5       r\ShS j5       r\SiS j5       r\SjS j5       r\SkS j5       r\ScS j5       r\SlS j5       r\SmS j5       r\SnS j5       r\SoS j5       r\SpS j5       r\SqS j5       r\SrS j5       r  Ss     StU 4S  jjjrSuS! jr U 4S" jr!S# r"SvS$ jr#        SwS% jr$      SxS( jr%SbS) jr&SS*S+.     SyS, jjr'SzS- jr(S{S. jr)\*" S/S0S1S25      S3S4S5S6.           S|S7 jj5       r+\*" S85      S9S:.S}S; jj5       r,\*" SS<S=S>S?S@SASBSCSDSESSF5      SSSSSSSGSHSSHSGSSI.                           S~SJ jj5       r-\*" SSSDSES>S?SBSASC5	      SSSSSGSHSGSK.                   SSL jj5       r.\*" SSMS>S?S@SASBSCS&SDS'SE5      SSSSSGSHSHSGSNSGSO.
                         SSP jj5       r/\*" SS<SQSRS>S?S@SASBSCSDSE5      SSSSSGSHSHSGSS.                         SST jj5       r0\*" SSUSVSWS>S?S@SASBSCS&SDS'SE5      SSSSSGSHSHSGSSNSGSGSX.                             SSY jj5       r1\*" S	5      SSZ.SS[ jj5       r2SS\ jr3\*" S	5      SSZ. SS] jj5       r4S^r5U =r6$ )rj   i	  a
  A class for Subreddits.

To obtain an instance of this class for r/test execute:

.. code-block:: python

    subreddit = reddit.subreddit("test")

While r/all is not a real subreddit, it can still be treated like one. The following
outputs the titles of the 25 hottest submissions in r/all:

.. code-block:: python

    for submission in reddit.subreddit("all").hot(limit=25):
        print(submission.title)

Multiple subreddits can be combined with a ``+`` like so:

.. code-block:: python

    for submission in reddit.subreddit("redditdev+learnpython").top(time_filter="all"):
        print(submission)

Subreddits can be filtered from combined listings as follows.

.. note::

    These filters are ignored by certain methods, including :attr:`.comments`,
    :meth:`.gilded`, and :meth:`.SubredditStream.comments`.

.. code-block:: python

    for submission in reddit.subreddit("all-redditdev").new():
        print(submission)

.. include:: ../../typical_attributes.rst

========================= ==========================================================
Attribute                 Description
========================= ==========================================================
``can_assign_link_flair`` Whether users can assign their own link flair.
``can_assign_user_flair`` Whether users can assign their own user flair.
``created_utc``           Time the subreddit was created, represented in `Unix
                          Time`_.
``description``           Subreddit description, in Markdown.
``description_html``      Subreddit description, in HTML.
``display_name``          Name of the subreddit.
``icon_img``              The URL of the subreddit icon image.
``id``                    ID of the subreddit.
``name``                  Fullname of the subreddit.
``over18``                Whether the subreddit is NSFW.
``public_description``    Description of the subreddit, shown in searches and on the
                          "You must be invited to visit this community" page (if
                          applicable).
``spoilers_enabled``      Whether the spoiler tag feature is enabled.
``subscribers``           Count of subscribers.
``user_is_banned``        Whether the authenticated user is banned.
``user_is_moderator``     Whether the authenticated user is a moderator.
``user_is_subscriber``    Whether the authenticated user is subscribed.
========================= ==========================================================

.. note::

    Trying to retrieve attributes of quarantined or private subreddits will result
    in a 403 error. Trying to retrieve attributes of a banned subreddit will result
    in a 404 error.

.. _unix time: https://en.wikipedia.org/wiki/Unix_time

r}   #N)!allow_imagesallow_post_crosspostsr  collapse_deleted_commentscomment_score_hide_minsdescriptiondomainexclude_banned_modqueuer  hide_adsr  	key_colorr  r   over_18public_descriptionpublic_traffic
show_mediashow_media_previewspam_comments
spam_linksspam_selfpostsspoilers_enabledr  submit_link_labelsubmit_textsubmit_text_labelr  suggested_comment_sorttitlewiki_edit_agewiki_edit_karmawikimoder  c        "        "   0 SU_SU_SU_SU_SU_SU_SU_SU_S	U	_S
U
_SU_SU_SU_SU_SU_SU_SU_0 SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_S U _S!U!_En#U#R                  U"5        U R                  [        S"   U#S#9  g )$Nr  r  r  r  r  r  r  r  zheader-titler  r  r  r  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  ri  r  r  r  
site_adminrw   )r   rY   r   )$r9   r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   s$                                       r;   _create_or_updateSubreddit._create_or_update
  s   N"
L"
#%:"
 "
 ()B	"

 &'>"
 ;"
 f"
 &'>"
 -"
 "
 "
 D"
 "
 D"
 w"
  !"4!"
" n#"
$ *%"
& !"4'"
( ])"
* *+"
, n-"
.  0/"
0 "1"
2  !23"
4 ;5"
6  !27"
8 %&<9"
: U;"
< N="
> ]?"
@ A"
B C"
H 	^$Xl+%8r>   rD   c           	         U (       a8  SR                  [        U5      /U  Vs/ s H  n[        U5      PM     sn-   5      $ [        U5      $ s  snf )NrF   )rN   rI   )rD   r8   r   s      r;   _subreddit_listSubreddit._subreddit_listV
  sH     88S^,@P/Q@P1A@P/QQRR9~ 0Rs   A
imagesc                   U  H  nUR                  SS5      nU(       a0  [        U5      R                  5       (       d  U< S3n[        U5      eOSn[        U5      e[	        UR                  SS5      5      S::  a  Mz  Sn[        U5      e   g )Nr  r   z is not a valid image path.z'image_path' is required.caption   z'Caption must be 180 characters or less.)r   r	   is_filer   r0  )r  r  r  r   s       r;   _validate_gallerySubreddit._validate_gallery`
  s    E<4JJ'//11'N*EFC#C.( 2 2n$uyyB/0C7?n$ r>   inline_mediac                    [        U R                  5      R                  5       (       d  U R                  < S3n[        U5      eg )Nz is not a valid file path.)r	   pathr  r[  )r  r   s     r;   _validate_inline_media Subreddit._validate_inline_mediao
  s?    L%%&..00!&&))CDCS/! 1r>   c                    [        U S5      $ )aY  Provide an instance of :class:`.SubredditRelationship`.

For example, to ban a user try:

.. code-block:: python

    reddit.subreddit("test").banned.add("spez", ban_reason="...")

To list the banned users along with any notes, try:

.. code-block:: python

    for ban in reddit.subreddit("test").banned():
        print(f"{ban}: {ban.note}")

r}  r  r   s    r;   r}  Subreddit.bannedu
  s    $ %T844r>   c                :    U R                  U R                  U 5      $ )aE  Provide an instance of :class:`.SubredditCollections`.

To see the permalinks of all :class:`.Collection`\ s that belong to a subreddit,
try:

.. code-block:: python

    for collection in reddit.subreddit("test").collections:
        print(collection.permalink)

To get a specific :class:`.Collection` by its UUID or permalink, use one of the
following:

.. code-block:: python

    collection = reddit.subreddit("test").collections("some_uuid")
    collection = reddit.subreddit("test").collections(
        permalink="https://reddit.com/r/SUBREDDIT/collection/some_uuid"
    )

)_subreddit_collections_classr9   r   s    r;   collectionsSubreddit.collections
  s    . 00tDDr>   c                    [        U S5      $ )zProvide an instance of :class:`.ContributorRelationship`.

Contributors are also known as approved submitters.

To add a contributor try:

.. code-block:: python

    reddit.subreddit("test").contributor.add("spez")

r~  )r  r   s    r;   r~  Subreddit.contributor
  s     't];;r>   c                    [        U 5      $ )a  Provide an instance of :class:`.SubredditEmoji`.

This attribute can be used to discover all emoji for a subreddit:

.. code-block:: python

    for emoji in reddit.subreddit("test").emoji:
        print(emoji)

A single emoji can be lazily retrieved via:

.. code-block:: python

    reddit.subreddit("test").emoji["emoji_name"]

.. note::

    Attempting to access attributes of a nonexistent emoji will result in a
    :class:`.ClientException`.

r&   r   s    r;   emojiSubreddit.emoji
      . d##r>   c                    [        U 5      $ )zProvide an instance of :class:`.SubredditFilters`.

For example, to add a filter, run:

.. code-block:: python

    reddit.subreddit("all").filters.add("test")

)r   r   s    r;   filtersSubreddit.filters
  s      %%r>   c                    [        U 5      $ )a  Provide an instance of :class:`.SubredditFlair`.

Use this attribute for interacting with a :class:`.Subreddit`'s flair. For
example, to list all the flair for a subreddit which you have the ``flair``
moderator permission on try:

.. code-block:: python

    for flair in reddit.subreddit("test").flair():
        print(flair)

Flair templates can be interacted with through this attribute via:

.. code-block:: python

    for template in reddit.subreddit("test").flair.templates:
        print(template)

)r   r   s    r;   r   Subreddit.flair
  s    * d##r>   c                    [        U 5      $ )zProvide an instance of :class:`.SubredditModeration`.

For example, to accept a moderation invite from r/test:

.. code-block:: python

    reddit.subreddit("test").mod.accept_invite()

)r;  r   s    r;   rf  Subreddit.mod
  s     #4((r>   c                    [        U S5      $ )at  Provide an instance of :class:`.ModeratorRelationship`.

For example, to add a moderator try:

.. code-block:: python

    reddit.subreddit("test").moderator.add("spez")

To list the moderators along with their permissions try:

.. code-block:: python

    for moderator in reddit.subreddit("test").moderator():
        print(f"{moderator}: {moderator.mod_permissions}")

r  )r  r   s    r;   r  Subreddit.moderator
  s    $ %T;77r>   c                    [        U 5      $ )a   Provide an instance of :class:`.Modmail`.

For example, to send a new modmail from r/test to u/spez with the subject
``"test"`` along with a message body of ``"hello"``:

.. code-block:: python

    reddit.subreddit("test").modmail.create(subject="test", body="hello", recipient="spez")

)r3   r   s    r;   r  Subreddit.modmail  s     t}r>   c                    [        U S5      $ )zProvide an instance of :class:`.SubredditRelationship`.

For example, muted users can be iterated through like so:

.. code-block:: python

    for mute in reddit.subreddit("test").muted():
        print(f"{mute}: {mute.date}")

mutedr  r   s    r;   r  Subreddit.muted  s     %T733r>   c                    [        U 5      $ )aC  Provide an instance of :class:`.SubredditQuarantine`.

This property is named ``quaran`` because ``quarantine`` is a subreddit
attribute returned by Reddit to indicate whether or not a subreddit is
quarantined.

To opt-in into a quarantined subreddit:

.. code-block:: python

    reddit.subreddit("test").quaran.opt_in()

)r  r   s    r;   quaranSubreddit.quaran+       #4((r>   c                    [        U 5      $ )a  Provide an instance of :class:`.SubredditRules`.

Use this attribute for interacting with a :class:`.Subreddit`'s rules.

For example, to list all the rules for a subreddit:

.. code-block:: python

    for rule in reddit.subreddit("test").rules:
        print(rule)

Moderators can also add rules to the subreddit. For example, to make a rule
called ``"No spam"`` in r/test:

.. code-block:: python

    reddit.subreddit("test").rules.mod.add(
        short_name="No spam", kind="all", description="Do not spam. Spam bad"
    )

r,   r   s    r;   rulesSubreddit.rules<  r   r>   c                    [        U 5      $ )a  Provide an instance of :class:`.SubredditStream`.

Streams can be used to indefinitely retrieve new comments made to a subreddit,
like:

.. code-block:: python

    for comment in reddit.subreddit("test").stream.comments():
        print(comment)

Additionally, new submissions can be retrieved via the stream. In the following
example all submissions are fetched via the special r/all:

.. code-block:: python

    for submission in reddit.subreddit("all").stream.submissions():
        print(submission)

)r  r   s    r;   rM  Subreddit.streamU  s    * t$$r>   c                    [        U 5      $ )a]  Provide an instance of :class:`.SubredditStylesheet`.

For example, to add the css data ``.test{color:blue}`` to the existing
stylesheet:

.. code-block:: python

    subreddit = reddit.subreddit("test")
    stylesheet = subreddit.stylesheet()
    stylesheet.stylesheet += ".test{color:blue}"
    subreddit.stylesheet.update(stylesheet.stylesheet)

)r  r   s    r;   r@  Subreddit.stylesheetl  r  r>   c                    [        U 5      $ )a.  Provide an instance of :class:`.SubredditWidgets`.

**Example usage**

Get all sidebar widgets:

.. code-block:: python

    for widget in reddit.subreddit("test").widgets.sidebar:
        print(widget)

Get ID card widget:

.. code-block:: python

    print(reddit.subreddit("test").widgets.id_card)

)r.   r   s    r;   widgetsSubreddit.widgets}  s    (  %%r>   c                    [        U 5      $ )az  Provide an instance of :class:`.SubredditWiki`.

This attribute can be used to discover all wikipages for a subreddit:

.. code-block:: python

    for wikipage in reddit.subreddit("test").wiki:
        print(wikipage)

To fetch the content for a given wikipage try:

.. code-block:: python

    wikipage = reddit.subreddit("test").wiki["proof"]
    print(wikipage.content_md)

)ru  r   s    r;   r  Subreddit.wiki  s    & T""r>   c                H    U R                   R                  R                  S   $ )zReturn the class's kind.r8   )r9   r  kindsr   s    r;   _kindSubreddit._kind  s     ||""((55r>   c                   > X#4R                  S5      S:w  a  Sn[        U5      eU(       a  X l        [        TU ]  XS9  [
        S   R                  U S9U l        g)a;  Initialize a :class:`.Subreddit` instance.

:param reddit: An instance of :class:`.Reddit`.
:param display_name: The name of the subreddit.

.. note::

    This class should not be initialized directly. Instead, obtain an instance
    via:

    .. code-block:: python

        subreddit = reddit.subreddit("test")

Nr$   z2Either 'display_name' or '_data' must be provided._datar8   r@   )countr   r}   r  rB   r   r   _path)r:   redditr}   r%  r   r  s        r;   rB   Subreddit.__init__  s]    *  &&t,1FCC.  ,-k*11D1A
r>   c                T    SUS.nU R                   R                  [        S   US9S   $ )zConvert a Markdown string to a dict for use with the ``richtext_json`` param.

:param markdown_text: A Markdown string to convert.

:returns: A dict in ``richtext_json`` format.

rtjson)output_modemarkdown_textconvert_rte_bodyrw   output)r9   rY   r   )r:   r-  	text_datas      r;   _convert_to_fancypants Subreddit._convert_to_fancypants  s3     %-}M	||  *<!=I NxXXr>   c                   > U R                  5       nUS   n[        U 5      " U R                  US9nU R                  R	                  UR                  5        [
        TU ]  5         g )Nrx   r$  )_fetch_datari  r9   __dict__r   r  _fetch)r:   rx   otherr  s      r;   r6  Subreddit._fetch  sN    !F|T
4<<t4U^^,r>   c                    SSU 0S 4$ )Nsubreddit_aboutr8   rh   r   s    r;   _fetch_infoSubreddit._fetch_info  s     ;"5t;;r>   c                    UR                   n[        U5      nU Vs/ s H  oDR                  PM     nnUSS / SQ:X  a+  S USS  5       u  pgp[        [	        U5      [	        U	5      S9egs  snf )z9Parse the XML from a response and raise any errors found.N   )CodeMessageProposedSizeMaxSizeAllowedc              3  8   #    U  H  oR                   v   M     g 7frH   r   )rJ   elements     r;   rK   0Subreddit._parse_xml_response.<locals>.<genexpr>  s     2XxG<<xrM   )actualmaximum_size)r   r   tagr   int)
r:   rZ   xmlrootrE  tagscodemessagerG  rH  s
             r;   _parse_xml_responseSubreddit._parse_xml_response  sv    mm3x+/04408LL2XtTVUVx2X/D6(6{\1B  M 1s   A*c                    UR                  S5       nU R                  R                  R                  R                  R                  X#SU0S9sS S S 5        $ ! , (       d  f       g = f)Nr  r  r  )r  r9   r  r  r  rY   )r:   r  r  r  medias        r;   _read_and_post_mediaSubreddit._read_and_post_media  sM     YYt_<<%%0066;;VUO <  __s   :A
A$timeoutwithout_websocketsc               F   U R                   R                  [        S   US9nUS   S   S   nSnUb  U(       d   [        R                  " XRS9nUc  g [        UR                  5       5      n	UR                  5         U	R                  S
5      S:X  a  [        eU	S   S   n
U R                   R                  U
S9$ ! [
        [        R                  [        4 a  nSn[        X5      SeSnAff = f! [
        [        R                  [        4 a  nS	n[        UU5      SeSnAff = f)zSubmit and return an ``image``, ``video``, or ``videogif``.

This is a helper method for submitting posts that are not link posts or self
posts.

submitrw   r$  rx   websocket_urlN)rV  z(Error establishing websocket connection.zNWebsocket error. Check your media file. Your post may still have been created.ri  failedpayloadredirectr   )r9   rY   r   	websocketcreate_connectionOSErrorr   BlockingIOErrorr   recvr   r   r   
submission)r:   rx   rV  rW  rZ   rZ  
connectionws_exceptionr   	ws_updater   s              r;   _submit_mediaSubreddit._submit_media  s<    <<$$Xh%7d$C (0A
$-?F&88X
 	joo/0I == H,!!	":.||&&3&//- ,, F
 A(;EF 55G 	bC$ 	s/   B8 )C- 8C*C%%C*-D DD c                f    U R                  U5        U R                  UR                  SS9Ul        U$ )zUpload media for use in self posts and return ``inline_media``.

:param inline_media: An :class:`.InlineMedia` object to validate and upload.

selfpost)
media_pathrK  )r  _upload_mediar  media_id)r:   r  s     r;   _upload_inline_mediaSubreddit._upload_inline_media  s=     	##L1 $ 2 2#((j !3 !
 r>   link)expected_mime_prefixrK  c               Z   UcD  [        [        5      R                  5       nUR                  R                  R                  S-  S-  nO[        U5      nUR                  R                  5       nUR                  S5      S   nSSSS	S	S
S.R                  US	5      nUb2  UR                  S5      S   U:w  a  SU< SU< SU< S3n[        U5      eXWS.n	[        S   n
U R                  R                  XS9nUS   nSUS    3nUS    Vs0 s H  oS   US   _M     nnU R                  XMU5      nUR                  (       d  U R                  U5         UR!                  5         US   S     US:X  a
  U SUS    3$ US   S    $ s  snf ! ["         a  n[%        UR&                  S9SeSnAff = f)!a  Upload media and return its URL and a websocket (Undocumented endpoint).

:param expected_mime_prefix: If provided, enforce that the media has a mime type
    that starts with the provided prefix.
:param upload_type: One of ``"link"``, ``"gallery"'', or ``"selfpost"``
    (default: ``"link"``).

:returns: A tuple containing ``(media_url, websocket_url)`` for the piece of
    media. The websocket URL can be used to determine when media processing is
    finished, or it can be ignored.

Nr  zPRAW logo.png.r   r  zvideo/quicktimez	video/mp4r
  z	image/gif)r  movmp4r  jpeggifr  r   z"Expected a mimetype starting with z but got mimetype z (from file extension z).)r	  r  media_assetrw   argsr  re  r  r   r   )rZ   assetrZ  rq  rf   asset_id)r	   __file__absoluteparentr   r  
rpartitionr   	partitionr   r   r9   rY   rT  okrP  r  r   r   rZ   )r:   rr  rl  rK  r  	file_namefile_extension	mime_typer   img_datar   upload_responser  r  r   r  rZ   errs                     r;   rm  Subreddit._upload_media'  s   & >**,D++22X=OJ
#DIIOO%	"--c215$ 
 #L
 	 !,##C(+/CC67K6NN`aj`m  nD  ES  DV  VX  YC!#&& )A}%,,++C+?&v.l8456
?KH?UV?UtF|T']2?UV,,T{K{{$$X.	?%%' 	 1&  \;u#5"677w'
33 W  	?s||4$>	?s   	FF 
F*F%%F*c                r    U R                   R                  [        S   R                  [	        U 5      S95      $ )a  Get the post requirements for a subreddit.

:returns: A dict with the various requirements.

The returned dict contains the following keys:

- ``domain_blacklist``
- ``body_restriction_policy``
- ``domain_whitelist``
- ``title_regexes``
- ``body_blacklisted_strings``
- ``body_required_strings``
- ``title_text_min_length``
- ``is_flair_required``
- ``title_text_max_length``
- ``body_regexes``
- ``link_repost_age``
- ``body_text_min_length``
- ``link_restriction_policy``
- ``body_text_max_length``
- ``title_required_strings``
- ``title_blacklisted_strings``
- ``guidelines_text``
- ``guidelines_display_policy``

For example, to fetch the post requirements for r/test:

.. code-block:: python

    print(reddit.subreddit("test").post_requirements)

post_requirementsr@   )r9   r   r   r   rI   r   s    r;   r  Subreddit.post_requirementsi  s7    B ||()003t90E
 	
r>   c                |   [         S   R                  U S9n U R                  R                  USU R                  R                  0S9   U R                  U R                  [        U R                  R                  R                  W5      S9$ ! [
         a  nUR                  n SnAN^SnAff = f! [         a     gf = f)aO  Return a random :class:`.Submission`.

Returns ``None`` on subreddits that do not support the random feature. One
example, at the time of writing, is r/wallpapers.

For example, to get a random submission off of r/AskReddit:

.. code-block:: python

    submission = reddit.subreddit("AskReddit").random()
    print(submission.title)

subreddit_randomr@   r   rV   Nr^  )r   r   r9   r   r   r   r  _submission_classr   r  
reddit_urlr   )r:   r   r]  r  s       r;   randomSubreddit.random  s     )*11D1A	!LLS(DLL4M4M)NO	))'$,,*=*=*H*H$"O *    	!==D	!  		s*   0B 	AB. 
B+B&&B+.
B;:B;queryr_   syntaxtime_filter	relevancelucenerd   )r_   r  r  c          
         U R                  U5        U R                  R                  5       S:g  nU R                  USUUUUUS9  [        S   R                  U S9n[        U R                  U40 UD6$ )a  Return a :class:`.ListingGenerator` for items that match ``query``.

:param query: The query string to search for.
:param sort: Can be one of: ``"relevance"``, ``"hot"``, ``"top"``, ``"new"``, or
    ``"comments"``. (default: ``"relevance"``).
:param syntax: Can be one of: ``"cloudsearch"``, ``"lucene"``, or ``"plain"``
    (default: ``"lucene"``).
:param time_filter: Can be one of: ``"all"``, ``"day"``, ``"hour"``,
    ``"month"``, ``"week"``, or ``"year"`` (default: ``"all"``).

For more information on building a search query see:
https://www.reddit.com/wiki/search

For example, to search all subreddits for ``"praw"`` try:

.. code-block:: python

    for submission in reddit.subreddit("all").search("praw"):
        print(submission.title)

rd   rW   )re   rf   qrestrict_srr_   r  tsearchr@   )_validate_time_filterr}   r  rk   r   r   r    r9   )r:   r  r_   r  r  rl   not_allr   s           r;   r  Subreddit.search  s    > 	"";/##))+u4""& 	# 	
 x ''$'7cF5EFFr>   numberr$   )r  c               2   [         S   R                  U S9n U R                  R                  USU0S9  U R                  U R                  [        U R                  R                  R                  W5      S9$ ! [         a  nUR
                  n SnAN]SnAff = f)aO  Return a :class:`.Submission` object for a sticky of the subreddit.

:param number: Specify which sticky to return. 1 appears at the top (default:
    ``1``).

:raises: ``prawcore.NotFound`` if the sticky does not exist.

For example, to get the stickied post on r/test:

.. code-block:: python

    reddit.subreddit("test").sticky()

about_stickyr@   numrV   Nr^  )
r   r   r9   r   r   r  r  r   r  r  )r:   r  r   r]  r  s        r;   stickySubreddit.sticky  s      ~&---=	!LLS%9 %%LLgdll&9&9&D&DdK & 
 	
  	!==D	!s   A6 6
B BBselftextr   flair_idr   resubmitsend_repliesnsfwspoilercollection_iddiscussion_typedraft_idFT)r  r  r  r  r   r  r  r  r  r  r  r   c                  [        U
5      =(       d    U
S:H  [        U5      :X  a  Sn[        U5      e[        U 5      [        U	5      [        U5      U[        U5      [        U5      U R                  R                  S.nSU4SU4SU4SU4SU44 H  u  nnUc  M  UUU'   M     U
b  UR                  S	S
9  U(       ap  U
R                  " S0 UR                  5        VVs0 s H  u  nnUU R                  U5      _M     snnD6nU R                  U5      nUR                  [        U5      S9  O UR                  U
S9  OUR                  SUS9  U R                  R                  [        S   US9$ s  snnf )a  Add a submission to the :class:`.Subreddit`.

:param title: The title of the submission.
:param collection_id: The UUID of a :class:`.Collection` to add the
    newly-submitted post to.
:param discussion_type: Set to ``"CHAT"`` to enable live discussion instead of
    traditional comments (default: ``None``).
:param draft_id: The ID of a draft to submit.
:param flair_id: The flair template to select (default: ``None``).
:param flair_text: If the template's ``flair_text_editable`` value is ``True``,
    this value will set a custom text (default: ``None``). ``flair_id`` is
    required when ``flair_text`` is provided.
:param inline_media: A dict of :class:`.InlineMedia` objects where the key is
    the placeholder name in ``selftext``.
:param nsfw: Whether the submission should be marked NSFW (default: ``False``).
:param resubmit: When ``False``, an error will occur if the URL has already been
    submitted (default: ``True``).
:param selftext: The Markdown formatted content for a ``text`` submission. Use
    an empty string, ``""``, to make a title-only submission.
:param send_replies: When ``True``, messages will be sent to the submission
    author when comments are made to the submission (default: ``True``).
:param spoiler: Whether the submission should be marked as a spoiler (default:
    ``False``).
:param url: The URL for a ``link`` submission.

:returns: A :class:`.Submission` object for the newly created submission.

Either ``selftext`` or ``url`` can be provided, but not both.

For example, to submit a URL to r/test do:

.. code-block:: python

    title = "PRAW documentation"
    url = "https://praw.readthedocs.io"
    reddit.subreddit("test").submit(title, url=url)

For example, to submit a self post with inline media do:

.. code-block:: python

    from praw.models import InlineGif, InlineImage, InlineVideo

    gif = InlineGif(path="path/to/image.gif", caption="optional caption")
    image = InlineImage(path="path/to/image.jpg", caption="optional caption")
    video = InlineVideo(path="path/to/video.mp4", caption="optional caption")
    selftext = "Text with a gif {gif1} an image {image1} and a video {video1} inline"
    media = {"gif1": gif, "image1": image, "video1": video}
    reddit.subreddit("test").submit("title", inline_media=media, selftext=selftext)

.. note::

    Inserted media will have a padding of ``\\n\\n`` automatically added. This
    is due to the weirdness with Reddit's API. Using the example above, the
    result selftext body will look like so:

    .. code-block::

        Text with a gif

        ![gif](u1rchuphryq51 "optional caption")

        an image

        ![img](srnr8tshryq51 "optional caption")

        and video

        ![video](gmc7rvthryq51 "optional caption")

        inline

.. note::

    To submit a post to a subreddit with the ``"news"`` flair, you can get the
    flair id like this:

    .. code-block::

        choices = list(subreddit.flair.link_templates.user_selectable())
        template_id = next(x for x in choices if x["flair_text"] == "news")["flair_template_id"]
        subreddit.submit("title", flair_id=template_id, url="https://www.news.com/")

.. seealso::

    - :meth:`~.Subreddit.submit_gallery` to submit more than one image in the
      same post
    - :meth:`~.Subreddit.submit_image` to submit images
    - :meth:`~.Subreddit.submit_poll` to submit polls
    - :meth:`~.Subreddit.submit_video` to submit videos and videogifs

r   z,Either 'selftext' or 'url' must be provided.r  r  sendrepliesr  r  r  validate_on_submitr  r   r  r  r  r:   )kind)richtext_jsonrD  rq  r  r   rY  rw   rh   )r   r   rI   r9   r  r   r   r1  ro  r1  r   rY   r   )r:   r  r  r  r  r  r   r  r  r  r  r  r  r   r   rx   rf   r   placeholderrS  rp   	converteds                         r;   rY  Subreddit.submit  s   x N,h"nc:@CC.  d)X-JG}"&,,"A"A
 ":&m,0"
JC  !S	
 KKVK$  3?2D2D2F2F.K $T%>%>u%EE2F !77=	%	*:;*KKVK-||  (!3$ ??s   E,)r  r  r  r   r  r  r  c               J   U R                  U5        S/ [        U5      [        U5      S[        U	5      [        U 5      UU R                  R                  S.	n
SU4SU4SU4SU44 H  u  pUc  M
  XU'   M     U HM  nU
S   R                  UR                  S	S
5      UR                  SS
5      U R                  SUS   SS9S.5        MO     U R                  R                  U
S[        S   S9S   nUS   (       a  [        US   5      eU R                  R                  US   S   S9$ )aQ  Add an image gallery submission to the subreddit.

:param title: The title of the submission.
:param images: The images to post in dict with the following structure:
    ``{"image_path": "path", "caption": "caption", "outbound_url": "url"}``,
    only ``image_path`` is required.
:param collection_id: The UUID of a :class:`.Collection` to add the
    newly-submitted post to.
:param discussion_type: Set to ``"CHAT"`` to enable live discussion instead of
    traditional comments (default: ``None``).
:param flair_id: The flair template to select (default: ``None``).
:param flair_text: If the template's ``flair_text_editable`` value is ``True``,
    this value will set a custom text (default: ``None``). ``flair_id`` is
    required when ``flair_text`` is provided.
:param nsfw: Whether the submission should be marked NSFW (default: ``False``).
:param send_replies: When ``True``, messages will be sent to the submission
    author when comments are made to the submission (default: ``True``).
:param spoiler: Whether the submission should be marked asa spoiler (default:
    ``False``).

:returns: A :class:`.Submission` object for the newly created submission.

:raises: :class:`.ClientException` if ``image_path`` in ``images`` refers to a
    file that is not an image.

For example, to submit an image gallery to r/test do:

.. code-block:: python

    title = "My favorite pictures"
    image = "/path/to/image.png"
    image2 = "/path/to/image2.png"
    image3 = "/path/to/image3.png"
    images = [
        {"image_path": image},
        {
            "image_path": image2,
            "caption": "Image caption 2",
        },
        {
            "image_path": image3,
            "caption": "Image caption 3",
            "outbound_url": "https://example.com/link3",
        },
    ]
    reddit.subreddit("test").submit_gallery(title, images)

.. seealso::

    - :meth:`~.Subreddit.submit` to submit url posts and selftexts
    - :meth:`~.Subreddit.submit_image` to submit single images
    - :meth:`~.Subreddit.submit_poll` to submit polls
    - :meth:`~.Subreddit.submit_video` to submit videos and videogifs

r$  T)	api_typer1  r  r  show_error_listr  r  r  r  r  r   r  r  r1  r  r   outbound_urlr  r  gallery)rr  rl  rK  )r  r  rn  POSTsubmit_gallery_post)r$  methodr  r  rx   r   r^  )r  r   rI   r9   r  appendr   rm  requestr   r   rd  )r:   r  r  r  r  r  r   r  r  r  rx   rf   r   r  rZ   s                  r;   submit_gallerySubreddit.submit_gallery  s[   ^ 	v&J-#G}d)"&,,"A"A

 ":&m,0	
JC  !S	
 EM  $yyB7$)IInb$A $ 2 2-4#(#6$- !3 !
  <<''f84I+J ( 

 H$Xh%788||&&8F+;E+B&CCr>   r  
   )
r  r  r  r   r  r  r  r  rV  rW  c       
        8   [        U 5      [        U5      [        U	5      U[        U5      [        U
5      U R                  R                  S.nSU4SU4SU4SU44 H  u  pUc  M
  XU'   M     U R	                  SUS9nUR                  SUS9  U R                  XUS	9$ )
a  Add an image submission to the subreddit.

:param collection_id: The UUID of a :class:`.Collection` to add the
    newly-submitted post to.
:param discussion_type: Set to ``"CHAT"`` to enable live discussion instead of
    traditional comments (default: ``None``).
:param flair_id: The flair template to select (default: ``None``).
:param flair_text: If the template's ``flair_text_editable`` value is ``True``,
    this value will set a custom text (default: ``None``). ``flair_id`` is
    required when ``flair_text`` is provided.
:param image_path: The path to an image, to upload and post.
:param nsfw: Whether the submission should be marked NSFW (default: ``False``).
:param resubmit: When ``False``, an error will occur if the URL has already been
    submitted (default: ``True``).
:param send_replies: When ``True``, messages will be sent to the submission
    author when comments are made to the submission (default: ``True``).
:param spoiler: Whether the submission should be marked as a spoiler (default:
    ``False``).
:param timeout: Specifies a particular timeout, in seconds. Use to avoid
    "Websocket error" exceptions (default: ``10``).
:param title: The title of the submission.
:param without_websockets: Set to ``True`` to disable use of WebSockets (see
    note below for an explanation). If ``True``, this method doesn't return
    anything (default: ``False``).

:returns: A :class:`.Submission` object for the newly created submission, unless
    ``without_websockets`` is ``True``.

:raises: :class:`.ClientException` if ``image_path`` refers to a file that is
    not an image.

.. note::

    Reddit's API uses WebSockets to respond with the link of the newly created
    post. If this fails, the method will raise :class:`.WebSocketException`.
    Occasionally, the Reddit post will still be created. More often, there is an
    error with the image file. If you frequently get exceptions but successfully
    created posts, try setting the ``timeout`` parameter to a value above 10.

    To disable the use of WebSockets, set ``without_websockets=True``. This will
    make the method return ``None``, though the post will still be created. You
    may wish to do this if you are running your program in a restricted network
    environment, or using a proxy that doesn't support WebSockets connections.

For example, to submit an image to r/test do:

.. code-block:: python

    title = "My favorite picture"
    image = "/path/to/image.png"
    reddit.subreddit("test").submit_image(title, image)

.. seealso::

    - :meth:`~.Subreddit.submit` to submit url posts and selftexts
    - :meth:`~.Subreddit.submit_gallery` to submit more than one image in the
      same post
    - :meth:`~.Subreddit.submit_poll` to submit polls
    - :meth:`~.Subreddit.submit_video` to submit videos and videogifs

r  r  r   r  r  r  rr  rl  r  rx   rV  rW  rI   r   r9   r  rm  r   rh  )r:   r  r  r  r  r  r   r  r  r  r  rV  rW  rx   rf   r   rT  s                    r;   submit_imageSubreddit.submit_image  s    x d)X-JG}"&,,"A"A
 ":&m,0	
JC  !S	
 &&!(Z ' 
	 	i0!!;M " 
 	
r>   optionsduration)r  r  r  r   r  r  r  r  c                   [        U 5      U
UU[        U	5      [        U5      U[        U5      [        U5      U R                  R                  S.
nSU4SU4SU4SU44 H  u  pUc  M
  XU'   M     U R                  R	                  [
        S   US9$ )a  Add a poll submission to the subreddit.

:param title: The title of the submission.
:param collection_id: The UUID of a :class:`.Collection` to add the
    newly-submitted post to.
:param discussion_type: Set to ``"CHAT"`` to enable live discussion instead of
    traditional comments (default: ``None``).
:param duration: The number of days the poll should accept votes, as an ``int``.
    Valid values are between ``1`` and ``7``, inclusive.
:param flair_id: The flair template to select (default: ``None``).
:param flair_text: If the template's ``flair_text_editable`` value is ``True``,
    this value will set a custom text (default: ``None``). ``flair_id`` is
    required when ``flair_text`` is provided.
:param nsfw: Whether the submission should be marked NSFW (default: ``False``).
:param options: A list of two to six poll options as ``str``.
:param resubmit: When ``False``, an error will occur if the URL has already been
    submitted (default: ``True``).
:param selftext: The Markdown formatted content for the submission. Use an empty
    string, ``""``, to make a submission with no text contents.
:param send_replies: When ``True``, messages will be sent to the submission
    author when comments are made to the submission (default: ``True``).
:param spoiler: Whether the submission should be marked as a spoiler (default:
    ``False``).

:returns: A :class:`.Submission` object for the newly created submission.

For example, to submit a poll to r/test do:

.. code-block:: python

    title = "Do you like PRAW?"
    reddit.subreddit("test").submit_poll(
        title, selftext="", options=["Yes", "No"], duration=3
    )

.. seealso::

    - :meth:`~.Subreddit.submit` to submit url posts and selftexts
    - :meth:`~.Subreddit.submit_gallery` to submit more than one image in the
      same post
    - :meth:`~.Subreddit.submit_image` to submit single images
    - :meth:`~.Subreddit.submit_video` to submit videos and videogifs

)
r  r   r  r  r  r  r  r  r  r  r  r   r  r  submit_poll_postr  )rI   r   r9   r  rY   r   )r:   r  r  r  r  r  r   r  r  r  r  r  r  rx   rf   r   s                   r;   submit_pollSubreddit.submit_poll}  s    V d) X-JG}"&,,"A"A
 ":&m,0	
JC  !S	
 ||  *<!=D IIr>   
video_pathvideogifthumbnail_path)r  r  r  r   r  r  r  r  r  rV  r  rW  c               j   [        U 5      [        U5      [        U	5      U[        U5      [        U
5      U R                  R                  S.nSU4SU4SU4SU44 H  u  nnUc  M  UUU'   M     U R	                  SUS9nUR                  U(       a  SOSUU R	                  US	9S
9  U R                  XUS9$ )a7  Add a video or videogif submission to the subreddit.

:param title: The title of the submission.
:param video_path: The path to a video, to upload and post.
:param collection_id: The UUID of a :class:`.Collection` to add the
    newly-submitted post to.
:param discussion_type: Set to ``"CHAT"`` to enable live discussion instead of
    traditional comments (default: ``None``).
:param flair_id: The flair template to select (default: ``None``).
:param flair_text: If the template's ``flair_text_editable`` value is ``True``,
    this value will set a custom text (default: ``None``). ``flair_id`` is
    required when ``flair_text`` is provided.
:param nsfw: Whether the submission should be marked NSFW (default: ``False``).
:param resubmit: When ``False``, an error will occur if the URL has already been
    submitted (default: ``True``).
:param send_replies: When ``True``, messages will be sent to the submission
    author when comments are made to the submission (default: ``True``).
:param spoiler: Whether the submission should be marked as a spoiler (default:
    ``False``).
:param thumbnail_path: The path to an image, to be uploaded and used as the
    thumbnail for this video. If not provided, the PRAW logo will be used as the
    thumbnail.
:param timeout: Specifies a particular timeout, in seconds. Use to avoid
    "Websocket error" exceptions (default: ``10``).
:param videogif: If ``True``, the video is uploaded as a videogif, which is
    essentially a silent video (default: ``False``).
:param without_websockets: Set to ``True`` to disable use of WebSockets (see
    note below for an explanation). If ``True``, this method doesn't return
    anything (default: ``False``).

:returns: A :class:`.Submission` object for the newly created submission, unless
    ``without_websockets`` is ``True``.

:raises: :class:`.ClientException` if ``video_path`` refers to a file that is
    not a video.

.. note::

    Reddit's API uses WebSockets to respond with the link of the newly created
    post. If this fails, the method will raise :class:`.WebSocketException`.
    Occasionally, the Reddit post will still be created. More often, there is an
    error with the image file. If you frequently get exceptions but successfully
    created posts, try setting the ``timeout`` parameter to a value above 10.

    To disable the use of WebSockets, set ``without_websockets=True``. This will
    make the method return ``None``, though the post will still be created. You
    may wish to do this if you are running your program in a restricted network
    environment, or using a proxy that doesn't support WebSockets connections.

For example, to submit a video to r/test do:

.. code-block:: python

    title = "My favorite movie"
    video = "/path/to/video.mp4"
    reddit.subreddit("test").submit_video(title, video)

.. seealso::

    - :meth:`~.Subreddit.submit` to submit url posts and selftexts
    - :meth:`~.Subreddit.submit_image` to submit images
    - :meth:`~.Subreddit.submit_gallery` to submit more than one image in the
      same post
    - :meth:`~.Subreddit.submit_poll` to submit polls

r  r  r   r  r  videor  r  )rl  )r  r   video_poster_urlr  r  )r:   r  r  r  r  r  r   r  r  r  r  r  rV  r  rW  rx   rf   r   	video_urls                      r;   submit_videoSubreddit.submit_video  s    J d)X-JG}"&,,"A"A
 ":&m,0	
JC  !S	
 &&!(Z ' 
	 	'W!//>/J	 	 	
 !!;M " 
 	
r>   )rD   c               l    SSU R                  XS9S.nU R                  R                  [        S   US9  g)zSubscribe to the subreddit.

:param other_subreddits: When provided, also subscribe to the provided list of
    subreddits.

For example, to subscribe to r/test:

.. code-block:: python

    reddit.subreddit("test").subscribe()

subTrD   r8   )re  skip_inital_defaultsr  	subscriberw   Nr  r9   rY   r   r:   rD   rx   s      r;   r  Subreddit.subscribea  sE     $(++!1 , 
 	(;/d;r>   c                `    U R                   R                  [        S   R                  U S95      $ )a  Return a dictionary of the :class:`.Subreddit`'s traffic statistics.

:raises: ``prawcore.NotFound`` when the traffic stats aren't available to the
    authenticated user, that is, they are not public and the authenticated user
    is not a moderator of the subreddit.

The traffic method returns a dict with three keys. The keys are ``day``,
``hour`` and ``month``. Each key contains a list of lists with 3 or 4 values.
The first value is a timestamp indicating the start of the category (start of
the day for the ``day`` key, start of the hour for the ``hour`` key, etc.). The
second, third, and fourth values indicate the unique pageviews, total pageviews,
and subscribers, respectively.

.. note::

    The ``hour`` key does not contain subscribers, and therefore each sub-list
    contains three values.

For example, to get the traffic stats for r/test:

.. code-block:: python

    stats = reddit.subreddit("test").traffic()

about_trafficr@   )r9   r   r   r   r   s    r;   trafficSubreddit.trafficx  s,    4 || 9 @ @4 @ PQQr>   c               j    SU R                  XS9S.nU R                  R                  [        S   US9  g)zUnsubscribe from the subreddit.

:param other_subreddits: When provided, also unsubscribe from the provided list
    of subreddits.

To unsubscribe from r/test:

.. code-block:: python

    reddit.subreddit("test").unsubscribe()

unsubr  )re  r  r  rw   Nr  r  s      r;   unsubscribeSubreddit.unsubscribe  sB    " ++!1 , 
 	(;/d;r>   )r'  r}   )Fr9   praw.Redditr  r6  r  r6  r  r6  r  r6  r  r7  r  r   r  r   r  r6  r  r   r  r6  r  r   r  r   r  r   r   r   r  r6  r  r   r  r6  r  r6  r  r6  r  r6  r  r6  r  r6  r  r6  r  r   r  r   r  r   r  r   r  r   r  r   r  r   r  r7  r  r7  r  r   r  r   )rD   z!list[str | praw.models.Subreddit]r8   r   r   rI   )r  list[dict[str, str]])r  zpraw.models.InlineMedia)r   z2praw.models.reddit.subreddit.SubredditRelationship)r   z3praw.models.reddit.collections.SubredditCollections)r   z4praw.models.reddit.subreddit.ContributorRelationship)r   r'   )r   z-praw.models.reddit.subreddit.SubredditFilters)r   z+praw.models.reddit.subreddit.SubredditFlair)r   r;  )r   z2praw.models.reddit.subreddit.ModeratorRelationship)r   z$praw.models.reddit.subreddit.Modmail)r   z0praw.models.reddit.subreddit.SubredditQuarantine)r   r-   )r   z,praw.models.reddit.subreddit.SubredditStream)r   z0praw.models.reddit.subreddit.SubredditStylesheet)r   zpraw.models.SubredditWidgets)r   z*praw.models.reddit.subreddit.SubredditWiki)r   rI   )NN)r(  r  r}   r   r%  zdict[str, Any] | None)r-  rI   r   r   )rZ   r1   )r  r	   r  rI   r  r  r   r1   )rx   zdict[Any, Any]rV  rJ  rW  r   )rr  r   rl  rI   rK  rI   r  )r   praw.models.Submission | None)r  rI   r_   rI   r  rI   r  rI   rl   r   r   r  )r  rJ  r   praw.models.Submission)r  rI   r  r   r  r   r  r   r  r   r   r   r  z)dict[str, praw.models.InlineMedia] | Noner  r   r  r   r  r   r  r   r  r   r   r   r   r  )r  rI   r  r  r  r   r  r   r  r   r   r   r  r   r  r   r  r   r   r  )r  rI   r  rI   r  r   r  r   r  r   r   r   r  r   r  r   r  r   r  r   rV  rJ  rW  r   r   r  )r  rI   r  r   r  r   r  rJ  r  r   r   r   r  r   r  	list[str]r  r   r  rI   r  r   r  r   r   r  )r  rI   r  rI   r  r   r  r   r  r   r   r   r  r   r  r   r  r   r  r   r  r   rV  rJ  r  r   rW  r   r   r  r   )r   zdict[str, list[list[int]]])7r   r   r   r   r   	STR_FIELDMESSAGE_PREFIXr9  r  r  r  r  r   r}  r  r~  r  r  r   rf  r  r  r  r  r  rM  r@  r  r  propertyr!  rB   r1  r6  r;  rP  rT  rh  ro  rm  r  r  r   r  r  rY  r  r  r  r  r  r  r  r   r  r  s   @r;   rj   rj   	  s.
   EN IN %)-1!%15.2"&!/3(, $ $ $#)-&*"&*.%)"&&*(,(,"&(,%)-1 $(&*#GL9L9 "L9  +	L9
 L9 $/L9 ",L9  L9 L9 "-L9 &L9 L9 L9 L9 L9  !L9" #L9$ '%L9& $'L9(  )L9* (+L9, #-L9.  /L90 $1L92 &3L94 5L96 &7L98  9L9: &;L9< #=L9> !+?L9@ AL9B "CL9D $EL9F GL9H IL9 L9\ ; ) 
	  % % " "
 5 5& E E0 < < $ $0 
& 
& $ $, 
) 
) 8 8&   4 4 ) )  $ $0 % %, ) )  & &* # #( 6 6 $('+	BB !B %	B B:	Y<
&)8F	&0%&003&0IM&0P
 ,0!@4 )@4 	@4
 @4D#
J4 Wfh>
   *G*G 	*G
 *G *G  *G 
**G ?*GX X&' 
 
0 & %)&*##!%BF#!S@S@ "	S@
 $S@ S@ S@ S@ @S@ S@ S@ S@ S@ S@ S@  
 !S@S@j 
  %)&*#!%!iDiD %iD
 "iD $iD iD iD iD iD iD 
 iD
iDV & %)&*#!%!#(e
e
 e

 "e
 $e
 e
 e
 e
 e
 e
 e
 e
 !e
 
'e
e
N $ %)&*#!%!QJQJ "	QJ
 $QJ QJ QJ QJ QJ QJ QJ QJ QJ QJ 
 QJQJf * %)&*#!%!%)#(!q
q
 q

 "q
 $q
 q
 q
 q
 q
 q
 q
 #q
 q
 q
  !!q
" 
'#q
! q
f '(RV < )<,R8 '(HL<#E< )<r>   rj   c            
          \ rS rSrSr  SS jr\" SSSSSS	S
S5      SSSSSSSS.               SS jj5       rS rSS jr	  SS jr
Srg)r   i  z8Provide functions to interact with link flair templates.c              #     #    [         S   R                  U R                  S9nU R                  R                  R	                  U5       Sh  vN   g N7f)zIterate through the link flair templates as a moderator.

For example:

.. code-block:: python

    for template in reddit.subreddit("test").flair.link_templates:
        print(template)


link_flairr@   Nrw  rT  s     r;   r   $SubredditLinkFlairTemplates.__iter__  sA      |$++dnn+E>>))--c222s   A	AAAr   r   r  r  r  r  r  r  Nr   Fr  r  r   r  r  r  r  c               2    U R                  UUUSUUUUUS9	  g)a8  Add a link flair template to the associated subreddit.

:param text: The flair template's text.
:param allowable_content: If specified, most be one of ``"all"``, ``"emoji"``,
    or ``"text"`` to restrict content to that type. If set to ``"emoji"`` then
    the ``"text"`` param must be a valid emoji string, for example,
    ``":snoo:"``.
:param background_color: The flair template's new background color, as a hex
    color.
:param css_class: The flair template's css_class (default: ``""``).
:param max_emojis: Maximum emojis in the flair (Reddit defaults this value to
    ``10``).
:param mod_only: Indicate if the flair can only be used by moderators.
:param text_color: The flair template's new text color, either ``"light"`` or
    ``"dark"``.
:param text_editable: Indicate if the flair text can be modified for each
    redditor that sets it (default: ``False``).

For example, to add an editable link flair try:

.. code-block:: python

    reddit.subreddit("test").flair.link_templates.add(
        "PRAW",
        css_class="praw",
        text_editable=True,
    )

T	r  r  r   r  r  r  r   r  r  Nr  	r:   r   r  r  r   r  r  r  r  s	            r;   r   SubredditLinkFlairTemplates.add  s1    f 			/-!!' 	 
	
r>   c                "    U R                  SS9  g)zRemove all link flair templates from the subreddit.

For example:

.. code-block:: python

    reddit.subreddit("test").flair.link_templates.clear()

Tr
  Nr   r   s    r;   clear!SubredditLinkFlairTemplates.clear  s     	D!r>   c                $    U R                  USS9  g)aO  Reorder a list of flairs.

:param flair_list: A list of flair IDs.

For example, to reverse the order of the link flair list try:

.. code-block:: python

    subreddit = reddit.subreddit("test")
    flairs = [flair["id"] for flair in subreddit.flair.link_templates]
    subreddit.flair.link_templates.reorder(list(reversed(flairs)))

Tr
  Nr&  r:   r   s     r;   reorder#SubredditLinkFlairTemplates.reorder  s     	j$/r>   c              #     #    [         S   R                  U R                  S9nU R                  R                  R	                  USS0S9S    Sh  vN   g N7f)zIterate through the link flair templates as a regular user.

For example:

.. code-block:: python

    for template in reddit.subreddit("test").flair.link_templates.user_selectable():
        print(template)

flairselectorr@   
is_newlinkTrw   choicesNr+  rT  s     r;   user_selectable+SubredditLinkFlairTemplates.user_selectable  sW      '...H>>))..s,9M.N
 	
 	
s   AAAArh   r   zIGenerator[dict[str, str | int | bool | list[dict[str, str]]], None, None]r   rI   r  r   r  r   r   rI   r  r7  r  r6  r  r   r  r   r   r  )r   z,Generator[dict[str, str | bool], None, None])r   r   r   r   r   r   r   r   r  r  r
  r   rh   r>   r;   r   r     s    B3	R3  	 )-'+!% $!%#3
3
 &	3

 %3
 3
 3
 3
 3
 3
	3
j
"0 
	5
r>   r   c            
          \ rS rSrSr  SS jr\" SSSSSS	S
S5      SSSSSSSS.               SS jj5       rS rSS jr	Sr
g)r   i1  zFProvide functions to interact with :class:`.Redditor` flair templates.c              #     #    [         S   R                  U R                  S9nSU R                  R                  R                  0nU R                  R                  R                  XS9 Sh  vN   g N7f)zIterate through the user flair templates.

For example:

.. code-block:: python

    for template in reddit.subreddit("test").flair.templates:
        print(template)


user_flairr@   r   rV   N)r   r   r8   r9   r   r   )r:   r   rW   s      r;   r   (SubredditRedditorFlairTemplates.__iter__4  s^      |$++dnn+EDNN22??@>>))--c-AAAs   A)A3+A1,A3r   r   r  r  r  r  r  r  Nr   Fr  c               2    U R                  UUUSUUUUUS9	  g)a;  Add a redditor flair template to the associated subreddit.

:param text: The flair template's text.
:param allowable_content: If specified, most be one of ``"all"``, ``"emoji"``,
    or ``"text"`` to restrict content to that type. If set to ``"emoji"`` then
    the ``"text"`` param must be a valid emoji string, for example,
    ``":snoo:"``.
:param background_color: The flair template's new background color, as a hex
    color.
:param css_class: The flair template's css_class (default: ``""``).
:param max_emojis: Maximum emojis in the flair (Reddit defaults this value to
    ``10``).
:param mod_only: Indicate if the flair can only be used by moderators.
:param text_color: The flair template's new text color, either ``"light"`` or
    ``"dark"``.
:param text_editable: Indicate if the flair text can be modified for each
    redditor that sets it (default: ``False``).

For example, to add an editable redditor flair try:

.. code-block:: python

    reddit.subreddit("test").flair.templates.add(
        "PRAW",
        css_class="praw",
        text_editable=True,
    )

Fr  Nr  r  s	            r;   r   #SubredditRedditorFlairTemplates.addE  s1    f 			/-!!' 	 
	
r>   c                "    U R                  SS9  g)zRemove all :class:`.Redditor` flair templates from the subreddit.

For example:

.. code-block:: python

    reddit.subreddit("test").flair.templates.clear()

Fr
  Nr  r   s    r;   r  %SubredditRedditorFlairTemplates.clear  s     	E"r>   c                $    U R                  USS9  g)a]  Reorder a list of flairs.

:param flair_list: A list of flair IDs.

For example, to reverse the order of the :class:`.Redditor` flair templates list
try:

.. code-block:: python

    subreddit = reddit.subreddit("test")
    flairs = [flair["id"] for flair in subreddit.flair.templates]
    subreddit.flair.templates.reorder(list(reversed(flairs)))

Fr
  Nr  r  s     r;   r  'SubredditRedditorFlairTemplates.reorder  s     	j%0r>   rh   r  r  r  )r   r   r   r   r   r   r   r   r  r  r   rh   r>   r;   r   r   1  s    PB	RB" 	 )-'+!% $!%#3
3
 &	3

 %3
 3
 3
 3
 3
 3
	3
j
#1r>   r   )[r   
__future__r   r  copyr   csvr   ior   r$  r   r   pathlibr	   typingr
   r   r   r   urllib.parser   warningsr   xml.etree.ElementTreer   r_  prawcorer   prawcore.exceptionsr   requests.exceptionsr   constr   r   
exceptionsr   r   r   r   r   r   utilr   r   listing.generatorr    listing.mixinsr!   r"   r#   baser%   r  r'   mixinsr(   r)   r  r*   rI  r+   r  r-   r  r.   r/   wikipager0   requestsr1   praw.modelsprawr3   r   r   r  r;  rL  r  r  r  r  ru  r  r  rj   _subreddit_classr   r   rh   r>   r;   <module>r1     sj   " "       : :    %   + ) *  4 0 2 7  ! 3 ( 4 ! 4 !xL xLvO+ O+dp pfi4 i4X@X @XFQM QMh5S 5SpA4 A4HDF DFN|W |W~`
 `
F
3 
*K41 K4\n< "7
 n<b/ "+ ~
"9 ~
Bn1&= n1r>   