a
    i‚j=
  ã                
   @   sî   d Z ddlZdZejdd… dk r(eZneZzeZW n( ey\ Z ze	ZW Y dZ[n
dZ[0 0 ejdd… dk r–e
Z
dZdd	d
„Ze	efZddd„Zn,dZeddƒZddd
„ZeZ
e	fZddd„Ze ZeedƒrÚejZnejZddd„ZdS )aì  8-bit string definitions for Python 2/3 compatibility

Defines the following which allow for dealing with Python 3 breakages:

    STR_IS_BYTES
    STR_IS_UNICODE
    
        Easily checked booleans for type identities
    
    _NULL_8_BYTE
    
        An 8-bit byte with NULL (0) value 
    
    as_8_bit( x, encoding='utf-8')
    
        Returns the value as the 8-bit version
    
    unicode -- always pointing to the unicode type 
    bytes -- always pointing to the 8-bit bytes type
é    NTé   )r   é   )é   r   ú úutf-8c                 C   s   t | tƒr|  |¡S t| ƒS ©N)Ú
isinstanceÚunicodeÚencodeÚbytes©ÚxÚencoding© r   úK/home/ghrups/robot-bench/.venv/lib/python3.9/site-packages/OpenGL/_bytes.pyÚas_8_bit&   s    

r   c                 C   s.   t | tƒr| S t | tƒr"|  |¡S t| ƒS dS ©z:Produce a native string (i.e. different on python 2 and 3)N)r   r   r	   r
   Ústrr   r   r   r   Úas_str+   s
    


r   FÚlatin1c                 C   s0   t | tƒr|  |¡S t | tƒr"| S t| ƒ |¡S r   )r   r	   r
   r   r   r   r   r   r   r   7   s
    


c                 C   s.   t | tƒr| S t | tƒr"|  |¡S t| ƒS dS r   )r   r	   r   Údecoder   r   r   r   r   r   B   s
    


Úmaxsizec              
   C   sb   t | tƒr| S t | tƒrVz|  |¡W S  tyR } z|  d¡W  Y d}~S d}~0 0 nt| ƒS dS )z1Ensure is a unicode object given default encodingzlatin-1N)r   r	   r   r   ÚUnicodeDecodeError)r   r   Úerrr   r   r   Ú
as_unicodeQ   s    

"r   )r   )r   )r   )r   )r   )Ú__doc__ÚsysZSTR_IS_BYTESÚversion_infor   r   ÚlongÚ	NameErrorr   Úintr	   Z_NULL_8_BYTEr   Úinteger_typesr   ZSTR_IS_UNICODEÚhasattrr   Zmaxintr   r   r   r   r   Ú<module>   s4   



	
	
