
    cjhXn                        d Z ddlmZ ddlmZmZmZmZmZm	Z	 ddl
mZmZmZmZ dZ G d de      Z	 	 	 	 dd	Z e	d
d      Z e        G d de             Z e	dd      Zd Ze G d d             Zy)ae  
The MIT License (MIT)

Copyright (c) 2015-2021 Rapptz
Copyright (c) 2021-present Pycord Development

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
    )annotations)TYPE_CHECKINGAnyCallableClassVarIteratorTypeVar   )	BaseFlagsalias_flag_valuefill_with_flags
flag_value)PermissionsPermissionOverwritec                      e Zd ZU ded<   y)permission_aliasstraliasN)__name__
__module____qualname____annotations__     F/var/www/html/venv/lib/python3.12/site-packages/discord/permissions.pyr   r   (   s    Jr   r   c                     d fd}|S )Nc                ,    t        |       }|_        |S N)r   r   )funcretr   s     r   	decoratorz(make_permission_alias.<locals>.decorator/   s    t$	
r   )r   zCallable[[Any], int]returnr   r   )r   r!   s   ` r   make_permission_aliasr#   ,   s    
 r   Pr   )boundc                     e Zd ZU dZdZdSdTdZdUdZdUdZdUdZdUdZ	eZ
ded	<   eZded
<   eZded<   e	Zded<   edVd       ZedVd       ZedVd       ZedVd       ZedVd       ZedVd       ZedVd       ZedVd       ZedVd       ZedVd       ZdWdZdXdZedYd       ZedYd       ZedYd       ZedYd       Z edYd       Z!edYd       Z"edYd       Z#edYd        Z$edYd!       Z%edYd"       Z&edYd#       Z' e(d$      dYd%       Z)edYd&       Z*edYd'       Z+edYd(       Z,edYd)       Z-edYd*       Z.edYd+       Z/edYd,       Z0edYd-       Z1 e(d.      dYd/       Z2edYd0       Z3edYd1       Z4edYd2       Z5edYd3       Z6edYd4       Z7edYd5       Z8edYd6       Z9edYd7       Z:edYd8       Z;edYd9       Z< e(d:      dYd;       Z=edYd<       Z>edYd=       Z? e(d>      dYd?       Z@edYd@       ZA e(dA      dYdB       ZBedYdC       ZCedYdD       ZDedYdE       ZEedYdF       ZFedYdG       ZGedYdH       ZH e(dI      dYdJ       ZIedYdK       ZJedYdL       ZKedYdM       ZLedYdN       ZMedYdO       ZNedYdP       ZOedYdQ       ZPyR)Zr   a  Wraps up the Discord permission value.

    The properties provided are two way. You can set and retrieve individual
    bits using the properties as if they were regular bools. This allows
    you to edit permissions.

    .. versionchanged:: 1.3
        You can now use keyword arguments to initialize :class:`Permissions`
        similar to :meth:`update`.

    .. container:: operations

        .. describe:: x == y

            Checks if two permissions are equal.
        .. describe:: x != y

            Checks if two permissions are not equal.
        .. describe:: x <= y

            Checks if a permission is a subset of another permission.
        .. describe:: x >= y

            Checks if a permission is a superset of another permission.
        .. describe:: x < y

             Checks if a permission is a strict subset of another permission.
        .. describe:: x > y

        .. describe:: x + y

            Adds two permissions together. Equivalent to ``x | y``.
        .. describe:: x - y

            Subtracts two permissions from each other.
        .. describe:: x | y

            Returns the union of two permissions. Equivalent to ``x + y``.
        .. describe:: x & y

            Returns the intersection of two permissions.
        .. describe:: ~x

            Returns the inverse of a permission.

             Checks if a permission is a strict superset of another permission.
        .. describe:: hash(x)

               Return the permission's hash.
        .. describe:: iter(x)

               Returns an iterator of ``(perm, value)`` pairs. This allows it
               to be, for example, constructed as a dict or a list of pairs.
               Note that aliases are not shown.

    Attributes
    ----------
    value: :class:`int`
        The raw value. This value is a bit array field of a 53-bit integer
        representing the currently available permissions. You should query
        permissions via the properties rather than using this raw value.
    r   c                    t        |t              s#t        d|j                  j                   d      || _        |j                         D ].  \  }}|| j                  vrt        |d      t        | ||       0 y )Nz!Expected int parameter, received z	 instead.z  is not a valid permission name.)	
isinstanceint	TypeError	__class__r   valueitemsVALID_FLAGSsetattr)selfpermissionskwargskeyr,   s        r   __init__zPermissions.__init__}   s    +s+))2239> 
 !
 ,,. 	&JC$***3')I JKKD#u%	&r   c                    t        |t              r&| j                  |j                  z  | j                  k(  S t        d| j                  j
                   d|j                  j
                         )zDReturns ``True`` if self has the same or fewer permissions as other.cannot compare  with r(   r   r,   r*   r+   r   r0   others     r   	is_subsetzPermissions.is_subset   a    e[)JJ,;;!$.."9"9!: ;OO,,-/ r   c                    t        |t              r&| j                  |j                  z  | j                  k(  S t        d| j                  j
                   d|j                  j
                         )zCReturns ``True`` if self has the same or more permissions as other.r6   r7   r8   r9   s     r   is_supersetzPermissions.is_superset   r<   r   c                2    | j                  |      xr | |k7  S )zRReturns ``True`` if the permissions on other are a strict subset of those on self.)r;   r9   s     r   is_strict_subsetzPermissions.is_strict_subset   s    ~~e$66r   c                2    | j                  |      xr | |k7  S )zTReturns ``True`` if the permissions on other are a strict superset of those on self.)r>   r9   s     r   is_strict_supersetzPermissions.is_strict_superset   s    &845=8r   zCallable[[Permissions], bool]__le____ge____lt____gt__c                     | d      S )zlA factory method that creates a :class:`Permissions` with all
        permissions set to ``False``.
        r   r   clss    r   nonezPermissions.none   s    
 1vr   c                     | d      S )zkA factory method that creates a :class:`Permissions` with all
        permissions set to ``True``.
        l    r   rH   s    r   allzPermissions.all       
 FGGr   c                     | d      S )az  A :class:`Permissions` with all channel-specific permissions set to
        ``True`` and the guild-specific ones set to ``False``. The guild-specific
        permissions are currently:

        - :attr:`manage_emojis`
        - :attr:`view_audit_log`
        - :attr:`view_guild_insights`
        - :attr:`manage_guild`
        - :attr:`change_nickname`
        - :attr:`manage_nicknames`
        - :attr:`kick_members`
        - :attr:`ban_members`
        - :attr:`administrator`

        .. versionchanged:: 1.7
           Added :attr:`stream`, :attr:`priority_speaker` and :attr:`use_slash_commands` permissions.

        .. versionchanged:: 2.0
           Added :attr:`create_public_threads`, :attr:`create_private_threads`, :attr:`manage_threads`,
           :attr:`use_external_stickers`, :attr:`send_messages_in_threads` and
           :attr:`request_to_speak` permissions.
        l   Qgr   rH   s    r   all_channelzPermissions.all_channel   s    0 <==r   c                     | d      S )a  A factory method that creates a :class:`Permissions` with all
        "General" permissions from the official Discord UI set to ``True``.

        .. versionchanged:: 1.7
           Permission :attr:`read_messages` is now included in the general permissions, but
           permissions :attr:`administrator`, :attr:`create_instant_invite`, :attr:`kick_members`,
           :attr:`ban_members`, :attr:`change_nickname` and :attr:`manage_nicknames` are
           no longer part of the general permissions.
        ipr   rH   s    r   generalzPermissions.general   s     566r   c                     | d      S )zA factory method that creates a :class:`Permissions` with all
        "Membership" permissions from the official Discord UI set to ``True``.

        .. versionadded:: 1.7
        i  r   rH   s    r   
membershipzPermissions.membership   s     566r   c                     | d      S )a#  A factory method that creates a :class:`Permissions` with all
        "Text" permissions from the official Discord UI set to ``True``.

        .. versionchanged:: 1.7
           Permission :attr:`read_messages` is no longer part of the text permissions.
           Added :attr:`use_slash_commands` permission.

        .. versionchanged:: 2.0
           Added :attr:`create_public_threads`, :attr:`create_private_threads`, :attr:`manage_threads`,
           :attr:`send_messages_in_threads` and :attr:`use_external_stickers` permissions.
        l   @x r   rH   s    r   textzPermissions.text   s     <==r   c                     | d      S )zA factory method that creates a :class:`Permissions` with all
        "Voice" permissions from the official Discord UI set to ``True``.
        l      r   rH   s    r   voicezPermissions.voice   rM   r   c                     | d      S )zA factory method that creates a :class:`Permissions` with all
        "Stage Channel" permissions from the official Discord UI set to ``True``.

        .. versionadded:: 1.7
                r   rH   s    r   stagezPermissions.stage   s     7|r   c                     | d      S )zA factory method that creates a :class:`Permissions` with all
        "Stage Moderator" permissions from the official Discord UI set to ``True``.

        .. versionadded:: 1.7
        l      r   rH   s    r   stage_moderatorzPermissions.stage_moderator  s     677r   c                     | d      S )zA factory method that creates a :class:`Permissions` with all
        "Advanced" permissions from the official Discord UI set to ``True``.

        .. versionadded:: 1.7
           r   rH   s    r   advancedzPermissions.advanced  s     6{r   c                l    |j                         D ]!  \  }}|| j                  v st        | ||       # y)aw  Bulk updates this permission object.

        Allows you to set multiple attributes by using keyword
        arguments. The names must be equivalent to the properties
        listed. Extraneous key/value pairs will be silently ignored.

        Parameters
        ------------
        \*\*kwargs
            A list of key/value pairs to bulk update permissions with.
        N)r-   r.   r/   r0   r2   r3   r,   s       r   updatezPermissions.update  s7     !,,. 	*JCd&&&c5)	*r   c                4    | j                   | z  |z  | _         y r   )r,   )r0   allowdenys      r   handle_overwritezPermissions.handle_overwrite*  s     jjD5(E1
r   c                     y)zG:class:`bool`: Returns ``True`` if the user can create instant invites.r
   r   r0   s    r   create_instant_invitez!Permissions.create_instant_invite9       r   c                     y)zJ:class:`bool`: Returns ``True`` if the user can kick users from the guild.   r   rh   s    r   kick_memberszPermissions.kick_members>  rj   r   c                     y)zG:class:`bool`: Returns ``True`` if a user can ban users from the guild.   r   rh   s    r   ban_memberszPermissions.ban_membersC  rj   r   c                     y)z:class:`bool`: Returns ``True`` if a user is an administrator. This role overrides all other permissions.

        This also bypasses all channel-specific overrides.
        r^   r   rh   s    r   administratorzPermissions.administratorH       r   c                     y)z:class:`bool`: Returns ``True`` if a user can edit, delete, or create channels in the guild.

        This also corresponds to the "Manage Channel" channel-specific override.
           r   rh   s    r   manage_channelszPermissions.manage_channelsP  rs   r   c                     y)zD:class:`bool`: Returns ``True`` if a user can edit guild properties.    r   rh   s    r   manage_guildzPermissions.manage_guildX  rj   r   c                     y)zH:class:`bool`: Returns ``True`` if a user can add reactions to messages.@   r   rh   s    r   add_reactionszPermissions.add_reactions]  rj   r   c                     y)zI:class:`bool`: Returns ``True`` if a user can view the guild's audit log.   r   rh   s    r   view_audit_logzPermissions.view_audit_logb  rj   r   c                     y)zQ:class:`bool`: Returns ``True`` if a user can be more easily heard while talking.   r   rh   s    r   priority_speakerzPermissions.priority_speakerg  rj   r   c                     y)zH:class:`bool`: Returns ``True`` if a user can stream in a voice channel.i   r   rh   s    r   streamzPermissions.streaml  rj   r   c                     y)zL:class:`bool`: Returns ``True`` if a user can view all or specific channels.   r   rh   s    r   view_channelzPermissions.view_channelq       r   r   c                     y)zY:class:`bool`: An alias for :attr:`view_channel`.

        .. versionadded:: 1.3
        r   r   rh   s    r   read_messageszPermissions.read_messagesv       r   c                     y)z_:class:`bool`: Returns ``True`` if a user can send messages from all or specific text channels.i   r   rh   s    r   send_messageszPermissions.send_messages~  r   r   c                     y)zc:class:`bool`: Returns ``True`` if a user can send TTS messages from all or specific text channels.i   r   rh   s    r   send_tts_messageszPermissions.send_tts_messages  r   r   c                     y)z:class:`bool`: Returns ``True`` if a user can delete or pin messages in a text channel.

        .. note::

            Note that there are currently no ways to edit other people's messages.
        i    r   rh   s    r   manage_messageszPermissions.manage_messages  s     r   c                     y)z_:class:`bool`: Returns ``True`` if a user's messages will automatically be embedded by Discord.i @  r   rh   s    r   embed_linkszPermissions.embed_links  r   r   c                     y)zK:class:`bool`: Returns ``True`` if a user can send files in their messages.i   r   rh   s    r   attach_fileszPermissions.attach_files  r   r   c                     y)zV:class:`bool`: Returns ``True`` if a user can read a text channel's previous messages.i   r   rh   s    r   read_message_historyz Permissions.read_message_history  r   r   c                     y)zi:class:`bool`: Returns ``True`` if a user's @everyone or @here will mention everyone in the text channel.i   r   rh   s    r   mention_everyonezPermissions.mention_everyone  r   r   c                     y)zK:class:`bool`: Returns ``True`` if a user can use emojis from other guilds.   r   rh   s    r   external_emojiszPermissions.external_emojis  r   r   r   c                     y)z\:class:`bool`: An alias for :attr:`external_emojis`.

        .. versionadded:: 1.3
        r   r   rh   s    r   use_external_emojiszPermissions.use_external_emojis  r   r   c                     y)zp:class:`bool`: Returns ``True`` if a user can view the guild's insights.

        .. versionadded:: 1.3
        i   r   rh   s    r   view_guild_insightszPermissions.view_guild_insights  r   r   c                     y)zI:class:`bool`: Returns ``True`` if a user can connect to a voice channel.i   r   rh   s    r   connectzPermissions.connect  r   r   c                     y)zG:class:`bool`: Returns ``True`` if a user can speak in a voice channel.i    r   rh   s    r   speakzPermissions.speak  r   r   c                     y)z?:class:`bool`: Returns ``True`` if a user can mute other users.i  @ r   rh   s    r   mute_memberszPermissions.mute_members  r   r   c                     y)zA:class:`bool`: Returns ``True`` if a user can deafen other users.i   r   rh   s    r   deafen_memberszPermissions.deafen_members  r   r   c                     y)zV:class:`bool`: Returns ``True`` if a user can move users between other voice channels.i   r   rh   s    r   move_memberszPermissions.move_members  r   r   c                     y)zU:class:`bool`: Returns ``True`` if a user can use voice activation in voice channels.i   r   rh   s    r   use_voice_activationz Permissions.use_voice_activation  r   r   c                     y)zQ:class:`bool`: Returns ``True`` if a user can change their nickname in the guild.i   r   rh   s    r   change_nicknamezPermissions.change_nickname  r   r   c                     y)zX:class:`bool`: Returns ``True`` if a user can change other user's nickname in the guild.i   r   rh   s    r   manage_nicknameszPermissions.manage_nicknames  r   r   c                     y)z:class:`bool`: Returns ``True`` if a user can create or edit roles less than their role's position.

        This also corresponds to the "Manage Permissions" channel-specific override.
           r   rh   s    r   manage_roleszPermissions.manage_roles  r   r   r   c                     y)zY:class:`bool`: An alias for :attr:`manage_roles`.

        .. versionadded:: 1.3
        r   r   rh   s    r   manage_permissionszPermissions.manage_permissions  r   r   c                     y)zO:class:`bool`: Returns ``True`` if a user can create, edit, or delete webhooks.i    r   rh   s    r   manage_webhookszPermissions.manage_webhooks  r   r   c                     y)zM:class:`bool`: Returns ``True`` if a user can create, edit, or delete emojis.   @r   rh   s    r   manage_emojiszPermissions.manage_emojis  r   r   r   c                     y)zZ:class:`bool`: An alias for :attr:`manage_emojis`.

        .. versionadded:: 2.0
        r   r   rh   s    r   manage_emojis_and_stickersz&Permissions.manage_emojis_and_stickers  r   r   c                     y)zi:class:`bool`: Returns ``True`` if a user can use slash commands.

        .. versionadded:: 1.7
                r   rh   s    r   use_slash_commandszPermissions.use_slash_commands  r   r   r   c                     y)z_:class:`bool`: An alias for :attr:`use_slash_commands`.

        .. versionadded:: 2.0
        r   r   rh   s    r   use_application_commandsz$Permissions.use_application_commands  r   r   c                     y)zz:class:`bool`: Returns ``True`` if a user can request to speak in a stage channel.

        .. versionadded:: 1.7
        rY   r   rh   s    r   request_to_speakzPermissions.request_to_speak  r   r   c                     y)zj:class:`bool`: Returns ``True`` if a user can manage guild events.

        .. versionadded:: 2.0
        l        r   rh   s    r   manage_eventszPermissions.manage_events  r   r   c                     y)ze:class:`bool`: Returns ``True`` if a user can manage threads.

        .. versionadded:: 2.0
        l        r   rh   s    r   manage_threadszPermissions.manage_threads%  r   r   c                     y)zl:class:`bool`: Returns ``True`` if a user can create public threads.

        .. versionadded:: 2.0
        l         r   rh   s    r   create_public_threadsz!Permissions.create_public_threads-  r   r   c                     y)zm:class:`bool`: Returns ``True`` if a user can create private threads.

        .. versionadded:: 2.0
        l       @ r   rh   s    r   create_private_threadsz"Permissions.create_private_threads5  r   r   c                     y)zu:class:`bool`: Returns ``True`` if a user can use stickers from other guilds.

        .. versionadded:: 2.0
                r   rh   s    r   external_stickerszPermissions.external_stickers=  r   r   r   c                     y)z^:class:`bool`: An alias for :attr:`external_stickers`.

        .. versionadded:: 2.0
        r   r   rh   s    r   use_external_stickersz!Permissions.use_external_stickersE  r   r   c                     y)zo:class:`bool`: Returns ``True`` if a user can send messages in threads.

        .. versionadded:: 2.0
        l        r   rh   s    r   send_messages_in_threadsz$Permissions.send_messages_in_threadsM  r   r   c                     y)z:class:`bool`: Returns ``True`` if a user can launch an activity flagged 'EMBEDDED' in a voice channel.

        .. versionadded:: 2.0
        l        r   rh   s    r   start_embedded_activitiesz%Permissions.start_embedded_activitiesU  r   r   c                     y)zq:class:`bool`: Returns ``True`` if a user can moderate members (timeout).

        .. versionadded:: 2.0
        l        r   rh   s    r   moderate_memberszPermissions.moderate_members]  r   r   c                     y)zl:class:`bool`: Returns ``True`` if a member can send voice messages.

        .. versionadded:: 2.5
        l          r   rh   s    r   send_voice_messageszPermissions.send_voice_messagese  r   r   c                     y)zq:class:`bool`: Returns ``True`` if a member can set voice channel status.

        .. versionadded:: 2.5
        l          r   rh   s    r   set_voice_channel_statusz$Permissions.set_voice_channel_statusm  r   r   c                     y)zc:class:`bool`: Returns ``True`` if a member can send polls.

        .. versionadded:: 2.6
        l          r   rh   s    r   
send_pollszPermissions.send_pollsu  r   r   c                     y)a/  :class:`bool`: Returns ``True`` if a member's user-installed apps can show public responses.
        Users will still be able to use user-installed apps, but responses will be ephemeral.

        This only applies to apps that are also not installed to the guild.

        .. versionadded:: 2.6
        l           r   rh   s    r   use_external_appszPermissions.use_external_apps}  s     r   N)r   )r1   r)   r2   bool)r:   r   r"   r   )rI   ztype[P]r"   r$   r2   r   r"   None)rd   r)   re   r)   r"   r   )r"   r)   )Qr   r   r   __doc__	__slots__r4   r;   r>   r@   rB   rC   r   rD   rE   rF   classmethodrJ   rL   rO   rQ   rS   rU   rW   rZ   r\   r_   rb   rf   r   ri   rm   rp   rr   rv   ry   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   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   :   sG   =~ I&79 -6F)5,7F)7,<F)<,>F)>  H H > >2 
7 
7 7 7 > > H H   8 8  * 2                       >* +                 ,- .                     >* +     ?+ ,   /0 1             ./ 0              r   POr   c                   t        t        j                        | _        t               }t        j                  j                         D ]j  \  }}t        |t              r|j                  }|j                  |       nt        |t              r|}nH|fd}|fd}t        ||      }t        | ||       l | j                  |z
  | _        | S )Nc                8    | j                   j                  |      S r   )_valuesget)r0   xs     r   getterz)_augment_from_permissions.<locals>.getter  s    <<##A&&r   c                (    | j                  ||       y r   )_set)r0   r,   r   s      r   setterz)_augment_from_permissions.<locals>.setter  s    IIar   )setr   r.   VALID_NAMES__dict__r-   r(   r   r   addr   propertyr/   
PURE_FLAGS)rI   aliasesnamer,   r3   r   r   props           r   _augment_from_permissionsr     s    +112COeG #++113 !ee-.++CKKz*C  	' #& 	  'T4 #!& __w.CNJr   c                  n   e Zd ZU dZdZerded<   ded<   ded<   ded<   ded	<   ded
<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded <   ded!<   ded"<   ded#<   ded$<   ded%<   ded&<   ded'<   ded(<   ded)<   ded*<   ded+<   ded,<   ded-<   ded.<   ded/<   ded0<   ded1<   ded2<   ded3<   ded4<   ded5<   ded6<   ded7<   ded8<   dBd9ZdCd:ZdDd;Z	dEd<Z
edFd=       ZdGd>ZdHd?ZdId@ZyA)Jr   a  A type that is used to represent a channel specific permission.

    Unlike a regular :class:`Permissions`\, the default value of a
    permission is equivalent to ``None`` and not ``False``. Setting
    a value to ``False`` is **explicitly** denying that permission,
    while setting a value to ``True`` is **explicitly** allowing
    that permission.

    The values supported by this are the same as :class:`Permissions`
    with the added possibility of it being set to ``None``.

    .. container:: operations

        .. describe:: x == y

            Checks if two overwrites are equal.
        .. describe:: x != y

            Checks if two overwrites are not equal.
        .. describe:: iter(x)

           Returns an iterator of ``(perm, value)`` pairs. This allows it
           to be, for example, constructed as a dict or a list of pairs.
           Note that aliases are not shown.

    Parameters
    -----------
    \*\*kwargs
        Set the value of permissions by their name.
    )r   zClassVar[set[str]]r   r   bool | Noneri   rm   rp   rr   rv   ry   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   r   r   r   r   r   r   r   r   r   c                    i | _         |j                         D ]/  \  }}|| j                  vrt        d| d      t	        | ||       1 y )Nzno permission called .)r   r-   r   
ValueErrorr/   ra   s       r   r4   zPermissionOverwrite.__init__  sQ    /1 ,,. 	&JC$*** #8Q!?@@D#u%		&r   c                X    t        |t              xr | j                  |j                  k(  S r   )r(   r   r   r9   s     r   __eq__zPermissionOverwrite.__eq__  s"    %!45W$,,%--:WWr   c                    |dvr"t        d|j                  j                         || j                  j	                  |d        y || j                  |<   y )N)TNFz$Expected bool or NoneType, received )r*   r+   r   r   pop)r0   r3   r,   s      r   r   zPermissionOverwrite._set  sV    ++6u7O7O6PQ  =LLS$' %DLLr   c                    t         j                         }t         j                         }| j                  j                         D ])  \  }}|du rt	        ||d       |du st	        ||d       + ||fS )z3Returns the (allow, deny) pair from this overwrite.TF)r   rJ   r   r-   r/   )r0   rd   re   r3   r,   s        r   pairzPermissionOverwrite.pair  sr       "!,,,,. 	)JC}sD)%c4(		) d{r   c                     |        }|D ]  \  }}|du st        ||d        |D ]  \  }}|du st        ||d        |S )zECreates an overwrite from an allow/deny pair of :class:`Permissions`.TF)r/   )rI   rd   re   r    r3   r,   s         r   	from_pairzPermissionOverwrite.from_pair'  s`     e 	(JC}S$'	(  	)JC}S%(	) 
r   c                2    t        | j                        dk(  S )a  Checks if the permission overwrite is currently empty.

        An empty permission overwrite is one that has no overwrites set
        to ``True`` or ``False``.

        Returns
        -------
        :class:`bool`
            Indicates if the overwrite is empty.
        r   )lenr   rh   s    r   is_emptyzPermissionOverwrite.is_empty5  s     4<< A%%r   c                l    |j                         D ]!  \  }}|| j                  vrt        | ||       # y)au  Bulk updates this permission overwrite object.

        Allows you to set multiple attributes by using keyword
        arguments. The names must be equivalent to the properties
        listed. Extraneous key/value pairs will be silently ignored.

        Parameters
        ------------
        \*\*kwargs
            A list of key/value pairs to bulk update with.
        N)r-   r   r/   ra   s       r   rb   zPermissionOverwrite.updateB  s:     !,,. 	&JC$***D#u%		&r   c              #  l   K   | j                   D ]!  }|| j                  j                  |      f # y wr   )r   r   r   )r0   r3   s     r   __iter__zPermissionOverwrite.__iter__T  s3     ?? 	-Ct||'',,,	-s   24N)r2   r   )r:   r   r"   r   )r3   r   r,   r   r"   r   )r"   ztuple[Permissions, Permissions])rI   ztype[PO]rd   r   re   r   r"   r   )r"   r   r   )r"   z!Iterator[tuple[str, bool | None]])r   r   r   r   r   r   r   r4   r   r   r  r   r  r  rb   r  r   r   r   r   r     s   > I''&&**!!  ""$$!!""##%%""!!""&&$$  !!))%%$$((((!!##!!))$$%%!!''$$""$//''%%""##** ++"--&&**#..%%(("--&&&X	&  &&$-r   N)r   r   r"   z2Callable[[Callable[[Any], int]], permission_alias])r   
__future__r   typingr   r   r   r   r   r	   flagsr   r   r   r   __all__r   r#   r$   r   r   r   r   r   r   r   <module>r     s   2 # L L K K' 7 C}% K	) K	 K	\ T./8 m- m- m-r   