
    _e=
                     8   d Z ddlZdZej                  dd dk  reZneZ	 eZej                  dd dk  re
Z
dZddZe	efZdd	Znd
Z edd      ZddZeZ
e	fZddZe Z eed      rej"                  Znej$                  ZddZy# e$ rZe	ZY dZ[qdZ[ww xY w)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    c                 Z    t        | t              r| j                  |      S t        |       S N)
isinstanceunicodeencodebytesxencodings     //usr/lib/python3/dist-packages/OpenGL/_bytes.pyas_8_bitr   &   s%    q'#88X''az    c                 ~    t        | t              r| S t        | t              r| j                  |      S t	        |       S z:Produce a native string (i.e. different on python 2 and 3))r	   r   r
   r   strr   s     r   as_strr   +   s3    aH'"88H%%q6Mr   Flatin1c                     t        | t              r| j                  |      S t        | t              r| S t	        |       j                  |      S r   )r	   r
   r   r   r   r   s     r   r   r   7   s?    q"88H%%E# H1v}}h((r   c                 ~    t        | t              r| S t        | t              r| j                  |      S t	        |       S r   )r	   r
   r   decoder   r   s     r   r   r   B   s3    a H% 88H%%q6Mr   maxsizec                     t        | t              r| S t        | t              r	 | j                  |      S t        |       S # t        $ r}| j                  d      cY d}~S d}~ww xY w)z1Ensure is a unicode object given default encodingzlatin-1N)r	   r
   r   r   UnicodeDecodeError)r   r   errs      r   
as_unicoder   Q   s\    !G	Ae		'88H%% qz " 	'88I&&	's   A   	A$	AA$A$)zutf-8)__doc__sysSTR_IS_BYTESversion_infor   r   long	NameErrorr   intr
   _NULL_8_BYTEr   integer_typesr   STR_IS_UNICODEhasattrr   maxintr    r   r   <module>r-      s   ( BQ%EED BQ%GL HM L&+L) GDM "!
CkkGjjG
c  Ds   B BBB