File: D:/Python311/Lib/test/__pycache__/test_slice.cpython-311.opt-1.pyc
�
��Vc�! � �� � d dl Z d dlZd dlZd dlZd dlZd dlmZmZ d dlm Z d� Z
d� Z G d� de� � Z
G d� d ej � � Zed
k r ej � � dS dS )� N)�loads�dumps)�supportc �h � t | d� � rt j | � � S t d� � �)z�
Helper function to convert a slice argument to an integer, and raise
TypeError with a suitable message on failure.
� __index__zBslice indices must be integers or None or have an __index__ method)�hasattr�operator�index� TypeError)�args �#D:\Python311\Lib\test\test_slice.py�evaluate_slice_indexr
s= � � �s�K� � � 0��~�c�"�"�"��
/�0� 0� 0� c �, � t j |� � }| j �dnt | j � � }|dk rt d� � �|dk rt d� � �|dk rdnd}|dk r|dz
n|}| j �|dk r|n|}n=t | j � � }|dk rt
||z |� � nt ||� � }| j �|dk r|n|}n=t | j � � }|dk rt
||z |� � nt ||� � }|||fS )zA
Reference implementation for the slice.indices method.
N� r zlength should not be negativezslice step cannot be zero���) r r
�stepr �
ValueError�start�max�min�stop)�slice�lengthr �lower�upperr r s r
�
slice_indicesr sS � � �^�F�
#�
#�F��
�H�1�1�(<�U�Z�(H�(H�D� ��z� :��8�9�9�9��q�y� 6��4�5�5�5� ��(�!�B�B��E���(�.�F�Q�J�J��E�
�{� O����,���u���$�U�[�1�1��.3�a�i�N��E�F�N�E�*�*�*�S���=N�=N��
�z� K��q��+�u�u�e���#�E�J�/�/��,0�1�H�J�s�4�&�=�%�(�(�(�#�d�E�:J�:J���$���r c � � e Zd Zd� Zd� ZdS )�MyIndexablec � � || _ d S �N��value)�selfr# s r
�__init__zMyIndexable.__init__A s
� ���
�
�
r c � � | j S r! r"