o
    :‘ði0
  ã                   @  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    