Ë
    Fü´j¥Y  ã                  óì   — d Z ddlmZ ddlm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 erddlmZ ddlmZ  G d„ d«      Z G d„ d«      Z G d„ de«      Z G d„ de«      Zy)z*Provide the SubredditFlairTemplates class.é    )Úannotations)Úwriter)ÚStringIO)ÚTYPE_CHECKINGÚAnyÚcast)ÚAPI_PATH)ÚInvalidFlairTemplateID)ÚListingGenerator)Ú
RedditBase)Úcachedproperty)ÚIterator)Úmodelsc                  óÖ   — e Zd ZdZe	 	 dd„«       Ze	 	 dd„«       Z	 d	 	 	 	 	 dd„Zdd„Zddd	dd
œ	 	 	 	 	 	 	 	 	 	 	 dd„Z	dd„Z
dd„Zddddœ	 	 	 	 	 	 	 	 	 dd„Zdddœ	 	 	 	 	 	 	 dd„Zy)ÚSubredditFlairzJProvide a set of functions to interact with a :class:`.Subreddit`'s flair.c                ó,   — t        | j                  «      S )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)

        )ÚSubredditLinkFlairTemplatesÚ	subreddit©Úselfs    ú`/root/workspace/ytshorts/venv/lib/python3.12/site-packages/praw/models/reddit/subreddit/flair.pyÚlink_templateszSubredditFlair.link_templates   s   € ô  +¨4¯>©>Ó:Ð:ó    c                ó,   — t        | j                  «      S )a²  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)

        )ÚSubredditRedditorFlairTemplatesr   r   s    r   Ú	templateszSubredditFlair.templates*   s   € ô  /¨t¯~©~Ó>Ð>r   Nc                óÞ   — t        j                  |d|¬«       |j                  dd«       t        d   j	                  | j
                  ¬«      }t        | j
                  j                  |fi |¤ŽS )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)

        Úparams)Ú	argumentsÚkeyÚnameÚlimitNÚ	flairlist©r   )r   Ú_safely_add_argumentsÚ
setdefaultr	   Úformatr   r   Ú_reddit)r   ÚredditorÚgenerator_kwargsÚurls       r   Ú__call__zSubredditFlair.__call__<   sa   € ô* 	×(Ñ(Ð3CÈÐX`ÕaØ×#Ñ# G¨TÔ2Ü�{Ñ#×*Ñ*°T·^±^Ð*ÓDˆÜ §¡× 6Ñ 6¸ÑPÐ?OÑPÐPr   c                ó   — || _         y)z|Initialize a :class:`.SubredditFlair` instance.

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

        Nr$   ©r   r   s     r   Ú__init__zSubredditFlair.__init__V   s   € ð #ˆ�r   ÚleftFÚright)Úlink_positionÚlink_self_assignÚpositionÚself_assignc               óì   — t        |«      |xs d||xs d|dœ}|j                  |«       t        d   j                  | j                  ¬«      }| j                  j
                  j                  ||¬«       y)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.

        r1   Ú )Úflair_enabledÚflair_positionÚflair_self_assign_enabledÚlink_flair_positionÚlink_flair_self_assign_enabledÚflairconfigr$   ©ÚdataN)ÚboolÚupdater	   r'   r   r(   Úpost)r   r2   r3   r4   r5   Úsettingsr?   r+   s           r   Ú	configurezSubredditFlair.configure^   so   € ô: " (›^Ø&Ò1¨'Ø)4Ø#0Ò#6°BØ.>ñ
ˆð 	�‰�HÔÜ�}Ñ%×,Ñ,°t·~±~Ð,ÓFˆØ�‰×Ñ×#Ñ# C¨dÐ#Õ3r   c                ó®   — t         d   j                  | j                  ¬«      }| j                  j                  j	                  |dt        |«      i¬«       y)zøDelete 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!   r>   N)r	   r'   r   r(   rB   Ústr)r   r)   r+   s      r   ÚdeletezSubredditFlair.delete…   sF   € ô �}Ñ%×,Ñ,°t·~±~Ð,ÓFˆØ�‰×Ñ×#Ñ# C¨v´s¸8³}Ð.EÐ#ÕFr   c                ó<   — | j                  d„  | «       D «       «      S )z£Delete all :class:`.Redditor` flair in the :class:`.Subreddit`.

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

        c              3  ó:   K  — | ]  }t        d |«      d   –— Œ y­w)z dict[str, str | models.Redditor]ÚuserN)r   )Ú.0Úxs     r   ú	<genexpr>z,SubredditFlair.delete_all.<locals>.<genexpr>™   s   è ø€ Ò_ÐSTœ4Ð BÀAÓFÀvÕNÑ_ùs   ‚)rA   r   s    r   Ú
delete_allzSubredditFlair.delete_all“   s   € ð �{‰{Ñ_ÑX\ÓX^Ô_Ó_Ð_r   r7   )Ú	css_classÚflair_template_idÚtextc               ó6  — |r|�d}t        |«      ‚t        |«      |dœ}|�)||d<   t        d   j                  | j                  ¬«      }n(||d<   t        d   j                  | j                  ¬«      }| j                  j
                  j                  ||¬	«       y)
añ  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!   rR   rQ   Úselect_flairr$   rP   Úflairr>   )Ú	TypeErrorrG   r	   r'   r   r(   rB   )r   r)   rP   rQ   rR   Úmsgr?   r+   s           r   ÚsetzSubredditFlair.set›   s›   € ñ@ Ð*Ð6ØaˆCÜ˜C“.Ð Ü˜H›¨tÑ4ˆØÐ(Ø(9ˆDÐ$Ñ%Ü˜>Ñ*×1Ñ1¸D¿N¹NÐ1ÓK‰Cà )ˆD�ÑÜ˜7Ñ#×*Ñ*°T·^±^Ð*ÓDˆCØ�‰×Ñ×#Ñ# C¨dÐ#Õ3r   )rP   rR   c          	     óz  — t        «       }|D ]‚  }t        |t        «      rJt        |«      j	                  t        |d   «      |j                  d|«      |j                  d|«      g«       Œ]t        |«      j	                  t        |«      ||g«       Œ„ |j                  «       j                  «       }|j                  «        g }t        d   j                  | j                  ¬«      }|rTddj                  |dd	 «      i}	|j                  | j                  j                  j!                  ||	¬
«      «       |d	d }|rŒT|S )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")

        rK   Ú
flair_textÚflair_css_classÚflaircsvr$   Ú	flair_csvú
Néd   r>   )r   Ú
isinstanceÚdictr   ÚwriterowrG   ÚgetÚgetvalueÚ
splitlinesÚcloser	   r'   r   ÚjoinÚextendr(   rB   )
r   Ú
flair_listrP   rR   Ú
temp_linesÚitemÚlinesÚresponser+   r?   s
             r   rA   zSubredditFlair.updateÇ   s'  € ôD “Zˆ
Øò 	JˆDÜ˜$¤Ô%Ü�zÓ"×+Ñ+Ü˜˜V™Ó%Ø—H‘H˜\¨4Ó0Ø—H‘HÐ.°	Ó:ð-õ ô �zÓ"×+Ñ+¬S°«Y¸¸iÐ,HÕIð	Jð ×#Ñ#Ó%×0Ñ0Ó2ˆØ×ÑÔØˆÜ�zÑ"×)Ñ)°D·N±NÐ)ÓCˆÙØ §¡¨5°°#¨;Ó!7Ð8ˆDØ�O‰O˜DŸN™N×2Ñ2×7Ñ7¸À$Ð7ÓGÔHØ˜#˜$�KˆEò ð ˆr   )Úreturnr   )rn   r   )N)r)   zmodels.Redditor | str | Noner*   r   rn   zIterator[models.Redditor]©r   zmodels.Subredditrn   ÚNone)r2   rG   r3   r@   r4   rG   r5   r@   rC   r   rn   rp   )r)   úmodels.Redditor | strrn   rp   )rn   ú,list[dict[str, str | bool | dict[str, str]]])
r)   rq   rP   rG   rQ   ú
str | NonerR   rG   rn   rp   )ri   zBIterator[str | models.Redditor | dict[str, str | models.Redditor]]rP   rG   rR   rG   rn   rr   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r,   r/   rD   rH   rO   rX   rA   © r   r   r   r      s:  „ ÙTàð;à	$ò;ó ð;ð" ð?à	(ò?ó ð?ð& 26ðQà.ðQð  ðQð 
#ó	Qó4#ð $Ø!&ØØ!ñ%4ð ð%4ð ð	%4ð
 ð%4ð ð%4ð ð%4ð 
ó%4óNGó`ð Ø(,Øñ*4à'ð*4ð ð	*4ð
 &ð*4ð ð*4ð 
ó*4ð` Øñ5àVð5ð ð	5ð
 ð5ð 
6ô5r   r   c            
      óà   — e Zd ZdZedd„«       Zdd„Zdd„Zdddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	„Zdd
œdd„Z	dd
œdd„Z
dd„Zddddddddddœ		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zy)ÚSubredditFlairTemplateszKProvide functions to interact with a :class:`.Subreddit`'s flair templates.c                ó   — | rdS dS )zKReturn ``"LINK_FLAIR"`` or ``"USER_FLAIR"`` depending on ``is_link`` value.Ú
LINK_FLAIRÚ
USER_FLAIRrx   ©Úis_links    r   Ú
flair_typez"SubredditFlairTemplates.flair_type  s   € ñ  'ˆ|Ð8¨LÐ8r   c                ó   — || _         y)az  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$   r.   s     r   r/   z SubredditFlairTemplates.__init__  s   € ð #ˆ�r   c                ó   — t         ‚)z*Abstract method to return flair templates.)ÚNotImplementedErrorr   s    r   Ú__iter__z SubredditFlairTemplates.__iter__  s   € ä!Ð!r   Nr7   F)Úallowable_contentÚbackground_colorrP   r   Ú
max_emojisÚmod_onlyÚ
text_colorÚtext_editablec       	        óô   — t         d   j                  | j                  ¬«      }
|||| j                  |¬«      |t	        |«      ||t	        |	«      dœ	}| j                  j
                  j                  |
|¬«       y )NÚflairtemplate_v2r$   r~   )	r…   r†   rP   r€   r‡   rˆ   rR   r‰   rŠ   r>   )r	   r'   r   r€   r@   r(   rB   )r   r…   r†   rP   r   r‡   rˆ   rR   r‰   rŠ   r+   r?   s               r   Ú_addzSubredditFlairTemplates._add  sv   € ô Ð)Ñ*×1Ñ1¸D¿N¹NÐ1ÓKˆà!2Ø 0Ø"ØŸ/™/°'˜/Ó:Ø$Ü˜X›ØØ$Ü! -Ó0ñ

ˆð 	�‰×Ñ×#Ñ# C¨dÐ#Õ3r   r~   c               ó¼   — t         d   j                  | j                  ¬«      }| j                  j                  j	                  |d| j                  |¬«      i¬«       y )NÚflairtemplateclearr$   r€   r~   r>   )r	   r'   r   r(   rB   r€   )r   r   r+   s      r   Ú_clearzSubredditFlairTemplates._clear4  sM   € ÜÐ+Ñ,×3Ñ3¸d¿n¹nÐ3ÓMˆØ�‰×Ñ×#Ñ# C¨|¸T¿_¹_ÐU\¸_Ó=]Ð.^Ð#Õ_r   c               óè   — t         d   j                  | j                  ¬«      }| j                  j                  j	                  ||| j                  |¬«      | j                  j                  dœ¬«       y )NÚflairtemplatereorderr$   r~   )r€   r   )Újsonr   )r	   r'   r   r(   Úpatchr€   Údisplay_name)r   ri   r   r+   s       r   Ú_reorderz SubredditFlairTemplates._reorder8  sb   € ÜÐ-Ñ.×5Ñ5ÀÇÁÐ5ÓOˆØ�‰×Ñ×$Ñ$ØØà"Ÿo™o°g˜oÓ>Ø!Ÿ^™^×8Ñ8ñð 	%õ 	
r   c                óœ   — t         d   j                  | j                  ¬«      }| j                  j                  j	                  |d|i¬«       y)a9  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$   rQ   r>   N©r	   r'   r   r(   rB   )r   Útemplate_idr+   s      r   rH   zSubredditFlairTemplates.deleteC  sD   € ô Ð,Ñ-×4Ñ4¸t¿~¹~Ð4ÓNˆØ�‰×Ñ×#Ñ# CÐ/BÀKÐ.PÐ#ÕQr   T)	r…   r†   rP   Úfetchr‡   rˆ   rR   r‰   rŠ   c       	   
     óš  — t         d   j                  | j                  ¬«      }||||||||	|
dœ	}|rnt        | «      D �cg c]  }|d   |k(  sŒ|‘Œ }}t	        |«      dk7  rt        |«      ‚|d   }|j                  «       D ]  \  }}|j                  |«      �Œ|||<   Œ | j                  j                  j                  ||¬«       yc c}w )	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†   rP   rQ   r‡   rˆ   rR   r‰   rŠ   Úidé   r   Nr>   )
r	   r'   r   ÚiterÚlenr
   Úitemsrc   r(   rB   )r   rš   r…   r†   rP   r›   r‡   rˆ   rR   r‰   rŠ   r+   r?   ÚtemplateÚexisting_data_Úexisting_datar    Úvalues                     r   rA   zSubredditFlairTemplates.updateQ  sæ   € ôj Ð)Ñ*×1Ñ1¸D¿N¹NÐ1ÓKˆà!2Ø 0Ø"Ø!,Ø$Ø ØØ$Ø*ñ

ˆñ Ü7;¸D³zÖc¨8ÀXÈdÁ^ÐWbÓEbšhÐcˆNÐcÜ�>Ó" aÒ'Ü,¨[Ó9Ð9Ø*¨1Ñ-ˆMØ+×1Ñ1Ó3ò &‘
��UØ—8‘8˜C“=Ñ(Ø %�D˜’Ið&ð 	�‰×Ñ×#Ñ# C¨dÐ#Õ3ùò ds   ¿CÁC)r   úbool | Nonern   rG   ro   ©rn   z<Iterator[dict[str, str | int | bool | list[dict[str, str]]]])r…   rs   r†   rs   rP   rG   r   r¦   r‡   ú
int | Nonerˆ   r¦   rR   rG   r‰   rs   rŠ   r@   rn   rp   )r   r¦   rn   rp   )ri   Úlistr   r¦   rn   rp   )rš   rG   rn   rp   )rš   rG   r…   rs   r†   rs   rP   rs   r›   r@   r‡   r¨   rˆ   r¦   rR   rs   r‰   rs   rŠ   r¦   rn   rp   )rt   ru   rv   rw   Ústaticmethodr€   r/   r„   r�   r�   r–   rH   rA   rx   r   r   rz   rz   ÿ   s[  „ ÙUàò9ó ð9ó#ó"ð )-Ø'+ØØ#Ø!%Ø $à!%Ø#ñ4ð &ð4ð %ð	4ð
 ð4ð ð4ð ð4ð ð4ð ð4ð ð4ð ð4ð 
ó4ð6 04õ `ð DHõ 	
óRð$ )-Ø'+Ø $ØØ!%Ø $ØØ!%Ø%)ñI4àðI4ð &ð	I4ð
 %ðI4ð ðI4ð ðI4ð ðI4ð ðI4ð ðI4ð ðI4ð #ðI4ð 
ôI4r   rz   c                  ót   — e Zd ZdZ	 	 dd„Zddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zdd„Zdd	„Z	 	 dd
„Zy)r   z8Provide functions to interact with link flair templates.c              #  ó°   K  — t         d   j                  | j                  ¬«      }| j                  j                  j	                  |«      E d{  –—†  y7 Œ­w)zäIterate 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$   N)r	   r'   r   r(   rc   ©r   r+   s     r   r„   z$SubredditLinkFlairTemplates.__iter__   sB   è ø€ ô �|Ñ$×+Ñ+°d·n±nÐ+ÓEˆØ—>‘>×)Ñ)×-Ñ-¨cÓ2×2Ò2ús   ‚AAÁAÁANr7   F©r…   r†   rP   r‡   rˆ   r‰   rŠ   c               ó8   — | j                  |||d|||||¬«	       y)að  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†   rP   r   r‡   rˆ   rR   r‰   rŠ   N©r�   ©	r   rR   r…   r†   rP   r‡   rˆ   r‰   rŠ   s	            r   ÚaddzSubredditLinkFlairTemplates.add°  s1   € ðR 	�	‰	Ø/Ø-ØØØ!ØØØ!Ø'ð 	õ 
	
r   c                ó(   — | j                  d¬«       y)z¶Remove 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   Úclearz!SubredditLinkFlairTemplates.clearå  s   € ð 	�‰˜DˆÕ!r   c                ó*   — | j                  |d¬«       y)a‡  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   ri   s     r   Úreorderz#SubredditLinkFlairTemplates.reorderñ  s   € ð 	�‰�j¨$ˆÕ/r   c              #  ó¾   K  — t         d   j                  | j                  ¬«      }| j                  j                  j	                  |ddi¬«      d   E d{  –—†  y7 Œ­w)zùIterate 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_newlinkTr>   ÚchoicesNr™   r®   s     r   Úuser_selectablez+SubredditLinkFlairTemplates.user_selectable  sQ   è ø€ ô �Ñ'×.Ñ.¸¿¹Ð.ÓHˆØ—>‘>×)Ñ)×.Ñ.¨s¸,ÈÐ9MÐ.ÓNÈyÑY×YÒYús   ‚AAÁAÁAr§   ©rR   rG   r…   rs   r†   rs   rP   rG   r‡   r¨   rˆ   r¦   r‰   rs   rŠ   r@   rn   rp   ©rn   rp   ©ri   z	list[str]rn   rp   )rn   zIterator[dict[str, str | bool]])	rt   ru   rv   rw   r„   r´   r·   r»   rÀ   rx   r   r   r   r   �  s    „ ÙBð3à	Eó3ð( )-Ø'+ØØ!%Ø $Ø!%Ø#ñ3
àð3
ð &ð	3
ð
 %ð3
ð ð3
ð ð3
ð ð3
ð ð3
ð ð3
ð 
ó3
ój
"ó0ð Zà	(ôZr   r   c                  óh   — e Zd ZdZ	 	 d
d„Zddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zdd„Zdd	„Zy)r   zFProvide functions to interact with :class:`.Redditor` flair templates.c              #  óø   K  — t         d   j                  | j                  ¬«      }d| j                  j                  j                  i}| j                  j                  j                  ||¬«      E d{  –—†  y7 Œ­w)zÐIterate through the user flair templates.

        For example:

        .. code-block:: python

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

        Ú
user_flairr$   Úunique)r   N)r	   r'   r   r(   Ú_next_uniquerc   )r   r+   r   s      r   r„   z(SubredditRedditorFlairTemplates.__iter__  sa   è ø€ ô �|Ñ$×+Ñ+°d·n±nÐ+ÓEˆØ(0°$·.±.×2HÑ2H×2UÑ2UÐ'VˆØ—>‘>×)Ñ)×-Ñ-¨c¸&Ð-ÓA×AÒAús   ‚A0A:Á2A8Á3A:Nr7   Fr¯   c               ó8   — | j                  |||d|||||¬«	       y)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´   z#SubredditRedditorFlairTemplates.add&  s1   € ðR 	�	‰	Ø/Ø-ØØØ!ØØØ!Ø'ð 	õ 
	
r   c                ó(   — | j                  d¬«       y)z¿Remove 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·   z%SubredditRedditorFlairTemplates.clear[  s   € ð 	�‰˜EˆÕ"r   c                ó*   — | j                  |d¬«       y)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»   z'SubredditRedditorFlairTemplates.reorderg  s   € ð 	�‰�j¨%ˆÕ0r   r§   rÁ   rÂ   rÃ   )rt   ru   rv   rw   r„   r´   r·   r»   rx   r   r   r   r     s“   „ ÙPðBà	EóBð* )-Ø'+ØØ!%Ø $Ø!%Ø#ñ3
àð3
ð &ð	3
ð
 %ð3
ð ð3
ð ð3
ð ð3
ð ð3
ð ð3
ð 
ó3
ój
#ô1r   r   N)rw   Ú
__future__r   Úcsvr   Úior   Útypingr   r   r   Ú
praw.constr	   Úpraw.exceptionsr
   Úpraw.models.listing.generatorr   Úpraw.models.reddit.baser   Ú	praw.utilr   Úcollections.abcr   Úprawr   r   rz   r   r   rx   r   r   ú<module>r×      sj   ðÙ 0å "å Ý ß +Ñ +å Ý 2Ý :Ý .Ý $áÝ(å÷gñ g÷T[4ñ [4ô|rZÐ"9ô rZôjd1Ð&=õ d1r   