
    wdX                     (    d Z ddlmZ d Zd Zd ZdS )z
Datashape validation.
   )	coretypesc                      t          |t          j                  r7t          |t          j                  s  | fd|j        D                       S |S )z
    Map `f` over `t`, calling `f` with type `t` and the map result of the
    mapping `f` over `t` 's parameters.

    Parameters
    ----------
    f : callable
    t : DataShape

    Returns
    -------
    DataShape
    c                 0    g | ]}t          |          S  )traverse).0pfs     4lib/python3.11/site-packages/datashape/validation.py
<listcomp>ztraverse.<locals>.<listcomp>   s!    :::Xa^^:::    )
isinstanceTMonoUnit
parameters)r
   ts   ` r   r   r   
   sZ     !QV <Z16%:%: <q::::Q\:::;;;Hr   c                 0    t          t          |            dS )a  
    Validate a datashape to see whether it is well-formed.

    Parameters
    ----------
    ds : DataShape

    Examples
    --------
    >>> from datashape import dshape
    >>> dshape('10 * int32')
    dshape("10 * int32")
    >>> dshape('... * int32')
    dshape("... * int32")
    >>> dshape('... * ... * int32') # doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
        ...
    TypeError: Can only use a single wildcard
    >>> dshape('T * ... * X * ... * X') # doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
        ...
    TypeError: Can only use a single wildcard
    >>> dshape('T * ...') # doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
        ...
    DataShapeSyntaxError: Expected a dtype
    N)r   	_validate)dss    r   validater      s    8 Yr   c                    t          | t          j                  rgd | j        D             }t	          |          dk    rt          d          t          | j        d         t          j                  rt          d          d S d S )Nc                 F    g | ]}t          |t          j                  |S r   )r   r   Ellipsis)r   xs     r   r   z_validate.<locals>.<listcomp>?   s)    JJJ!
1aj0I0IJAJJJr   r   zCan only use a single wildcardz$Measure may not be an Ellipsis (...))r   r   	DataShaper   len	TypeErrorr   )r   paramsellipsess      r   r   r   <   s    "ak"" DJJr}JJJx==1 	D<===b)1:66 	DBCCCD D
	D 	Dr   N)__doc__ r   r   r   r   r   r   r   r   <module>r$      s_            &  >D D D D Dr   