o
    %g0
                     @  sj   d Z ddlmZ ddlmZmZmZmZmZ erddl	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TypeVarProtocolruntime_checkableTYPE_CHECKING)Iterator_NestedSequence_T_coT)	covariantc                   @  sV   e Zd ZdZdddZddd	ZdddZdddZdddZdddZ	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]]

    returnintc                C     t )zImplement ``len(self)``.NotImplementedErrorself r   ]/root/parts/websockify/install/lib/python3.10/site-packages/numpy/_typing/_nested_sequence.py__len__?      z_NestedSequence.__len__index_T_co | _NestedSequence[_T_co]c                C  r   )zImplement ``self[x]``.r   )r   r   r   r   r   __getitem__C   r   z_NestedSequence.__getitem__xobjectboolc                C  r   )zImplement ``x in self``.r   )r   r   r   r   r   __contains__G   r   z_NestedSequence.__contains__(Iterator[_T_co | _NestedSequence[_T_co]]c                C  r   )zImplement ``iter(self)``.r   r   r   r   r   __iter__K   r   z_NestedSequence.__iter__c                C  r   )zImplement ``reversed(self)``.r   r   r   r   r   __reversed__O   r   z_NestedSequence.__reversed__valuer   c                C  r   )z,Return the number of occurrences of `value`.r   r   r!   r   r   r   countS   r   z_NestedSequence.countc                C  r   )z"Return the first index of `value`.r   r"   r   r   r   r   W   r   z_NestedSequence.indexN)r   r   )r   r   r   r   )r   r   r   r   )r   r   )r!   r   r   r   )__name__
__module____qualname____doc__r   r   r   r   r    r#   r   r   r   r   r   r	      s    
(




N)r'   
__future__r   typingr   r   r   r   r   collections.abcr   __all__r
   r	   r   r   r   r   <module>   s    