
    Dh                         d Z ddlmZ ddlZddlZddlmZ ej                  d   dk(  Zere	e
eeefZe	efZefZeefZefZne	e
eefZe	fZefZefZeefZddZd Zd	 Zerd
 Zd Zyej2                  Zd Zy)z Python v2 to v3 migration module    )DecimalN   )
HexLiteral   c                    t        | t              r| S t        rt        |       S t        | t              rt        |       S t        | t              s	 t        | j                  |            S t        |       S # t        $ r t        d      w xY w)z(Initializes a bytearray from the payload)encodingzpayload must be a str or bytes)
isinstance	bytearrayPY2intbytesencodeAttributeError
ValueError)payloadr   s     W/var/www/html/civilisation/venv/lib/python3.12/site-packages/mysql/connector/catch23.pyinit_bytearrayr   2   s    '9%
!!'3!!'	?W^^X^>??
 W	  	?=>>	?s   A6 6Bc                 N    t         rt        | t              S t        | t              S )z&Returns whether a variable is a string)r   r	   
basestringstrobjs    r   isstrr   F   s    
#z**#s##    c                 N    t         rt        | t              S t        | t              S )z/Returns whether a variable is a of unicode type)r   r	   unicoder   r   s    r   	isunicoder   M   s    
#w''#s##r   c                     t        |t        t        f      rt        j                  | t        |            S t        j                  | |      S )zAWrapper around struct.unpack handling buffer as bytes and strings)r	   r
   r   structunpack_frombuffer)fmtbufs     r   struct_unpackr$   V   s;    cIu-.%%c6#;77!!#s++r   c                       fd}|S )zDecorator used to create a abstract base class

    We use this decorator to create abstract base classes instead of
    using the abc-module. The decorator makes it possible to do the
    same in both Python v2 and v3 code.
    c                     | j                   j                         }dD ]  }|j                  |d        | j                  }t        r| |d<   n| f|z   } | j
                  ||      S )Wrapper)__dict____weakref__N__metaclass__)r(   copypop	__bases__r   __name__)class_attrsattrbases
base_classs       r   wrapperzmake_abc.<locals>.wrapperf   sk    $$&- 	"DIIdD!	"   %+E/"I%E&//5%88r    )r3   r4   s   ` r   make_abcr6   _   s    9 Nr   )r   zutf-8)__doc__decimalr   r   syscustom_typesr   version_infor   r   floatlongNUMERIC_TYPES	INT_TYPESr   UNICODE_TYPESr   STRING_TYPESr
   
BYTE_TYPESr   r   r   r   r$   unpackr6   r5   r   r   <module>rD      s   0 '   
 $ 
qQ%*d;MdIJM>LJ%*5MIFM6LU#J($$ , MMMr   