a
    ߙfb                     @   s   d Z ddlmZ g dZG dd deZG dd deZG dd	 d	eZG d
d deZG dd deZ	G dd deZ
G dd deZG dd deZG dd deZG dd deZG dd deZdS )zO This module defines custom errors and exceptions used in astropy.coordinates.
    )AstropyWarning)

RangeErrorBoundsErrorIllegalHourErrorIllegalMinuteErrorIllegalSecondErrorConvertErrorIllegalHourWarningIllegalMinuteWarningIllegalSecondWarningUnknownSiteExceptionc                   @   s   e Zd ZdZdS )r   zF
    Raised when some part of an angle is out of its valid range.
    N__name__
__module____qualname____doc__ r   r   9lib/python3.9/site-packages/astropy/coordinates/errors.pyr      s   r   c                   @   s   e Zd ZdZdS )r   zG
    Raised when an angle is outside of its user-specified bounds.
    Nr   r   r   r   r   r      s   r   c                   @   s    e Zd ZdZdd Zdd ZdS )r   z
    Raised when an hour value is not in the range [0,24).

    Parameters
    ----------
    hour : int, float

    Examples
    --------

    .. code-block:: python

        if not 0 <= hr < 24:
           raise IllegalHourError(hour)
    c                 C   s
   || _ d S Nhour)selfr   r   r   r   __init__+   s    zIllegalHourError.__init__c                 C   s   d| j  dS )Nz)An invalid value for 'hours' was found ('z '); must be in the range [0,24).r   r   r   r   r   __str__.   s    zIllegalHourError.__str__Nr   r   r   r   r   r   r   r   r   r   r      s   r   c                   @   s"   e Zd ZdZdddZdd ZdS )r	   z_
    Raised when an hour value is 24.

    Parameters
    ----------
    hour : int, float
    Nc                 C   s   || _ || _d S r   r   alternativeactionstr)r   r   r   r   r   r   r   :   s    zIllegalHourWarning.__init__c                 C   s*   d| j  d}| jd ur&|d| j 7 }|S )Nz'hour' was found  to be 'z#', which is not in range (-24, 24). r   r   messager   r   r   r   >   s    
zIllegalHourWarning.__str__)Nr   r   r   r   r   r	   2   s   
r	   c                   @   s    e Zd ZdZdd Zdd ZdS )r   z
    Raised when an minute value is not in the range [0,60].

    Parameters
    ----------
    minute : int, float

    Examples
    --------

    .. code-block:: python

        if not 0 <= min < 60:
            raise IllegalMinuteError(minute)

    c                 C   s
   || _ d S r   minute)r   r"   r   r   r   r   V   s    zIllegalMinuteError.__init__c                 C   s   d| j  dS )Nz*An invalid value for 'minute' was found ('"'); should be in the range [0,60).r!   r   r   r   r   r   Y   s    zIllegalMinuteError.__str__Nr   r   r   r   r   r   E   s   r   c                   @   s"   e Zd ZdZdddZdd ZdS )r
   zb
    Raised when a minute value is 60.

    Parameters
    ----------
    minute : int, float
    Nc                 C   s   || _ || _d S r   r"   r   )r   r"   r   r   r   r   r   e   s    zIllegalMinuteWarning.__init__c                 C   s*   d| j  d}| jd ur&|d| j 7 }|S )Nz'minute' was found  to be ' ', which is not in range [0,60).r   r$   r   r   r   r   r   i   s    
zIllegalMinuteWarning.__str__)Nr   r   r   r   r   r
   ]   s   
r
   c                   @   s    e Zd ZdZdd Zdd ZdS )r   a  
    Raised when an second value (time) is not in the range [0,60].

    Parameters
    ----------
    second : int, float

    Examples
    --------

    .. code-block:: python

        if not 0 <= sec < 60:
            raise IllegalSecondError(second)
    c                 C   s
   || _ d S r   second)r   r'   r   r   r   r      s    zIllegalSecondError.__init__c                 C   s   d| j  dS )Nz*An invalid value for 'second' was found ('r#   r&   r   r   r   r   r      s    zIllegalSecondError.__str__Nr   r   r   r   r   r   p   s   r   c                   @   s"   e Zd ZdZdddZdd ZdS )r   zb
    Raised when a second value is 60.

    Parameters
    ----------
    second : int, float
    Nc                 C   s   || _ || _d S r   r'   r   )r   r'   r   r   r   r   r      s    zIllegalSecondWarning.__init__c                 C   s*   d| j  d}| jd ur&|d| j 7 }|S )Nz'second' was found  to be 'r%   r   r(   r   r   r   r   r      s    
zIllegalSecondWarning.__str__)Nr   r   r   r   r   r      s   
r   c                   @   s   e Zd ZdZdS )
UnitsErrorz1
    Raised if units are missing or invalid.
    Nr   r   r   r   r   r)      s   r)   c                   @   s   e Zd ZdZdS )r   zF
    Raised if a coordinate system cannot be converted to another
    Nr   r   r   r   r   r      s   r   c                       s   e Zd Zd fdd	Z  ZS )r   Nc                    sH   d| d| d}|r*|d d|7 }|| _|| _|| _t |S )NzSite 'z' not in database. Use z to see available sites.z Did you mean one of: '{}'?'z', ')formatjoinsite	attributeclose_namessuperr   )r   r,   r-   r.   r    	__class__r   r   r      s    zUnknownSiteException.__init__)N)r   r   r   r   __classcell__r   r   r0   r   r      s   r   N)r   Zastropy.utils.exceptionsr   __all__
ValueErrorr   r   r   r	   r   r
   r   r   r)   	Exceptionr   KeyErrorr   r   r   r   r   <module>   s   