관리-도구
편집 파일: ordered_set.cpython-311.pyc
� �܋f; � � � d Z ddlZddlmZ ddlmZmZ n# e$ r ddlmZmZ Y nw xY w e d� � Z dZd� Z G d� dee� � Z dS ) z� An OrderedSet is a custom MutableSet that remembers its order, so that every entry has an index that can be looked up. Based on a recipe originally posted to ActiveState Recipes by Raymond Hettiger, and released under the MIT license. � N)�deque)� MutableSet�Sequencez3.1c �z � t | d� � o+t | t � � ot | t � � S )a Are we being asked to look up a list of things, instead of a single thing? We check for the `__iter__` attribute so that this can cover types that don't have to be known by this module, such as NumPy arrays. Strings, however, should be considered as atomic values to look up, not iterables. The same goes for tuples, since they are immutable and therefore valid entries. We don't need to check for the Python 2 `unicode` type, because it doesn't have an `__iter__` attribute anyway. �__iter__)�hasattr� isinstance�str�tuple)�objs �U/opt/cloudlinux/venv/lib64/python3.11/site-packages/setuptools/_vendor/ordered_set.py�is_iterabler s@ � � ��Z� � � '��3��$�$�$� '��3��&�&�&�� c �� � e Zd ZdZdd�Zd� Zd� Zd� Zd� Zd� Z d � Z d � ZeZd� Z d� ZeZeZd � Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z!d� Z"dS ) � OrderedSetz� An OrderedSet is a custom MutableSet that remembers its order, so that every entry has an index that can be looked up. Example: >>> OrderedSet([1, 1, 2, 3, 2]) OrderedSet([1, 2, 3]) Nc �4 � g | _ i | _ |�| |z } d S d S �N)�items�map)�self�iterables r �__init__zOrderedSet.__init__4 s, � ��� �������H��D�D�D� �r c �* � t | j � � S )z� Returns the number of unique elements in the ordered set Example: >>> len(OrderedSet([])) 0 >>> len(OrderedSet([1, 2])) 2 )�lenr �r s r �__len__zOrderedSet.__len__: s � � �4�:���r c � � � t |t � � r|t k r� � � � S t |� � r� fd�|D � � S t |d� � st |t � � r9� j | }t |t � � r� � |� � S |S t d|z � � �)aQ Get the item at a given index. If `index` is a slice, you will get back that slice of items, as a new OrderedSet. If `index` is a list or a similar iterable, you'll get a list of items corresponding to those indices. This is similar to NumPy's "fancy indexing". The result is not an OrderedSet because you may ask for duplicate indices, and the number of elements returned should be the number of elements asked for. Example: >>> oset = OrderedSet([1, 2, 3]) >>> oset[1] 2 c �* �� g | ]}�j | ��S � )r )�.0�ir s �r � <listcomp>z*OrderedSet.__getitem__.<locals>.<listcomp>[ s �� �1�1�1�a�D�J�q�M�1�1�1r � __index__z+Don't know how to index an OrderedSet by %r) r �slice� SLICE_ALL�copyr r r �list� __class__� TypeError)r �index�results ` r �__getitem__zOrderedSet.__getitem__F s� �� �$ �e�U�#�#� S���(:�(:��9�9�;�;�� �� � � S�1�1�1�1�5�1�1�1�1� �U�K� (� (� S�J�u�e�,D�,D� S��Z��&�F��&�$�'�'� ��~�~�f�-�-�-�� ��I�E�Q�R�R�Rr c �, � | � | � � S )z� Return a shallow copy of this object. Example: >>> this = OrderedSet([1, 2, 3]) >>> other = this.copy() >>> this == other True >>> this is other False )r( r s r r&