B
    Ñš[ö  ã               @   sÊ   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rje	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	d
„Zdd„ Zdd„ Zer¸dd„ ZnejZdd„ ZdS )z Python v2 to v3 migration moduleé    )ÚDecimalNé   )Ú
HexLiteralé   ó    úutf-8c             C   sl   t | tƒr| S trt| ƒS t | tƒr,t| ƒS t | tƒsdyt| j|d�ƒS  tk
rb   tdƒ‚Y nX 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   © r   ú›C:\Users\HIRONO~1\AppData\Local\Temp\pip-install-ioykiiwb\mysql-connector-python-rf\mysql_connector_python_rf-2.2.2.data\purelib\mysql\connector\catch23.pyÚinit_bytearray2   s    


r   c             C   s   t rt| tƒS t| tƒS dS )z&Returns whether a variable is a stringN)r   r	   Ú
basestringÚstr)Úobjr   r   r   ÚisstrF   s    
r   c             C   s   t rt| tƒS t| tƒS dS )z/Returns whether a variable is a of unicode typeN)r   r	   Úunicoder   )r   r   r   r   Ú	isunicodeM   s    
r   c             C   s*   t |ttfƒrt | t|ƒ¡S t | |¡S )zAWrapper around struct.unpack handling buffer as bytes and strings)r	   r
   r   ÚstructÚunpack_fromÚbuffer)ÚfmtÚbufr   r   r   Ústruct_unpackV   s    r    c                s   ‡ fdd„}|S )zåDecorator 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                sP   | j  ¡ }xdD ]}| |d¡ qW | j}tr8| |d< n
| f| }ˆ | j||ƒS )ZWrapper)Ú__dict__Ú__weakref__NZ__metaclass__)r!   ÚcopyÚpopÚ	__bases__r   Ú__name__)Úclass_ÚattrsÚattrÚbases)Ú
base_classr   r   Úwrapperf   s    



zmake_abc.<locals>.wrapperr   )r+   r,   r   )r+   r   Úmake_abc_   s    r-   )r   r   )Ú__doc__Údecimalr   r   ÚsysZcustom_typesr   Úversion_infor   r   ÚfloatÚlongZNUMERIC_TYPESZ	INT_TYPESr   ZUNICODE_TYPESr   ZSTRING_TYPESr
   Z
BYTE_TYPESr   r   r   r   r    Úunpackr-   r   r   r   r   Ú<module>   s.   

