o
    i~                     @   s2   d Z ddlZddlZddlmZ G dd dZdS )zDuration module.    N)_apic                   @   s   e Zd ZdZddgZdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dd ZeeejZeeejZeeejZeeejZeeejZeeejZdd Zdd Zdd ZeZdd Zdd Z dd Z!dS )DurationzClass Duration in development.ETUTCc                 C   s    t j| j|d || _|| _dS )a3  
        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.
        )frameN)r   Zcheck_in_listallowed_frame_seconds)selfr   seconds r   t/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/matplotlib/testing/jpl_units/Duration.py__init__   s   
zDuration.__init__c                 C      | j S )z$Return the frame the duration is in.)r   r
   r   r   r   r         zDuration.framec                 C   s   t | jt| jS )z*Return the absolute value of the duration.)r   r   absr	   r   r   r   r   __abs__!   s   zDuration.__abs__c                 C   s   t | j| j S )z+Return the negative value of this Duration.)r   r   r	   r   r   r   r   __neg__%   s   zDuration.__neg__c                 C   r   )z-Return the number of seconds in the Duration.r	   r   r   r   r   r   )   r   zDuration.secondsc                 C   s
   | j dkS )Nr   r   r   r   r   r   __bool__-   s   
zDuration.__bool__c                 C   s   |  |d || j|jS )zT
        Check that *self* and *rhs* share frames; compare them using *op*.
        compare)checkSameFramer	   )r
   oprhsr   r   r   _cmp0   s   zDuration._cmpc                 C   sF   ddl m  m} t||jr||  S | |d t| j| j|j S )a"  
        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.
        r   Nadd)	Zmatplotlib.testing.jpl_unitstestingZ	jpl_units
isinstanceZEpochr   r   r   r	   )r
   r   Ur   r   r   __add__>   s
   zDuration.__add__c                 C   s    |  |d t| j| j|j S )a3  
        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.
        sub)r   r   r   r	   r
   r   r   r   r   __sub__T   s   zDuration.__sub__c                 C   s   t | j| jt| S )z
        Scale a UnitDbl by a value.

        = INPUT VARIABLES
        - rhs     The scalar to multiply by.

        = RETURN VALUE
        - Returns the scaled Duration.
        )r   r   r	   floatr"   r   r   r   __mul__d   s   
zDuration.__mul__c                 C   s   | j dd| j S )Print the Duration.g )r	   r   r   r   r   r   __str__r   s   zDuration.__str__c                 C   s   d| j  d| jddS )r&   z
Duration('z', r'   ))r   r	   r   r   r   r   __repr__v   s   zDuration.__repr__c                 C   s.   | j |j krtd| d| j  d|j  dS )aK  
        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.
        zCannot z' Durations with different frames.
LHS: z
RHS: N)r   
ValueError)r
   r   funcr   r   r   r   z   s   zDuration.checkSameFrameN)"__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   	functoolspartialmethodoperatoreq__eq__ne__ne__lt__lt__le__le__gt__gt__ge__ge__r    r#   r%   __rmul__r)   r+   r   r   r   r   r   r   	   s.    r   )r1   r2   r4   Z
matplotlibr   r   r   r   r   r   <module>   s
    