Viewing File: /opt/hc_python/lib/python3.12/site-packages/aenum/__pycache__/_constant.cpython-312.pyc
�
^��g� � �� � d dl � ddgZdZ G d� de� Z G d� de� Z eej de f� d e
� �
� Zedd�� Zed� � Z
ed
� � Z ede fej � � ZeZ[y)� )�*�
NamedConstant�ConstantNc �, � � e Zd ZdZ� fd�Z� fd�Z� xZS )�NamedConstantDictz�Track constant order and ensure names are not reused.
NamedConstantMeta will use the names found in self._names as the
Constant names.
c �8 �� t t | � � g | _ y �N)�superr �__init__�_names)�self� __class__s ��>/opt/hc_python/lib/python3.12/site-packages/aenum/_constant.pyr zNamedConstantDict.__init__ s �� �
���/�1���� c �L �� t |� rt d|�d�� �t |� rni|| j v rt d|��� �t |t � st |� s2|| v rt |�d| | ��� �| j j |� t t | �/ ||� y)z�Changes anything not dundered or not a constant descriptor.
If an constant name is used twice, an error is raised; duplicate
values are not checked for.
Single underscore (sunder) names are reserved.
z_sunder_ names, such as z+, are reserved for future NamedConstant usezattempt to reuse name: z already defined as: N)� is_sunder�
ValueError� is_dunderr � TypeError�
isinstance�constant�
is_descriptor�appendr
r �__setitem__)r
�key�valuer s �r r zNamedConstantDict.__setitem__ s� �� � �S�>�����
� �s�^��
�D�K�K�
��3�A�B�B�
��x�
(�
�e�0D��d�{��s�D��I� N�O�O��K�K���s�#�
���2�3��>r )�__name__�
__module__�__qualname__�__doc__r r �
__classcell__�r s @r r r s �� ��
�?� ?r r c �b � � e Zd ZdZed� � Z� fd�Zd� Z� fd�Zd� Z d� Z
d� ZeZ� fd �Z
� xZS )
�NamedConstantMetaz>
Block attempts to reassign NamedConstant attributes.
c � � t � S r )r )�metacls�cls�bases�kwdss r �__prepare__zNamedConstantMeta.__prepare__4 s � � �"�"r c �� �� t |� t u r)|}t � }|j � D ]
\ }}|||<