
˽Xc        	   @` s   d  Z  d d l m Z m Z m Z d d l Z e j d k Z e rI d pL d Z e r[ d p^ d Z	 i d d 6d d	 6d d 6d d 6Z
 d   Z d S(   s    Byteorder utilities for system - numpy byteorder encoding

Converts a variety of string codes for little endian, big endian,
native byte order and swapped byte order to explicit numpy endian
codes - one of '<' (little endian) or '>' (big endian)

i    (   t   divisiont   print_functiont   absolute_importNt   littlet   <t   >t   lt   let   bigt   bt   bet   nativet   =t   swappedt   Sc         C` s   |  j    }  |  d k r t S|  t d k r0 d S|  t d k rD d S|  t d k rX t S|  t d k rl t St d |    d S(	   s5  
    Convert various order codings to numpy format.

    Parameters
    ----------
    code : str
        The code to convert. It is converted to lower case before parsing.
        Legal values are:
        'little', 'big', 'l', 'b', 'le', 'be', '<', '>', 'native', '=',
        'swapped', 's'.

    Returns
    -------
    out_code : {'<', '>'}
        Here '<' is the numpy dtype code for little endian,
        and '>' is the code for big endian.

    Examples
    --------
    >>> import sys
    >>> sys_is_le == (sys.byteorder == 'little')
    True
    >>> to_numpy_code('big')
    '>'
    >>> to_numpy_code('little')
    '<'
    >>> nc = to_numpy_code('native')
    >>> nc == '<' if sys_is_le else nc == '>'
    True
    >>> sc = to_numpy_code('swapped')
    >>> sc == '>' if sys_is_le else sc == '<'
    True

    R   R   R   R   R   R   s   We cannot handle byte order %sN(   t   lowert   Nonet   native_codet   aliasest   swapped_codet
   ValueError(   t   code(    (    s=   /tmp/pip-build-7oUkmx/scipy/scipy/io/matlab/byteordercodes.pyt   to_numpy_code   s    #(   s   littleR   R   s   le(   s   bigR   R	   s   be(   s   nativeR   (   s   swappedR   (   t   __doc__t
   __future__R    R   R   t   syst	   byteordert	   sys_is_leR   R   R   R   (    (    (    s=   /tmp/pip-build-7oUkmx/scipy/scipy/io/matlab/byteordercodes.pyt   <module>   s   

