PATH:
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
numpy
/
_typing
/
__pycache__
/
Editing: _nested_sequence.cpython-311.pyc
� � h� � � � d Z ddlmZ ddlmZ ddlmZmZmZm Z m Z dgZ edd�� � Ze G d � de e � � � � Z d S )z3A module containing the `_NestedSequence` protocol.� )�annotations)�Iterator)�Any�overload�TypeVar�Protocol�runtime_checkable�_NestedSequence�_T_coT)� covariantc �x � e Zd ZdZdd�Zedd�� � Zedd �� � Zd� Zdd�Zdd�Zdd�Z dd�Z dd�ZdS )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 � � t �)zImplement ``len(self)``.��NotImplementedError��selfs �U/opt/cloudlinux/venv/lib64/python3.11/site-packages/numpy/_typing/_nested_sequence.py�__len__z_NestedSequence.__len__= � � �!�!� �index�_T_co | _NestedSequence[_T_co]c � � d S �N� �r r s r �__getitem__z_NestedSequence.__getitem__A s � �LO�Cr �slice�_NestedSequence[_T_co]c � � d S r r r s r r z_NestedSequence.__getitem__C s � �FI�cr c � � t �)zImplement ``self[x]``.r r s r r z_NestedSequence.__getitem__F r r �x�object�boolc � � t �)zImplement ``x in self``.r )r r$ s r �__contains__z_NestedSequence.__contains__J r r �(Iterator[_T_co | _NestedSequence[_T_co]]c � � t �)zImplement ``iter(self)``.r r s r �__iter__z_NestedSequence.__iter__N r r c � � t �)zImplement ``reversed(self)``.r r s r �__reversed__z_NestedSequence.__reversed__R r r �valuer c � � t �)z,Return the number of occurrences of `value`.r �r r. s r �countz_NestedSequence.countV r r c � � t �)z"Return the first index of `value`.r r0 s r r z_NestedSequence.indexZ r r N)r r )r r r r )r r r r! )r$ r% r r&