Ë
    Fü´j)h  ã                  ó6  — d Z ddlmZ ddlmZmZmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ ddlmZmZ dd	lmZ dd
lmZ ddlmZ erddlmZmZ ddlZddlmZ  G d„ d«      Z G d„ dee«      Z G d„ d«      Z G d„ d«      Z  G d„ deee«      Z! G d„ d«      Z"y)zProvide the LiveThread class.é    )Úannotations)ÚTYPE_CHECKINGÚAnyÚcast)ÚAPI_PATH)ÚRedditorList)ÚListingGenerator)Ú
RedditBase)ÚCreatedMixinÚFullnameMixin)ÚRedditor)Ústream_generator)Úcachedproperty)ÚIterableÚIteratorN)Úmodelsc                  óš   — e Zd ZdZedd„«       Zdd„Zdd„Zdd„Zddœ	 	 	 	 	 dd„Z	dd	„Z
dd
„Zdd„Zddœ	 	 	 	 	 dd„Zddœ	 	 	 	 	 dd„Zy)ÚLiveContributorRelationshipz<Provide methods to interact with live threads' contributors.c                óR   — | €dhn
t        | «      } dj                  d„ | D «       «      S )NÚallú,c              3  ó&   K  — | ]	  }d |› �–— Œ y­w)ú+N© )Ú.0Úxs     úU/root/workspace/ytshorts/venv/lib/python3.12/site-packages/praw/models/reddit/live.pyú	<genexpr>zBLiveContributorRelationship._handle_permissions.<locals>.<genexpr>   s   è ø€ Ò5 A˜!˜A˜3œÑ5ùs   ‚)ÚsetÚjoin©Úpermissionss    r   Ú_handle_permissionsz/LiveContributorRelationship._handle_permissions   s*   € à!,Ð!4�u‘g¼#¸kÓ:JˆØ�x‰xÑ5¨Ô5Ó5Ð5ó    c                óð   — t         d   j                  | j                  j                  ¬«      }| j                  j                  j                  |«      }t        dt        |t        «      r|«      S |d   «      S )a  Return a :class:`.RedditorList` for live threads' contributors.

        Usage:

        .. code-block:: python

            thread = reddit.live("ukaeu1ik4sw5")
            for contributor in thread.contributor():
                print(contributor)

        Úlive_contributors©Úidúlist[models.Redditor]r   )	r   ÚformatÚthreadr(   Ú_redditÚgetr   Ú
isinstancer   )ÚselfÚurlÚtemps      r   Ú__call__z$LiveContributorRelationship.__call__   se   € ô Ð*Ñ+×2Ñ2°d·k±k·n±nÐ2ÓEˆØ�{‰{×"Ñ"×&Ñ& sÓ+ˆÜÐ+´ZÀÄlÔ5S¨TÓaÐaÐY]Ð^_ÑY`ÓaÐar$   c                ó   — || _         y)a   Initialize a :class:`.LiveContributorRelationship` instance.

        :param thread: An instance of :class:`.LiveThread`.

        .. note::

            This class should not be initialized directly. Instead, obtain an instance
            via: :meth:`.LiveThread.contributor`.

        N©r+   ©r/   r+   s     r   Ú__init__z$LiveContributorRelationship.__init__/   s   € ð ˆ�r$   c                ó¨   — t         d   j                  | j                  j                  ¬«      }| j                  j                  j                  |«       y)zÊAccept an invite to contribute the live thread.

        Usage:

        .. code-block:: python

            thread = reddit.live("ydwwxneu7vsa")
            thread.contributor.accept_invite()

        Úlive_accept_inviter'   N©r   r*   r+   r(   r,   Úpost©r/   r0   s     r   Úaccept_invitez)LiveContributorRelationship.accept_invite<   s=   € ô Ð+Ñ,×3Ñ3°t·{±{·~±~Ð3ÓFˆØ�‰×Ñ× Ñ  Õ%r$   Nr!   c               óè   — t         d   j                  | j                  j                  ¬«      }t	        |«      | j                  |«      ddœ}| j                  j                  j                  ||¬«       y)aŸ  Invite a redditor to be a contributor of the live thread.

        :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.

        :raises: :class:`.RedditAPIException` if the invitation already exists.

        Usage:

        .. code-block:: python

            thread = reddit.live("ukaeu1ik4sw5")
            redditor = reddit.redditor("spez")

            # "manage" and "settings" permissions
            thread.contributor.invite(redditor, permissions=["manage", "settings"])

        .. seealso::

            :meth:`.LiveContributorRelationship.remove_invite` to remove the invite for
            redditor.

        Úlive_inviter'   Úliveupdate_contributor_invite©Únamer"   Útype©ÚdataN©r   r*   r+   r(   Ústrr#   r,   r:   ©r/   Úredditorr"   r0   rD   s        r   Úinvitez"LiveContributorRelationship.inviteJ   sc   € ô@ �}Ñ%×,Ñ,°·±·±Ð,Ó?ˆä˜“MØ×3Ñ3°KÓ@Ø3ñ
ˆð
 	�‰×Ñ× Ñ  ¨4Ð Õ0r$   c                ó¨   — t         d   j                  | j                  j                  ¬«      }| j                  j                  j                  |«       y)zÑAbdicate the live thread contributor position (use with care).

        Usage:

        .. code-block:: python

            thread = reddit.live("ydwwxneu7vsa")
            thread.contributor.leave()

        Ú
live_leaver'   Nr9   r;   s     r   Úleavez!LiveContributorRelationship.leaver   ó<   € ô �|Ñ$×+Ñ+¨t¯{©{¯~©~Ð+Ó>ˆØ�‰×Ñ× Ñ  Õ%r$   c                óð   — t        |t        «      r|j                  n|}d|i}t        d   j	                  | j
                  j                  ¬«      }| j
                  j                  j                  ||¬«       y)a³  Remove the redditor from the live thread contributors.

        :param redditor: A redditor fullname (e.g., ``"t2_1w72"``) or :class:`.Redditor`
            instance.

        Usage:

        .. code-block:: python

            thread = reddit.live("ukaeu1ik4sw5")
            redditor = reddit.redditor("spez")
            thread.contributor.remove(redditor)
            thread.contributor.remove("t2_1w72")  # with fullname

        r(   Úlive_remove_contribr'   rC   N©	r.   r   Úfullnamer   r*   r+   r(   r,   r:   ©r/   rH   rQ   rD   r0   s        r   Úremovez"LiveContributorRelationship.remove€   sb   € ô  )3°8¼XÔ(F�8×$Ò$ÈHˆØ�hÐˆÜÐ,Ñ-×4Ñ4¸¿¹¿¹Ð4ÓGˆØ�‰×Ñ× Ñ  ¨4Ð Õ0r$   c                óð   — t        |t        «      r|j                  n|}d|i}t        d   j	                  | j
                  j                  ¬«      }| j
                  j                  j                  ||¬«       y)aB  Remove the invite for redditor.

        :param redditor: A redditor fullname (e.g., ``"t2_1w72"``) or :class:`.Redditor`
            instance.

        Usage:

        .. code-block:: python

            thread = reddit.live("ukaeu1ik4sw5")
            redditor = reddit.redditor("spez")
            thread.contributor.remove_invite(redditor)
            thread.contributor.remove_invite("t2_1w72")  # with fullname

        .. seealso::

            :meth:`.LiveContributorRelationship.invite` to invite a redditor to be a
            contributor of the live thread.

        r(   Úlive_remove_inviter'   rC   NrP   rR   s        r   Úremove_invitez)LiveContributorRelationship.remove_invite•   sb   € ô* )3°8¼XÔ(F�8×$Ò$ÈHˆØ�hÐˆÜÐ+Ñ,×3Ñ3°t·{±{·~±~Ð3ÓFˆØ�‰×Ñ× Ñ  ¨4Ð Õ0r$   c               óè   — t         d   j                  | j                  j                  ¬«      }t	        |«      | j                  |«      ddœ}| j                  j                  j                  ||¬«       y)a  Update the contributor 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 (other
            permissions are removed). An empty list ``[]`` indicates no permissions, and
            when not provided (``None``), indicates full permissions.

        For example, to grant all permissions to the contributor, try:

        .. code-block:: python

            thread = reddit.live("ukaeu1ik4sw5")
            thread.contributor.update("spez")

        To grant ``"access"`` and ``"edit"`` permissions (and to remove other
        permissions), try:

        .. code-block:: python

            thread.contributor.update("spez", permissions=["access", "edit"])

        To remove all permissions from the contributor, try:

        .. code-block:: python

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

        Úlive_update_permsr'   Úliveupdate_contributorr@   rC   NrE   rG   s        r   Úupdatez"LiveContributorRelationship.update¯   sd   € ôF Ð*Ñ+×2Ñ2°d·k±k·n±nÐ2ÓEˆä˜“MØ×3Ñ3°KÓ@Ø,ñ
ˆð
 	�‰×Ñ× Ñ  ¨4Ð Õ0r$   c               óè   — t         d   j                  | j                  j                  ¬«      }t	        |«      | j                  |«      ddœ}| j                  j                  j                  ||¬«       y)a2  Update the contributor 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 (other
            permissions are removed). An empty list ``[]`` indicates no permissions, and
            when not provided (``None``), indicates full permissions.

        For example, to set all permissions to the invitation, try:

        .. code-block:: python

            thread = reddit.live("ukaeu1ik4sw5")
            thread.contributor.update_invite("spez")

        To set ``"access"`` and ``"edit"`` permissions (and to remove other permissions)
        to the invitation, try:

        .. code-block:: python

            thread.contributor.update_invite("spez", permissions=["access", "edit"])

        To remove all permissions from the invitation, try:

        .. code-block:: python

            thread.contributor.update_invite("spez", permissions=[])

        rX   r'   r?   r@   rC   NrE   rG   s        r   Úupdate_invitez)LiveContributorRelationship.update_inviteÚ   sd   € ôF Ð*Ñ+×2Ñ2°d·k±k·n±nÐ2ÓEˆä˜“MØ×3Ñ3°KÓ@Ø3ñ
ˆð
 	�‰×Ñ× Ñ  ¨4Ð Õ0r$   )r"   zIterable[str] | NoneÚreturnrF   )r]   r)   ©r+   úmodels.LiveThreadr]   ÚNone©r]   r`   )rH   ústr | models.Redditorr"   zlist[str] | Noner]   r`   )rH   rb   r]   r`   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústaticmethodr#   r2   r6   r<   rI   rL   rS   rV   rZ   r\   r   r$   r   r   r      sª   „ ÙFàò6ó ð6óbó ó&ð$ )-ñ	&1à'ð&1ð &ð	&1ð
 
ó&1óP&ó1ó*1ð< )-ñ	)1à'ð)1ð &ð	)1ð
 
ó)1ð^ )-ñ	)1à'ð)1ð &ð	)1ð
 
ô)1r$   r   c                  ó¶   ‡ — e Zd ZdZdZedd„«       Zedd„«       Zedd„«       Zdd„Z	dd„Z
dd„Z	 	 d	 	 	 	 	 	 	 dˆ fd	„Zdˆ fd
„Zdd„Zdd„Zdd„Zdd„Zˆ xZS )Ú
LiveThreadaB  An individual :class:`.LiveThread` object.

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

    ==================== =========================================================
    Attribute            Description
    ==================== =========================================================
    ``created_utc``      The creation time of the live thread, in `Unix Time`_.
    ``description``      Description of the live thread, as Markdown.
    ``description_html`` Description of the live thread, as HTML.
    ``id``               The ID of the live thread.
    ``nsfw``             A ``bool`` representing whether or not the live thread is
                         marked as NSFW.
    ==================== =========================================================

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

    r(   c                ó   — t        | «      S )zÑProvide an instance of :class:`.LiveThreadContribution`.

        Usage:

        .. code-block:: python

            thread = reddit.live("ukaeu1ik4sw5")
            thread.contrib.add("### update")

        )ÚLiveThreadContribution©r/   s    r   ÚcontribzLiveThread.contrib  s   € ô & dÓ+Ð+r$   c                ó   — t        | «      S )aO  Provide an instance of :class:`.LiveContributorRelationship`.

        You can call the instance to get a list of contributors which is represented as
        :class:`.RedditorList` instance consists of :class:`.Redditor` instances. Those
        :class:`.Redditor` instances have ``permissions`` attributes as contributors:

        .. code-block:: python

            thread = reddit.live("ukaeu1ik4sw5")
            for contributor in thread.contributor():
                # prints `Redditor(name="Acidtwist") ["all"]`
                print(contributor, contributor.permissions)

        )r   rl   s    r   ÚcontributorzLiveThread.contributor*  s   € ô  +¨4Ó0Ð0r$   c                ó   — t        | «      S )aö  Provide an instance of :class:`.LiveThreadStream`.

        Streams are used to indefinitely retrieve new updates made to a live thread,
        like:

        .. code-block:: python

            for live_update in reddit.live("ta535s1hq2je").stream.updates():
                print(live_update.body)

        Updates are yielded oldest first as :class:`.LiveUpdate`. Up to 100 historical
        updates will initially be returned. To only retrieve new updates starting from
        when the stream is created, pass ``skip_existing=True``:

        .. code-block:: python

            live_thread = reddit.live("ta535s1hq2je")
            for live_update in live_thread.stream.updates(skip_existing=True):
                print(live_update.author)

        )ÚLiveThreadStreamrl   s    r   ÚstreamzLiveThread.stream<  s   € ô.   Ó%Ð%r$   c                óœ   — t        |t        «      r|t        | «      k(  S t        || j                  «      xr t        | «      t        |«      k(  S )z‚Return whether the other instance equals the current.

        .. note::

            This comparison is case sensitive.

        )r.   rF   Ú	__class__)r/   Úothers     r   Ú__eq__zLiveThread.__eq__U  s@   € ô �eœSÔ!ØœC ›IÑ%Ð%Ü˜% §¡Ó0ÒL´S¸³YÄ#ÀeÃ*Ñ5LÐLr$   c                óD   — t        | j                  | j                  |«      S )aè  Return a lazy :class:`.LiveUpdate` instance.

        :param update_id: A live update ID, e.g.,
            ``"7827987a-c998-11e4-a0b9-22000b6a88d2"``.

        Usage:

        .. code-block:: python

            thread = reddit.live("ukaeu1ik4sw5")
            update = thread["7827987a-c998-11e4-a0b9-22000b6a88d2"]
            update.thread  # LiveThread(id="ukaeu1ik4sw5")
            update.id  # "7827987a-c998-11e4-a0b9-22000b6a88d2"
            update.author  # "umbrae"

        )Ú
LiveUpdater,   r(   )r/   Ú	update_ids     r   Ú__getitem__zLiveThread.__getitem__a  s   € ô" ˜$Ÿ,™,¨¯©°Ó;Ð;r$   c                ój   — t        | j                  j                  «      t        t        | «      «      z  S )z(Return the hash of the current instance.)Úhashrt   rc   rF   rl   s    r   Ú__hash__zLiveThread.__hash__t  s$   € ä�D—N‘N×+Ñ+Ó,¬t´C¸³I«Ñ>Ð>r$   c                ó€   •— ||fj                  d«      dk7  rd}t        |«      ‚|r|| _        t        ‰| �  ||¬«       y)z¬Initialize a :class:`.LiveThread` instance.

        :param reddit: An instance of :class:`.Reddit`.
        :param id: A live thread ID, e.g., ``"ukaeu1ik4sw5"``

        Né   z(Either 'id' or '_data' must be provided.©Ú_data)ÚcountÚ	TypeErrorr(   Úsuperr6   )r/   Úredditr(   r�   Úmsgrt   s        €r   r6   zLiveThread.__init__x  sG   ø€ ð �ˆ;×Ñ˜TÓ" aÒ'Ø<ˆCÜ˜C“.Ð ÙØˆDŒGÜ‰Ñ˜ uÐÕ-r$   c                óÐ   •— | j                  «       }|d   } t        | «      | j                  |¬«      }| j                  j	                  |j                  «       t
        ‰| �  «        y )NrD   r€   )Ú_fetch_datarB   r,   Ú__dict__rZ   r„   Ú_fetch)r/   rD   ru   rt   s      €r   rŠ   zLiveThread._fetch‹  sP   ø€ Ø×ÑÓ!ˆØ�F‰|ˆØ”�T“
˜4Ÿ<™<¨tÔ4ˆØ�‰×Ñ˜UŸ^™^Ô,Ü‰‰Õr$   c                ó$   — dd| j                   id fS )NÚ	liveaboutr(   r'   rl   s    r   Ú_fetch_infozLiveThread._fetch_info’  s   € Ø˜T 4§7¡7˜O¨TÐ1Ð1r$   c                óv   — t         d   j                  | j                  ¬«      }t        | j                  |fi |¤ŽS )aF  Get submissions linking to the thread.

        :param generator_kwargs: keyword arguments passed to :class:`.ListingGenerator`
            constructor.

        :returns: A :class:`.ListingGenerator` object which yields :class:`.Submission`
            objects.

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

        Usage:

        .. code-block:: python

            thread = reddit.live("ukaeu1ik4sw5")
            for submission in thread.discussions(limit=None):
                print(submission.title)

        Úlive_discussionsr'   )r   r*   r(   r	   r,   )r/   Úgenerator_kwargsr0   s      r   ÚdiscussionszLiveThread.discussions•  s8   € ô* Ð)Ñ*×1Ñ1°T·W±WÐ1Ó=ˆÜ §¡¨cÑFÐ5EÑFÐFr$   c                óˆ   — t         d   j                  | j                  ¬«      }| j                  j	                  |d|i¬«       y)ac  Report the thread violating the Reddit rules.

        :param type: One of ``"spam"``, ``"vote-manipulation"``,
            ``"personal-information"``, ``"sexualizing-minors"``, or
            ``"site-breaking"``.

        Usage:

        .. code-block:: python

            thread = reddit.live("xyu8kmjvfrww")
            thread.report("spam")

        Úlive_reportr'   rB   rC   N)r   r*   r(   r,   r:   )r/   rB   r0   s      r   ÚreportzLiveThread.report­  s;   € ô �}Ñ%×,Ñ,°·±Ð,Ó8ˆØ�‰×Ñ˜# V¨T NÐÕ3r$   c              +  ó¸   K  — t         d   j                  | j                  ¬«      }t        | j                  |fi |¤ŽD ]  }t        d|«      }| |_        |–— Œ y­w)a¹  Return a :class:`.ListingGenerator` yields :class:`.LiveUpdate` s.

        :param generator_kwargs: keyword arguments passed to :class:`.ListingGenerator`
            constructor.

        :returns: A :class:`.ListingGenerator` object which yields :class:`.LiveUpdate`
            objects.

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

        Usage:

        .. code-block:: python

            thread = reddit.live("ukaeu1ik4sw5")
            after = "LiveUpdate_fefb3dae-7534-11e6-b259-0ef8c7233633"
            for submission in thread.updates(limit=5, params={"after": after}):
                print(submission.body)

        Úlive_updatesr'   rx   N)r   r*   r(   r	   r,   r   Ú_thread)r/   r�   r0   rZ   s       r   ÚupdateszLiveThread.updates¿  s\   è ø€ ô, �~Ñ&×-Ñ-°·±Ð-Ó9ˆÜ& t§|¡|°SÑMÐ<LÑMò 	ˆFÜ˜,¨Ó/ˆFØ!ˆFŒNØ‹Lñ	ùs   ‚AA)r]   rk   )r]   r   )r]   rq   )ru   Úobjectr]   Úbool)ry   rF   r]   úmodels.LiveUpdate)r]   Úint)NN)r…   úpraw.Redditr(   ú
str | Noner�   údict[str, Any] | Noner]   r`   ra   )r]   z tuple[str, dict[str, str], None])r�   r   r]   zIterator[models.Submission])rB   rF   r]   r`   )r�   r   r]   úIterator[models.LiveUpdate])rc   rd   re   rf   Ú	STR_FIELDr   rm   ro   rr   rv   rz   r}   r6   rŠ   r�   r‘   r”   r˜   Ú__classcell__©rt   s   @r   ri   ri     s¦   ø„ ñð& €Iàò,ó ð,ð ò1ó ð1ð" ò&ó ð&ó0
Mó<ó&?ð Ø'+ð	.àð.ð ð.ð %ð	.ð
 
õ.õ&ó2óGó04÷$r$   ri   c                  óR   — e Zd ZdZdd„Zd	d„Zd
d„Zdddddœ	 	 	 	 	 	 	 	 	 	 	 dd„Zy)rk   zCProvides a set of contribution functions to a :class:`.LiveThread`.c                ó   — || _         y)a  Initialize a :class:`.LiveThreadContribution` instance.

        :param thread: An instance of :class:`.LiveThread`.

        This instance can be retrieved through ``thread.contrib`` where thread is a
        :class:`.LiveThread` instance. E.g.,

        .. code-block:: python

            thread = reddit.live("ukaeu1ik4sw5")
            thread.contrib.add("### update")

        Nr4   r5   s     r   r6   zLiveThreadContribution.__init__ß  s   € ð ˆ�r$   c                ó°   — t         d   j                  | j                  j                  ¬«      }| j                  j                  j                  |d|i¬«       y)a  Add an update to the live thread.

        :param body: The Markdown formatted content for the update.

        Usage:

        .. code-block:: python

            thread = reddit.live("ydwwxneu7vsa")
            thread.contrib.add("test `LiveThreadContribution.add()`")

        Úlive_add_updater'   ÚbodyrC   Nr9   )r/   r¨   r0   s      r   ÚaddzLiveThreadContribution.addï  sF   € ô Ð(Ñ)×0Ñ0°D·K±K·N±NÐ0ÓCˆØ�‰×Ñ× Ñ  ¨F°D¨>Ð Õ:r$   c                ó¨   — t         d   j                  | j                  j                  ¬«      }| j                  j                  j                  |«       y)zÄClose the live thread permanently (cannot be undone).

        Usage:

        .. code-block:: python

            thread = reddit.live("ukaeu1ik4sw5")
            thread.contrib.close()

        Ú
live_closer'   Nr9   r;   s     r   ÚclosezLiveThreadContribution.closeÿ  rM   r$   N©ÚdescriptionÚnsfwÚ	resourcesÚtitlec          	     ó^  — ||||dœ}|j                  |«       t        d„ |j                  «       D «       «      ryt        | j                  j
                  | j                  j                  «      }|j                  «       D ��	ci c]  \  }}	||	€t        ||«      n|	“Œ }
}}	t        d   j                  | j                  j                  ¬«      }| j                  j
                  j                  ||
j                  «       ¬«        | j                  j                  |
j                  «       Ž  yc c}	}w )a  Update settings of the live thread.

        :param description: The live thread's description (default: ``None``).
        :param nsfw: Indicate whether this thread is not safe for work (default:
            ``None``).
        :param resources: Markdown formatted information that is useful for the live
            thread (default: ``None``).
        :param title: The title of the live thread (default: ``None``).

        Does nothing if no arguments are provided.

        Each setting will maintain its current value if ``None`` is specified.

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

        Usage:

        .. code-block:: python

            thread = reddit.live("xyu8kmjvfrww")

            # update 'title' and 'nsfw'
            updated_thread = thread.contrib.update(title=new_title, nsfw=True)

        If Reddit introduces new settings, you must specify ``None`` for the setting you
        want to maintain:

        .. code-block:: python

            # update 'nsfw' and maintain new setting 'foo'
            thread.contrib.update(nsfw=True, foo=None)

        r­   c              3  ó$   K  — | ]  }|d u –— Œ
 y ­w)Nr   )r   Úvalues     r   r   z0LiveThreadContribution.update.<locals>.<genexpr>?  s   è ø€ Ò< ˆu˜Œ}Ñ<ùs   ‚NÚlive_update_threadr'   rC   )rZ   r   Úvaluesri   r+   r,   r(   ÚitemsÚgetattrr   r*   r:   ÚcopyÚ_reset_attributesÚkeys)r/   r®   r¯   r°   r±   Úother_settingsÚsettingsr+   Úkeyr´   rD   r0   s               r   rZ   zLiveThreadContribution.update  sò   € ðX 'ØØ"Øñ	
ˆð 	�‰˜Ô'ÜÑ<¨(¯/©/Ó*;Ô<Ô<Øä˜DŸK™K×/Ñ/°·±·±Ó@ˆØX`×XfÑXfÓXh×iÉ*È#Èu�¨U¨]”W˜V SÔ)ÀÑEÐiˆÑiäÐ+Ñ,×3Ñ3°t·{±{·~±~Ð3ÓFˆØ�‰×Ñ× Ñ  ¨4¯9©9«;Ð Ô7Ø%ˆ�‰×%Ñ% t§y¡y£{Ò3ùó	 js   ÂD)r^   )r¨   rF   r]   r`   ra   )r®   rž   r¯   zbool | Noner°   rž   r±   rž   r¼   rž   r]   r`   )rc   rd   re   rf   r6   r©   r¬   rZ   r   r$   r   rk   rk   Ü  sc   „ ÙMóó ;ó &ð" #'Ø Ø $Ø ñ:4ð  ð:4ð ð	:4ð
 ð:4ð ð:4ð %ð:4ð 
ô:4r$   rk   c                  ó    — e Zd ZdZdd„Zdd„Zy)rq   zÎProvides a :class:`.LiveThread` stream.

    Usually used via:

    .. code-block:: python

        for live_update in reddit.live("ta535s1hq2je").stream.updates():
            print(live_update.body)

    c                ó   — || _         y)z„Initialize a :class:`.LiveThreadStream` instance.

        :param live_thread: The live thread associated with the stream.

        N)Úlive_thread)r/   rÁ   s     r   r6   zLiveThreadStream.__init__V  s   € ð 'ˆÕr$   c                óB   — t        | j                  j                  fi |¤ŽS )a!  Yield new updates to the live thread as they become available.

        :param skip_existing: Set to ``True`` to only fetch items created after the
            stream (default: ``False``).

        As with :meth:`.LiveThread.updates()`, updates are yielded as
        :class:`.LiveUpdate`.

        Updates are yielded oldest first. Up to 100 historical updates will initially be
        returned.

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

        For example, to retrieve all new updates made to the ``"ta535s1hq2je"`` live
        thread, try:

        .. code-block:: python

            for live_update in reddit.live("ta535s1hq2je").stream.updates():
                print(live_update.body)

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

        .. code-block:: python

            live_thread = reddit.live("ta535s1hq2je")
            for live_update in live_thread.stream.updates(skip_existing=True):
                print(live_update.author)

        )r   rÁ   r˜   )r/   Ústream_optionss     r   r˜   zLiveThreadStream.updates^  s!   € ô@   × 0Ñ 0× 8Ñ 8ÑK¸NÑKÐKr$   N)rÁ   r_   r]   r`   )rÃ   r   r]   r    )rc   rd   re   rf   r6   r˜   r   r$   r   rq   rq   J  s   „ ñ	ó'ô Lr$   rq   c                  ó    ‡ — e Zd ZU dZdZerded<   edd„«       Ze	dd„«       Z
e	dd„«       Z	 	 	 d	 	 	 	 	 	 	 	 	 dˆ fd„Zdˆ fd	„Zdˆ fd
„Zˆ xZS )rx   a.  An individual :class:`.LiveUpdate` object.

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

    =============== ===================================================================
    Attribute       Description
    =============== ===================================================================
    ``author``      The :class:`.Redditor` who made the update.
    ``body``        Body of the update, as Markdown.
    ``body_html``   Body of the update, as HTML.
    ``created_utc`` The time the update was created, as `Unix Time`_.
    ``stricken``    A ``bool`` representing whether or not the update was stricken (see
                    :meth:`.strike`).
    =============== ===================================================================

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

    r(   ri   r—   c                ó   — t        | «      S )a&  Provide an instance of :class:`.LiveUpdateContribution`.

        Usage:

        .. code-block:: python

            thread = reddit.live("ukaeu1ik4sw5")
            update = thread["7827987a-c998-11e4-a0b9-22000b6a88d2"]
            update.contrib  # LiveUpdateContribution instance

        )ÚLiveUpdateContributionrl   s    r   rm   zLiveUpdate.contribš  s   € ô & dÓ+Ð+r$   c                 ó   — y)zThe class's kind.rx   r   rl   s    r   Ú_kindzLiveUpdate._kind©  s   € ð r$   c                ó   — | j                   S )z9:class:`.LiveThread` object the update object belongs to.)r—   rl   s    r   r+   zLiveUpdate.thread®  s   € ð �|‰|Ðr$   c                ó¸   •— |�t         ‰| �  ||d¬«       y|r6|r4|| _        t         ‰| �  |d¬«       t        | j                  |«      | _        yd}t        |«      ‚)a   Initialize a :class:`.LiveUpdate` instance.

        Either ``thread_id`` and ``update_id``, or ``_data`` must be provided.

        :param reddit: An instance of :class:`.Reddit`.
        :param thread_id: A live thread ID, e.g., ``"ukaeu1ik4sw5"``.
        :param update_id: A live update ID, e.g.,
            ``"7827987a-c998-11e4-a0b9-22000b6a88d2"``.

        Usage:

        .. code-block:: python

            update = LiveUpdate(reddit, "ukaeu1ik4sw5", "7827987a-c998-11e4-a0b9-22000b6a88d2")
            update.thread  # LiveThread(id="ukaeu1ik4sw5")
            update.id  # "7827987a-c998-11e4-a0b9-22000b6a88d2"
            update.author  # "umbrae"

        NT)r�   Ú_fetchedr€   z@Either 'thread_id' and 'update_id', or '_data' must be provided.)r„   r6   r(   ri   r,   r—   rƒ   )r/   r…   Ú	thread_idry   r�   r†   rt   s         €r   r6   zLiveUpdate.__init__³  s`   ø€ ð4 Ðô ‰GÑ˜V¨5¸4ÐÕ@Ù™9ØˆDŒGÜ‰GÑ˜V¨4ÐÔ0Ü% d§l¡l°IÓ>ˆD�LàTˆCÜ˜C“.Ð r$   c                ó^   •— |dk(  rt        | j                  |¬«      }t        ‰| �  ||«       y)zObjectify author.Úauthor)rA   N)r   r,   r„   Ú__setattr__)r/   Ú	attributer´   rt   s      €r   rÏ   zLiveUpdate.__setattr__Ú  s*   ø€ à˜Ò Ü˜TŸ\™\°Ô6ˆEÜ‰Ñ˜I uÕ-r$   c                ó  •— t         d   j                  | j                  j                  | j                  ¬«      }| j                  j                  |«      d   }| j                  j                  |j                  «       t        ‰| �%  «        y )NÚ
live_focus)rÌ   ry   r   )
r   r*   r+   r(   r,   r-   r‰   rZ   r„   rŠ   )r/   r0   ru   rt   s      €r   rŠ   zLiveUpdate._fetchà  se   ø€ Ü�|Ñ$×+Ñ+°d·k±k·n±nÐPT×PWÑPWÐ+ÓXˆØ—‘× Ñ  Ó% aÑ(ˆØ�‰×Ñ˜UŸ^™^Ô,Ü‰‰Õr$   )r]   rÆ   )r]   rF   )r]   ri   )NNN)
r…   r�   rÌ   rž   ry   rž   r�   rŸ   r]   r`   )rÐ   rF   r´   r   r]   r`   ra   )rc   rd   re   rf   r¡   r   Ú__annotations__r   rm   ÚpropertyrÈ   r+   r6   rÏ   rŠ   r¢   r£   s   @r   rx   rx   �  s¢   ø… ñð& €IáØÓàò,ó ð,ð òó ðð òó ðð !%Ø $Ø'+ð%!àð%!ð ð%!ð ð	%!ð
 %ð%!ð 
õ%!õN.÷ñ r$   rx   c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)rÆ   zAProvides a set of contribution functions to :class:`.LiveUpdate`.c                ó   — || _         y)aø  Initialize a :class:`.LiveUpdateContribution` instance.

        :param update: An instance of :class:`.LiveUpdate`.

        This instance can be retrieved through ``update.contrib`` where update is a
        :class:`.LiveUpdate` instance. E.g.,

        .. code-block:: python

            thread = reddit.live("ukaeu1ik4sw5")
            update = thread["7827987a-c998-11e4-a0b9-22000b6a88d2"]
            update.contrib  # LiveUpdateContribution instance
            update.contrib.remove()

        N)rZ   )r/   rZ   s     r   r6   zLiveUpdateContribution.__init__ê  s   € ð  ˆ�r$   c                ó  — t         d   j                  | j                  j                  j                  ¬«      }d| j                  j
                  i}| j                  j                  j                  j                  ||¬«       y)zéRemove a live update.

        Usage:

        .. code-block:: python

            thread = reddit.live("ydwwxneu7vsa")
            update = thread["6854605a-efec-11e6-b0c7-0eafac4ff094"]
            update.contrib.remove()

        Úlive_remove_updater'   r(   rC   N©r   r*   rZ   r+   r(   rQ   r,   r:   ©r/   r0   rD   s      r   rS   zLiveUpdateContribution.removeü  sd   € ô Ð+Ñ,×3Ñ3°t·{±{×7IÑ7I×7LÑ7LÐ3ÓMˆØ�d—k‘k×*Ñ*Ð+ˆØ�‰×Ñ×"Ñ"×'Ñ'¨°$Ð'Õ7r$   c                ó  — t         d   j                  | j                  j                  j                  ¬«      }d| j                  j
                  i}| j                  j                  j                  j                  ||¬«       y)a  Strike a content of a live update.

        .. code-block:: python

            thread = reddit.live("xyu8kmjvfrww")
            update = thread["cb5fe532-dbee-11e6-9a91-0e6d74fabcc4"]
            update.contrib.strike()

        To check whether the update is stricken or not, use ``update.stricken``
        attribute.

        .. note::

            Accessing lazy attributes on updates (includes ``update.stricken``) may
            raise :py:class:`AttributeError`. See :class:`.LiveUpdate` for details.

        Úlive_striker'   r(   rC   NrÙ   rÚ   s      r   ÚstrikezLiveUpdateContribution.strike  sc   € ô$ �}Ñ%×,Ñ,°·±×0BÑ0B×0EÑ0EÐ,ÓFˆØ�d—k‘k×*Ñ*Ð+ˆØ�‰×Ñ×"Ñ"×'Ñ'¨°$Ð'Õ7r$   N)rZ   r›   r]   r`   ra   )rc   rd   re   rf   r6   rS   rÝ   r   r$   r   rÆ   rÆ   ç  s   „ ÙKóó$8ô 8r$   rÆ   )#rf   Ú
__future__r   Útypingr   r   r   Ú
praw.constr   Úpraw.models.list.redditorr   Úpraw.models.listing.generatorr	   Úpraw.models.reddit.baser
   Úpraw.models.reddit.mixinsr   r   Úpraw.models.reddit.redditorr   Úpraw.models.utilr   Úpraw.util.cacher   Úcollections.abcr   r   Úprawr   r   ri   rk   rq   rx   rÆ   r   r$   r   ú<module>rê      sŠ   ðÙ #å "ç +Ñ +å Ý 2Ý :Ý .ß AÝ 0Ý -Ý *áß2ãÝ÷l1ñ l1ô^S�˜zô S÷lk4ñ k4÷\4Lñ 4Lônc� ¨jô c÷L98ò 98r$   