
    ,Vh
                    x    d Z ddlmZ ddlmZ ddlmZmZmZm	Z	 dgZ
 edd      Ze	 G d	 dee                Zy
)z3A module containing the `_NestedSequence` protocol.    )annotations)Iterator)AnyTypeVarProtocolruntime_checkable_NestedSequence_T_coT)	covariantc                  H    e Zd ZdZd
dZddZddZddZddZddZ	ddZ
y	)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]]

    c                   t         )zImplement ``len(self)``.NotImplementedErrorselfs    N/home/dcms/DCMS/lib/python3.12/site-packages/numpy/_typing/_nested_sequence.py__len__z_NestedSequence.__len__<       !!    c                   t         )zImplement ``self[x]``.r   )r   indexs     r   __getitem__z_NestedSequence.__getitem__@   r   r   c                   t         )zImplement ``x in self``.r   )r   xs     r   __contains__z_NestedSequence.__contains__D   r   r   c                   t         )zImplement ``iter(self)``.r   r   s    r   __iter__z_NestedSequence.__iter__H   r   r   c                   t         )zImplement ``reversed(self)``.r   r   s    r   __reversed__z_NestedSequence.__reversed__L   r   r   c                   t         )z,Return the number of occurrences of `value`.r   r   values     r   countz_NestedSequence.countP   r   r   c                   t         )z"Return the first index of `value`.r   r!   s     r   r   z_NestedSequence.indexT   r   r   N)returnint)r   r&   r%   z_T_co | _NestedSequence[_T_co])r   objectr%   bool)r%   z(Iterator[_T_co | _NestedSequence[_T_co]])r"   r   r%   r&   )__name__
__module____qualname____doc__r   r   r   r   r   r#   r    r   r   r	   r	      s+    &P"""""""r   N)r,   
__future__r   collections.abcr   typingr   r   r   r   __all__r
   r	   r-   r   r   <module>r2      sP    9 " $  
4( C"huo C" C"r   