B
    FŽ0dç  ã               @   sx   d Z ddlZddlZddlmZ g Zeeeddœdd„Zedœd	d
„Zedddƒ edddƒ ede	eƒdƒ eƒ Z
dS )z=A module for creating docstrings for sphinx ``data`` domains.é    Né   )ÚNDArray)ÚnameÚvalueÚdocÚreturnc             C   s   t  | ||f¡ dS )zþAppend ``_docstrings_list`` with a docstring for `name`.

    Parameters
    ----------
    name : str
        The name of the object.
    value : str
        A string-representation of the object.
    doc : str
        The docstring of the object.

    N)Ú_docstrings_listÚappend)r   r   r   © r
   úM/var/www/html/venv/lib/python3.7/site-packages/numpy/typing/_add_docstring.pyÚ
add_newdoc   s    r   )r   c           	   C   s   g } xðt D ]è\}}}t |¡ dd¡}| d¡}g }d}x’|D ]Š}t d|¡}	|	r¶|r¶t | ¡ ¡}
|
dkrŒd}| |	 	d¡› d|
› ¡ nd}| |	 	d¡› d	|
› ¡ | d¡ q>| |› |› ¡ q>W d 
|¡}|  d
|› d|› d|› ¡ q
W d 
| ¡S )zaConvert all docstrings in ``_docstrings_list`` into a single
    sphinx-legible text block.

    Ú
z
    Ú z^(\s+)[-=]+\s*$ZExamplesr   z.. rubric:: z    z.. admonition:: z
.. data:: z
    :value: )r   ÚtextwrapÚdedentÚreplaceÚsplitÚreÚmatchÚpopr	   ÚgroupÚjoin)Ztype_list_retr   r   r   ÚsÚlinesÚ	new_linesÚindentÚlineÚmÚprevr
   r
   r   Ú_parse_docstrings   s(    


 r   Z	ArrayLikeztyping.Union[...]aG  
    A `~typing.Union` representing objects that can be coerced into an `~numpy.ndarray`.

    Among others this includes the likes of:

    * Scalars.
    * (Nested) sequences.
    * Objects implementing the `~class.__array__` protocol.

    See Also
    --------
    :term:`array_like`:
        Any scalar or sequence that can be interpreted as an ndarray.

    Examples
    --------
    .. code-block:: python

        >>> import numpy as np
        >>> import numpy.typing as npt

        >>> def as_array(a: npt.ArrayLike) -> np.ndarray:
        ...     return np.array(a)

    Z	DTypeLikeaª  
    A `~typing.Union` representing objects that can be coerced into a `~numpy.dtype`.

    Among others this includes the likes of:

    * :class:`type` objects.
    * Character codes or the names of :class:`type` objects.
    * Objects with the ``.dtype`` attribute.

    See Also
    --------
    :ref:`Specifying and constructing data types <arrays.dtypes.constructing>`
        A comprehensive overview of all objects that can be coerced into data types.

    Examples
    --------
    .. code-block:: python

        >>> import numpy as np
        >>> import numpy.typing as npt

        >>> def as_dtype(d: npt.DTypeLike) -> np.dtype:
        ...     return np.dtype(d)

    r   aÐ  
    A :term:`generic <generic type>` version of
    `np.ndarray[Any, np.dtype[+ScalarType]] <numpy.ndarray>`.

    Can be used during runtime for typing arrays with a given dtype
    and unspecified shape.

    Examples
    --------
    .. code-block:: python

        >>> import numpy as np
        >>> import numpy.typing as npt

        >>> print(npt.NDArray)
        numpy.ndarray[typing.Any, numpy.dtype[+ScalarType]]

        >>> print(npt.NDArray[np.float64])
        numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]

        >>> NDArrayInt = npt.NDArray[np.int_]
        >>> a: NDArrayInt = np.arange(10)

        >>> def func(a: npt.ArrayLike) -> npt.NDArray[Any]:
        ...     return np.array(a)

    )Ú__doc__r   r   Z_generic_aliasr   r   Ústrr   r   ÚreprZ_docstringsr
   r
   r
   r   Ú<module>   s   !
