ó
 m[c           @` sN   d  Z  d d l m Z m Z m Z m Z d d l Z d e f d     YZ d S(   u   Duration module.i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsNt   Durationc           B` s¼   e  Z d  Z d d g Z d   Z d   Z d   Z d   Z d   Z d   Z	 e
 j r` e	 Z n  d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   u"   Class Duration in development.
   u   ETu   UTCc         C` sM   | |  j  k r7 d | t |  j   f } t |   n  | |  _ | |  _ d S(   u  Create a new Duration object.

      = ERROR CONDITIONS
      - If the input frame is not in the allowed list, an error is thrown.

      = INPUT VARIABLES
      - frame    The frame of the duration.  Must be 'ET' or 'UTC'
      - seconds  The number of seconds in the Duration.
      u9   Input frame '%s' is not one of the supported frames of %sN(   t   allowedt   strt
   ValueErrort   _framet   _seconds(   t   selft   framet   secondst   msg(    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyt   __init__   s    
	c         C` s   |  j  S(   u$   Return the frame the duration is in.(   R   (   R
   (    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyR   /   s    c         C` s   t  |  j t |  j   S(   u*   Return the absolute value of the duration.(   R   R   t   absR	   (   R
   (    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyt   __abs__4   s    c         C` s   t  |  j |  j  S(   u+   Return the negative value of this Duration.(   R   R   R	   (   R
   (    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyt   __neg__9   s    c         C` s   |  j  S(   u-   Return the number of seconds in the Duration.(   R	   (   R
   (    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyR   >   s    c         C` s   |  j  d k S(   uĀ   Compare two Durations.

      = INPUT VARIABLES
      - rhs    The Duration to compare against.

      = RETURN VALUE
      - Returns -1 if self < rhs, 0 if self == rhs, +1 if self > rhs.
      i    (   R	   (   R
   (    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyt   __nonzero__C   s    	c         C` s#   |  j  | d  t |  j | j  S(   u#  Compare two Durations.

      = ERROR CONDITIONS
      - If the input rhs is not in the same frame, an error is thrown.

      = INPUT VARIABLES
      - rhs    The Duration to compare against.

      = RETURN VALUE
      - Returns -1 if self < rhs, 0 if self == rhs, +1 if self > rhs.
      u   compare(   t   checkSameFramet   cmpR	   (   R
   t   rhs(    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyt   __cmp__R   s    c         C` sV   d d l  j j } t | | j  r, | |  S|  j | d  t |  j |  j | j  S(   u
  Add two Durations.

      = ERROR CONDITIONS
      - If the input rhs is not in the same frame, an error is thrown.

      = INPUT VARIABLES
      - rhs    The Duration to add.

      = RETURN VALUE
      - Returns the sum of ourselves and the input Duration.
      i    Nu   add(	   t   matplotlib.testing.jpl_unitst   testingt	   jpl_unitst
   isinstancet   EpochR   R   R   R	   (   R
   R   t   U(    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyt   __add__b   s
    c         C` s*   |  j  | d  t |  j |  j | j  S(   u  Subtract two Durations.

      = ERROR CONDITIONS
      - If the input rhs is not in the same frame, an error is thrown.

      = INPUT VARIABLES
      - rhs    The Duration to subtract.

      = RETURN VALUE
      - Returns the difference of ourselves and the input Duration.
      u   sub(   R   R   R   R	   (   R
   R   (    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyt   __sub__x   s    c         C` s   t  |  j |  j t |   S(   u    Scale a UnitDbl by a value.

      = INPUT VARIABLES
      - rhs    The scalar to multiply by.

      = RETURN VALUE
      - Returns the scaled Duration.
      (   R   R   R	   t   float(   R
   R   (    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyt   __mul__   s    	c         C` s   t  |  j |  j t |   S(   u”   Scale a Duration by a value.

      = INPUT VARIABLES
      - lhs    The scalar to multiply by.

      = RETURN VALUE
      - Returns the scaled Duration.
      (   R   R   R	   R   (   R
   t   lhs(    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyt   __rmul__   s    	c         C` s   t  |  j |  j |  S(   u    Divide a Duration by a value.

      = INPUT VARIABLES
      - rhs    The scalar to divide by.

      = RETURN VALUE
      - Returns the scaled Duration.
      (   R   R   R	   (   R
   R   (    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyt   __div__    s    	c         C` s   t  |  j | |  j  S(   u    Divide a Duration by a value.

      = INPUT VARIABLES
      - rhs    The scalar to divide by.

      = RETURN VALUE
      - Returns the scaled Duration.
      (   R   R   R	   (   R
   R   (    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyt   __rdiv__¬   s    	c         C` s   d |  j  |  j f S(   u   Print the Duration.u   %g %s(   R	   R   (   R
   (    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyt   __str__ø   s    c         C` s   d |  j  |  j f S(   u   Print the Duration.u   Duration( '%s', %g )(   R   R	   (   R
   (    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyt   __repr__½   s    c         C` s>   |  j  | j  k r: d | |  j  | j  f } t |   n  d S(   u2  Check to see if frames are the same.

      = ERROR CONDITIONS
      - If the frame of the rhs Duration is not the same as our frame,
        an error is thrown.

      = INPUT VARIABLES
      - rhs    The Duration to check for the same frame
      - func   The name of the function doing the check.
      u;   Cannot %s Duration's with different frames.
LHS: %s
RHS: %sN(   R   R   (   R
   R   t   funcR   (    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyR   Ā   s    (   t   __name__t
   __module__t   __doc__R   R   R   R   R   R   R   t   sixt   PY3t   __bool__R   R   R   R    R"   R#   R$   R%   R&   R   (    (    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyR      s(   																	(	   R*   t
   __future__R    R   R   R   R+   t   objectR   (    (    (    sD   lib/python2.7/site-packages/matplotlib/testing/jpl_units/Duration.pyt   <module>   s   "