
    	h%                         d dl Z d dlZd dlmZ ddlmZ e j         G d d                      Z G d de          Z	 G d	 d
ee	          Z
dS )    N)Any   )PacketTypesc                       e Zd ZdZddededefdZd Zd	 Zd
 Z	d Z
d Zd Zd Zd Zd Zd Zd Zedefd            ZdS )
ReasonCodezMQTT version 5.0 reason codes class.

    See ReasonCode.names for a list of possible numeric values along with their
    names and the packets to which they apply.

    Success
packetTypeaName
identifierc                 
   || _         i dt          j        t          j        t          j        t          j        t          j        t          j        t          j        gt          j	        gt          j
        gdddt          j
        giddt          j
        giddt          j	        gid	d
t          j        t          j        giddt          j        giddt          j        giddt          j        giddt          j        t          j        t          j        t          j
        t          j        t          j	        giddt          j        t          j	        giddt          j        t          j	        giddt          j        t          j        t          j        t          j
        t          j        t          j	        giddt          j        giddt          j        giddt          j        gidd t          j        t          j        t          j        t          j
        t          j        t          j	        gid!d"t          j        gii d#d$t          j        t          j	        gid%d&t          j        gid'd(t          j	        gid)d*t          j        t          j	        gid+d,t          j	        gid-d.t          j	        gid/d0t          j
        t          j        t          j	        gid1d2t          j        t          j        t          j        t          j	        gid3d4t          j        t          j        t          j
        t          j        gid5d6t          j        t          j        gid7d8t          j	        gid9d:t          j	        gid;d<t          j        t          j	        gid=d>t          j	        gid?d@t          j        t          j        t          j        t          j
        t          j	        gidAdBt          j	        gidCdDt          j        t          j        t          j	        gidEt          j        t          j	        gidFt          j        t          j	        gidGt          j        t          j	        gidHt          j        t          j	        gidIt          j
        t          j	        gidJt          j        t          j	        gidKt          j	        gidLt          j
        t          j	        gidMt          j
        t          j	        gidN	| _        |dOk    r/|t          j	        k    r|dPk    rdQ}|                     |           dRS || _        |                                  dRS )Sa  
        packetType: the type of the packet, such as PacketTypes.CONNECT that
            this reason code will be used with.  Some reason codes have different
            names for the same identifier when used a different packet type.

        aName: the String name of the reason code to be created.  Ignored
            if the identifier is set.

        identifier: an integer value of the reason code to be created.

        r   )r   Normal disconnectionzGranted QoS 0r   zGranted QoS 1   zGranted QoS 2   zDisconnect with will message   zNo matching subscribers   zNo subscription found   zContinue authentication   zRe-authenticate   zUnspecified error   zMalformed packet   zProtocol error   zImplementation specific error   zUnsupported protocol version   zClient identifier not valid   zBad user name or password   zNot authorized   zServer unavailable   zServer busy   Banned   zServer shutting down   zBad authentication method   zKeep alive timeout   zSession taken over   zTopic filter invalid   zTopic name invalid   zPacket identifier in use   zPacket identifier not found   zReceive maximum exceeded   zTopic alias invalid   zPacket too large   zMessage rate too high   zQuota exceeded   zAdministrative action   zPayload format invalidzRetain not supportedzQoS not supportedzUse another serverzServer movedz!Shared subscription not supportedzConnection rate exceededzMaximum connect timez&Subscription identifiers not supportedz#Wildcard subscription not supported)	                           r	   r   r   N)r
   r   CONNACKPUBACKPUBRECPUBRELPUBCOMPUNSUBACKAUTH
DISCONNECTSUBACKnamessetvaluegetName)selfr
   r   r   s       b/var/www/html/web-builder-api.evdpl.com/venv/lib/python3.11/site-packages/paho/mqtt/reasoncodes.py__init__zReasonCode.__init__!   s    %K
K/1C'.0BKDW'0+2BD *5)?(@"-"4!5	7 7K
 +"4!56K
 +"4!56K
 .1G0HIK
 *$k&89;K
 (;+?*@AK
 *[-=,>?K
 "[%5$67K
 %(;[=O(3(:K<NP[Pd(3(>(@ CK
" $&(>?A#K
& "&(>?A'K
* 1K4G4?4FHZ\g\n4?4H+J`4b e+K
0 0;3F2GH1K
2 /+2E1FG3K
4 -0C/DE5K
6 "[%8+:L%0%79K[Ma%0%;%= @7K
< &)<(=>=K
 K
> -+"5{7M!NO?K
@ ([012AK
B (;+A*BCCK
D -&(>?AEK
H &)?(@AIK
J &)?(@AKK
L (%{';[=STVMK
P &&(:%{'=?@QK
V ,%{'9%{';=>WK
\ /%{':;=]K
` ,{/E.FGaK
b '+*@)ABcK
d ${':K<R&STeK
f )K,B+CDgK
h "[%8+:L%0%79K[Mc%e hiK
l )K,B+CDmK
n *%{'9;;QRToK
 K
r )&(>?A%&(>?A&&(>?A &(>?A5%{'=>@,&(>?A()*,:%{'=>@7%{'=>@SK
 K
 K

X [3338J8J.HHUOOOOO#DJLLNNNNN    c                     || j         vrt          |          | j         |         fd                                D             }t          |          dk    rt	          d|          |d         S )z
        Get the reason code string name for a specific identifier.
        The name can vary by packet type for the same identifier, which
        is why the packet type is also required.

        Used when displaying the reason code.
        c                 (    g | ]}|         v |S  rL   ).0namerB   r
   s     rG   
<listcomp>z*ReasonCode.__getName__.<locals>.<listcomp>   s'    OOOTZ5;5N5ND5N5N5NrI   r   z!Expected exactly one name, found r   )rB   KeyErrorkeyslen
ValueError)rF   r
   r   namelistrB   s    `  @rG   __getName__zReasonCode.__getName__   s     TZ'':&&&
:&OOOOOUZZ\\OOOx==AMMMNNN{rI   c                     | j                                         D ]A}|| j         |                                         v r| j        | j         |         |         v r|c S Bt          d|           )z
        Get the numeric id corresponding to a reason code name.

        Used when setting the reason code for a packetType
        check that only valid codes for the packet are set.
        zReason code name not found: )rB   rQ   r
   rP   )rF   rN   codes      rG   getIdzReasonCode.getId   sw     JOO%% 	  	 Dtz$',,....?dj&6t&<<<KKK<d<<===rI   c                 :    |                      |          | _        d S N)rX   rD   )rF   rN   s     rG   rC   zReasonCode.set   s    ZZ%%


rI   c                     |d         }|                      | j        |          }|                     |          | _        dS )Nr   r   )rU   r
   rX   rD   )rF   buffercrN   s       rG   unpackzReasonCode.unpack   s:    1I33ZZ%%
qrI   c                 B    |                      | j        | j                  S )zVReturns the reason code name corresponding to the numeric value which is set.
        )rU   r
   rD   rF   s    rG   rE   zReasonCode.getName   s     <<<rI   c                     t          |t                    r| j        |k    S t          |t                    r|t          |           k    S t          |t                    r| j        |j        k    S dS )NF)
isinstanceintrD   strr   rF   others     rG   __eq__zReasonCode.__eq__   sj    eS!! 	':&&eS!! 	&CII%%eZ(( 	-:,,urI   c                     t          |t                    r| j        |k     S t          |t                    r| j        |j        k     S t          S rZ   )rb   rc   rD   r   NotImplementedre   s     rG   __lt__zReasonCode.__lt__   sH    eS!! 	&:%%eZ(( 	,:++rI   c                     	 t           j        | j                 }n# t          $ r d}Y nw xY wd| d|                                 dS )NUnknownzReasonCode(z, ))r   Namesr
   
IndexErrorrE   )rF   packet_names     rG   __repr__zReasonCode.__repr__   s`    	$%+DO<KK 	$ 	$ 	$#KKK	$ @[??DLLNN????s    ))c                 *    |                                  S rZ   rE   r`   s    rG   __str__zReasonCode.__str__       ||~~rI   c                 *    |                                  S rZ   rs   r`   s    rG   jsonzReasonCode.json   ru   rI   c                 ,    t          | j        g          S rZ   )	bytearrayrD   r`   s    rG   packzReasonCode.pack   s    $*&&&rI   returnc                     | j         dk    S )Nr   )rD   r`   s    rG   
is_failurezReasonCode.is_failure   s    zT!!rI   N)r   r	   )__name__
__module____qualname____doc__rc   rd   rH   rU   rX   rC   r^   rE   rg   rj   rq   rt   rw   rz   propertyboolr}   rL   rI   rG   r   r      s$        ` `3 `s `3 ` ` ` `D   > > >& & &  = = =
    @ @ @    ' ' ' "D " " " X" " "rI   r   c                       e Zd ZdedefdZdS )_CompatibilityIsInstancerf   r{   c                 ,    t          |t                    S rZ   )rb   r   re   s     rG   __instancecheck__z*_CompatibilityIsInstance.__instancecheck__   s    %,,,rI   N)r~   r   r   r   r   r   rL   rI   rG   r   r      s6        -s -t - - - - - -rI   r   c                        e Zd Z fdZ xZS )ReasonCodesc                 r    t          j        dt          d            t                      j        |i | d S )Nz<ReasonCodes is deprecated, use ReasonCode (singular) insteadr   )category
stacklevel)warningswarnDeprecationWarningsuperrH   )rF   argskwargs	__class__s      rG   rH   zReasonCodes.__init__   sI    T'	
 	
 	
 	
 	$)&)))))rI   )r~   r   r   rH   __classcell__)r   s   @rG   r   r      s8        * * * * * * * * *rI   r   )	metaclass)	functoolsr   typingr   packettypesr   total_orderingr   typer   r   rL   rI   rG   <module>r      s   "            $ $ $ $ $ $ x" x" x" x" x" x" x" x"v- - - - -t - - -
* * * * **(@ * * * * * *rI   