
    SBg0
                        S r SSKJr  SSKJrJrJrJrJr  \(       a  SSK	J
r
  S/r\" SSS9r\ " S	 S\\   5      5       rg
)z3A module containing the `_NestedSequence` protocol.    )annotations)AnyTypeVarProtocolruntime_checkableTYPE_CHECKING)Iterator_NestedSequence_T_coT)	covariantc                  ^    \ rS rSrSrSS jrSS jrSS jrSS jrSS jr	SS jr
SS	 jrS
rg)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                   [         e)zImplement ``len(self)``.NotImplementedErrorselfs    @/usr/lib/python3/dist-packages/numpy/_typing/_nested_sequence.py__len___NestedSequence.__len__?       !!    c                   [         e)zImplement ``self[x]``.r   )r   indexs     r   __getitem___NestedSequence.__getitem__C   r   r   c                   [         e)zImplement ``x in self``.r   )r   xs     r   __contains___NestedSequence.__contains__G   r   r   c                   [         e)zImplement ``iter(self)``.r   r   s    r   __iter___NestedSequence.__iter__K   r   r   c                   [         e)zImplement ``reversed(self)``.r   r   s    r   __reversed___NestedSequence.__reversed__O   r   r   c                   [         e)z,Return the number of occurrences of `value`.r   r   values     r   count_NestedSequence.countS   r   r   c                   [         e)z"Return the first index of `value`.r   r(   s     r   r   _NestedSequence.indexW   r   r    N)returnint)r   r0   r/   z_T_co | _NestedSequence[_T_co])r   objectr/   bool)r/   z(Iterator[_T_co | _NestedSequence[_T_co]])r)   r   r/   r0   )__name__
__module____qualname____firstlineno____doc__r   r   r   r"   r%   r*   r   __static_attributes__r.   r   r   r
   r
      s+    &P"""""""r   N)r7   
__future__r   typingr   r   r   r   r   collections.abcr	   __all__r   r
   r.   r   r   <module>r=      sS    9 "  (
4( C"huo C" C"r   