ó
 m[c           @` s‰   d  Z  d d l m Z m Z m Z m Z d d l Z d d l m Z d d l	 j
 Z
 d d l m Z d g Z d e
 j f d „  ƒ  YZ d S(	   u2   StrConverter module containing class StrConverter.i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   xrange(   t   iterableu   StrConvertert   StrConverterc           B` s;   e  Z d  Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z RS(   uš  : A matplotlib converter class.  Provides matplotlib conversion
        functionality for string data values.

   Valid units for string are:
   - 'indexed' : Values are indexed as they are specified for plotting.
   - 'sorted'  : Values are sorted alphanumerically.
   - 'inverted' : Values are inverted so that the first value is on top.
   - 'sorted-inverted' :  A combination of 'sorted' and 'inverted'
   c         C` s   d S(   u‡  : Returns information on how to handle an axis that has string data.

      = INPUT VARIABLES
      - axis    The axis using this converter.
      - unit    The units to use for a axis with string data.

      = RETURN VALUE
      - Returns a matplotlib AxisInfo data structure that contains
        minor/major formatters, major/minor locators, and default
        label information.
      N(   t   None(   t   unitt   axis(    (    sH   lib/python2.7/site-packages/matplotlib/testing/jpl_units/StrConverter.pyt   axisinfo(   s    c         C` se  t  j j |  ƒ r |  S|  g  k r& g  S| j } | | j ƒ  k rJ t } n t } | j ƒ  | j ƒ  } | j	 ƒ  } g  | D] } | j
 ƒ  ry | j
 ƒ  ^ qy } | s² g  } g  } n  t |  ƒ sÊ |  g }  n  g  } x6 |  D]. }	 |	 | k r× |	 | k r× | j |	 ƒ q× q× Wx- | D]% }	 | r,| j |	 ƒ q|	 g } qWd g | d g } t t t | ƒ ƒ ƒ } d | d <| d d | d <| j | ƒ | j | ƒ | j ƒ  }
 |
 j | d | d ƒ | rà| j | d | d ƒ n | j | d | d ƒ g  } xP |  D]H }	 d } | d 7} |	 | k s3t | ƒ ‚ | j | | j |	 ƒ ƒ qW| j j d ƒ | S(   u†  : Convert value using unit to a float.  If value is a sequence, return
      the converted sequence.

      = INPUT VARIABLES
      - axis    The axis using this converter.
      - value   The value or list of values that need to be converted.
      - unit    The units to use for a axis with Epoch data.

      = RETURN VALUE
      - Returns the value parameter converted to floats.
      u    g      à?i    iÿÿÿÿu9   This is due to a logic error in the StrConverter class.  u5   Please report this error and its message in bugzilla.(   t   unitst   ConversionInterfacet
   is_numliket   axest	   get_xaxist   Truet   Falset   get_major_tickst   get_ticklocst   get_ticklabelst   get_textR   t   appendt   listR   t   lent	   set_tickst   set_ticklabelst   get_major_locatort
   set_boundst   set_xlimt   set_ylimt   AssertionErrort   indext   viewLimt   ignore(   t   valueR   R	   t   axt   isXAxist   tickst   labelst   lt	   newValuest   vt   loct   resultt   errmsg(    (    sH   lib/python2.7/site-packages/matplotlib/testing/jpl_units/StrConverter.pyt   convert9   sX    		
+	

c         C` s   d S(   u5  : Return the default unit for value, or None.

      = INPUT VARIABLES
      - axis    The axis using this converter.
      - value   The value or list of values that need units.

      = RETURN VALUE
      - Returns the default units to use for value.
      Return the default unit for value, or None.
      u   indexed(    (   R#   R	   (    (    sH   lib/python2.7/site-packages/matplotlib/testing/jpl_units/StrConverter.pyt   default_units–   s    (   t   __name__t
   __module__t   __doc__t   staticmethodR
   R.   R/   (    (    (    sH   lib/python2.7/site-packages/matplotlib/testing/jpl_units/StrConverter.pyR      s   	](   R2   t
   __future__R    R   R   R   t   sixt	   six.movesR   t   matplotlib.unitsR   t   matplotlib.cbookR   t   __all__R   R   (    (    (    sH   lib/python2.7/site-packages/matplotlib/testing/jpl_units/StrConverter.pyt   <module>   s   "	