U
    #c
                     @  s^   d Z ddlmZ ddlmZmZmZmZmZm	Z	 dgZ
edddZe	G dd dee Zd	S )
z3A module containing the `_NestedSequence` protocol.    )annotations)AnyIteratoroverloadTypeVarProtocolruntime_checkable_NestedSequence_T_coT)	covariantc                   @  s   e Zd ZdZddddZeddddd	Zed
dddd	Zdd	 ZdddddZddddZddddZ	dddddZ
dddddZdS )r	   a  A protocol for representing nested sequences.

    Warning
    -------
    `_NestedSequence` currently does not work in combination with typevars,
    *e.g.* ``def func(a: _NestedSequnce[T]) -> T: ...``.

    See Also
    --------
    collections.abc.Sequence
        ABCs for read-only and mutable :term:`sequences`.

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

        >>> from __future__ import annotations

        >>> from typing import TYPE_CHECKING
        >>> import numpy as np
        >>> from numpy._typing import _NestedSequence

        >>> def get_dtype(seq: _NestedSequence[float]) -> np.dtype[np.float64]:
        ...     return np.asarray(seq).dtype

        >>> a = get_dtype([1.0])
        >>> b = get_dtype([[1.0]])
        >>> c = get_dtype([[[1.0]]])
        >>> d = get_dtype([[[[1.0]]]])

        >>> if TYPE_CHECKING:
        ...     reveal_locals()
        ...     # note: Revealed local types are:
        ...     # note:     a: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
        ...     # note:     b: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
        ...     # note:     c: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
        ...     # note:     d: numpy.dtype[numpy.floating[numpy._typing._64Bit]]

    int)returnc                C  s   t dS )zImplement ``len(self)``.NNotImplementedErrorself r   B/tmp/pip-unpacked-wheel-b2rbor69/numpy/_typing/_nested_sequence.py__len__=   s    z_NestedSequence.__len__z_T_co | _NestedSequence[_T_co])indexr   c                C  s   d S Nr   r   r   r   r   r   __getitem__A   s    z_NestedSequence.__getitem__slicez_NestedSequence[_T_co]c                C  s   d S r   r   r   r   r   r   r   C   s    c                C  s   t dS )zImplement ``self[x]``.Nr   r   r   r   r   r   F   s    objectbool)xr   c                C  s   t dS )zImplement ``x in self``.Nr   )r   r   r   r   r   __contains__J   s    z_NestedSequence.__contains__z(Iterator[_T_co | _NestedSequence[_T_co]]c                C  s   t dS )zImplement ``iter(self)``.Nr   r   r   r   r   __iter__N   s    z_NestedSequence.__iter__c                C  s   t dS )zImplement ``reversed(self)``.Nr   r   r   r   r   __reversed__R   s    z_NestedSequence.__reversed__r   )valuer   c                C  s   t dS )z,Return the number of occurrences of `value`.Nr   r   r    r   r   r   countV   s    z_NestedSequence.countc                C  s   t dS )z"Return the first index of `value`.Nr   r!   r   r   r   r   Z   s    z_NestedSequence.indexN)__name__
__module____qualname____doc__r   r   r   r   r   r   r"   r   r   r   r   r   r	      s   (N)r&   
__future__r   typingr   r   r   r   r   r   __all__r
   r	   r   r   r   r   <module>   s    	