
    vd                         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nej        Zd ZdS )z Python v2 to v3 migration module    )DecimalN   )
HexLiteral       utf-8c                 n   t          | t                    r| S t          rt          |           S t          | t                    rt          |           S t          | t                    sA	 t          |                     |                    S # t          $ r t          d          w xY wt          |           S )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     S/var/www/html/t/fyr/venv311/lib/python3.11/site-packages/mysql/connector/catch23.pyinit_bytearrayr   2   s    '9%% 
 "!!!'3 ?!!!'' ?	?W^^X^>>??? 	? 	? 	?=>>>	? Ws   ("B B%c                 d    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###r   c                 d    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   sE    cIu-.. 	8%c6#;;7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                                         }dD ]}|                    |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   s{    $$&&- 	" 	"DIIdD!!!!  	&%+E/""I%Ez&/5%888r    )r4   r5   s   ` r   make_abcr7   _   s#    9 9 9 9 9 Nr   )r   r   )__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%   unpackr7   r6   r   r   <module>rE      s0  0 ' &        



 $ $ $ $ $ $ 
qQ $%*d;MdIJM>LJJ%*5MIFM6LU#J   ($ $ $$ $ $  ", , , , MM    r   