
    {i#                        S r SSKJr  SSK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  S	S
KJr  SSKJr  SSKJr  SSKJrJr  \(       a  SSKr " S S\\5      rg)zProvide the Multireddit class.    )annotationsN)dumps)TYPE_CHECKINGAny   )API_PATH)_deprecate_argscachedproperty   )SubredditListingMixin   )
RedditBase)Redditor)	SubredditSubredditStreamc                     ^  \ rS rSrSrSr\R                  " S\R                  5      r	\
SS j5       r\SS j5       rSU 4S jjrU 4S jrS	 rSS
 jr\" S5      SS.SS jj5       rS rSS jr  SS jrSrU =r$ )Multireddit   au  A class for users' multireddits.

This is referred to as a "Custom Feed" on the Reddit UI.

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

==================== ==============================================================
Attribute            Description
==================== ==============================================================
``can_edit``         A ``bool`` representing whether or not the authenticated user
                     may edit the multireddit.
``copied_from``      The multireddit that the multireddit was copied from, if it
                     exists, otherwise ``None``.
``created_utc``      When the multireddit was created, in `Unix Time`_.
``description_html`` The description of the multireddit, as HTML.
``description_md``   The description of the multireddit, as Markdown.
``display_name``     The display name of the multireddit.
``name``             The name of the multireddit.
``over_18``          A ``bool`` representing whether or not the multireddit is
                     restricted for users over 18.
``subreddits``       A list of :class:`.Subreddit`\ s that make up the multireddit.
``visibility``       The visibility of the multireddit, either ``"private"``,
                     ``"public"``, or ``"hidden"``.
==================== ==============================================================

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

pathz[\W_]+c                    [         R                  R                  SU 5      R                  S5      R	                  5       n [        U 5      S:  a!  U SS n U R                  S5      nUS:  a  U SU n U =(       d    S$ )zrReturn a slug version of the title.

:param title: The title to make a slug of.

Adapted from Reddit's utils.py.

_   Nr   )r   
RE_INVALIDsubstriplowerlenrfind)title	last_words     R/home/james-whalen/.local/lib/python3.13/site-packages/praw/models/reddit/multi.pysluggifyMultireddit.sluggify5   sq     &&**36<<SAGGIu:?#2JEC(I1}jy)|    c                    [        U 5      $ )a=  Provide an instance of :class:`.SubredditStream`.

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

.. code-block:: python

    for comment in reddit.multireddit(redditor="spez", name="fun").stream.comments():
        print(comment)

Additionally, new submissions can be retrieved via the stream. In the following
example all new submissions to the multireddit are fetched:

.. code-block:: python

    for submission in reddit.multireddit(
        redditor="bboe", name="games"
    ).stream.submissions():
        print(submission)

)r   selfs    r!   streamMultireddit.streamF   s    . t$$r$   c                  > SU l         [        TU ]	  XS9  [        XR                   R	                  SS5      S   5      U l        [        S   R                  U R                  U R
                  S9U l	        SU R                  SS  3U l         S	U R                  ;   a/  U R                   Vs/ s H  n[        XS
   5      PM     snU l        ggs  snf )z,Initialize a :class:`.Multireddit` instance.N_data/r   r   multiredditmultiuser
subredditsname)r   super__init__r   split_authorr   formatr4   _path__dict__r3   r   )r'   redditr,   x	__class__s       r!   r6   Multireddit.__init___   s    	-		Q(?(BCm,33$))$,,3W


3B()	4==(EI__U_y6;_UDO )Us   (C
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 )Ndatar+   )_fetch_datatype_redditr;   updater5   _fetch)r'   rA   otherr>   s      r!   rF   Multireddit._fetchi   sN    !F|T
4<<t4U^^,r$   c                N    SU R                   U R                  R                   S.S 4$ )Nmultireddit_apir/   )r4   r8   r&   s    r!   _fetch_infoMultireddit._fetch_infop   s(    ii):):;
 	
r$   c           
         [         S   R                  U R                  U R                  US9nU R                  R                  US[        S[        U5      05      0S9  U R                  S5        g)a  Add a subreddit to this multireddit.

:param subreddit: The subreddit to add to this multi.

For example, to add r/test to multireddit ``bboe/test``:

.. code-block:: python

    subreddit = reddit.subreddit("test")
    reddit.multireddit(redditor="bboe", name="test").add(subreddit)

multireddit_updater0   r1   	subredditmodelr4   rA   r3   N)	r   r9   r4   r8   rD   putr   str_reset_attributesr'   rP   urls      r!   addMultireddit.addw   sh     +,33))$,,) 4 
 	GUFC	N3K-L#MN|,r$   display_nameN)rZ   c               2   U(       a  U R                  U5      nOU R                  nU R                  nUU R                  [        S   R                  X R                  R                  R                  5       S9S.nU R                  R                  [        S   US9$ )a  Copy this multireddit and return the new multireddit.

:param display_name: The display name for the copied multireddit. Reddit will
    generate the ``name`` field from this display name. When not provided the
    copy will use the same display name and name as this multireddit.

To copy the multireddit ``bboe/test`` with a name of ``"testing"``:

.. code-block:: python

    reddit.multireddit(redditor="bboe", name="test").copy(display_name="testing")

r.   r/   )rZ   fromtomultireddit_copyrR   )
r"   rZ   r4   r   r   r9   rD   r1   mepost)r'   rZ   r4   rA   s       r!   copyMultireddit.copy   s     ==.D,,L99D(II=)00!2!2!5!5!7 1 
 ||  *<!=D IIr$   c                    [         S   R                  U R                  U R                  R                  S9nU R                  R                  U5        g)zDelete this multireddit.

For example, to delete multireddit ``bboe/test``:

.. code-block:: python

    reddit.multireddit(redditor="bboe", name="test").delete()

rJ   r/   N)r   r9   r4   r8   rD   delete)r'   r   s     r!   rd   Multireddit.delete   sF     )*11))$,,"3"3 2 
 	D!r$   c           
         [         S   R                  U R                  U R                  US9nU R                  R                  US[        S[        U5      05      0S9  U R                  S5        g)a/  Remove a subreddit from this multireddit.

:param subreddit: The subreddit to remove from this multi.

For example, to remove r/test from multireddit ``bboe/test``:

.. code-block:: python

    subreddit = reddit.subreddit("test")
    reddit.multireddit(redditor="bboe", name="test").remove(subreddit)

rN   rO   rQ   r4   rR   r3   N)	r   r9   r4   r8   rD   rd   r   rT   rU   rV   s      r!   removeMultireddit.remove   sh     +,33))$,,) 4 
 	Cwvs9~6N0O&PQ|,r$   c                `   SU;   a$  US    Vs/ s H  nS[        U5      0PM     snUS'   [        S   R                  U R                  U R                  R                  S9nU R
                  R                  US[        U5      0S9nU R                  R                  UR                  5        gs  snf )a  Update this multireddit.

Keyword arguments are passed for settings that should be updated. They can any
of:

:param display_name: The display name for this multireddit. Must be no longer
    than 50 characters.
:param subreddits: Subreddits for this multireddit.
:param description_md: Description for this multireddit, formatted in Markdown.
:param icon_name: Can be one of: ``"art and design"``, ``"ask"``, ``"books"``,
    ``"business"``, ``"cars"``, ``"comics"``, ``"cute animals"``, ``"diy"``,
    ``"entertainment"``, ``"food and drink"``, ``"funny"``, ``"games"``,
    ``"grooming"``, ``"health"``, ``"life advice"``, ``"military"``, ``"models
    pinup"``, ``"music"``, ``"news"``, ``"philosophy"``, ``"pictures and
    gifs"``, ``"science"``, ``"shopping"``, ``"sports"``, ``"style"``,
    ``"tech"``, ``"travel"``, ``"unusual stories"``, ``"video"``, or ``None``.
:param key_color: RGB hex color code of the form ``"#FFFFFF"``.
:param visibility: Can be one of: ``"hidden"``, ``"private"``, or ``"public"``.
:param weighting_scheme: Can be one of: ``"classic"`` or ``"fresh"``.

For example, to rename multireddit ``"bboe/test"`` to ``"bboe/testing"``:

.. code-block:: python

    reddit.multireddit(redditor="bboe", name="test").update(display_name="testing")

r3   r4   rJ   r/   rQ   rR   N)
rT   r   r9   r4   r8   rD   rS   r   r;   rE   )r'   updated_settingsr   r   news        r!   rE   Multireddit.update   s    > ++.>|.L..LsS".L.\* )*11))$,,"3"3 2 
 llt7E:J4K*LMS\\*.s   B+)r8   r:   r   r3   )r   rT   returnrT   )rm   r   )r<   zpraw.Redditr,   zdict[str, Any])rP   zpraw.models.Subreddit)rZ   z
str | Nonerm   zpraw.models.Multireddit)rj   z8str | list[str | praw.models.Subreddit | dict[str, str]])__name__
__module____qualname____firstlineno____doc__	STR_FIELDrecompileUNICODEr   staticmethodr"   r
   r(   r6   rF   rK   rX   r	   ra   rd   rg   rE   __static_attributes____classcell__)r>   s   @r!   r   r      s    : IIrzz2J   % %0V
-& ^$15 J %J8"-&'+T'+ '+r$   r   )rr   
__future__r   rt   jsonr   typingr   r   constr   utilr	   r
   listing.mixinsr   baser   redditorr   rP   r   r   praw.modelsprawr    r$   r!   <module>r      s=    $ " 	  %  3 2   1\+' \+r$   