� c��j�����dZgd�ZiZdd�Zd�Zd�Zeeee�d�Zeee e z�e�d�Z dZ ee j�Zd �Zd �Zd �Zd �ZiZiZiZd �Zd�Zd�Zy)z�Helper to provide extensibility for pickle. This is only useful to add pickle support for extension types defined in C, not for instances of user-defined classes. )�pickle� constructor� add_extension�remove_extension�clear_extension_cacheNc�^�t|�s td��|t|<|� t|�yy)Nz$reduction functions must be callable)�callable� TypeError�dispatch_tabler)�ob_type�pickle_function�constructor_obs � /usr/lib64/python3.12/copyreg.pyrr s5�� �O� $��>�?�?�-�N�7���!��N�#�"�c�0�t|�s td��y)Nzconstructors must be callable)rr )�objects rrrs�� �F� ��7�8�8� rc�>�t|j|jffS�N)�complex�real�imag)�cs r�pickle_complexrs�� �Q�V�V�Q�V�V�$� $�$rc�Z�ddl}ddl}|j|j|jffS)N�)� functools�operator�reduce�or_�__args__)�objrrs r� pickle_unionr!!s#��� � � �h�l�l�C�L�L�9� 9�9rc���|turtj|�}|S|j||�}|jtjk7r|j||�|Sr)r�__new__�__init__)�cls�base�stater s r�_reconstructorr()sS�� �v�~��n�n�S�!�� �J��l�l�3��&�� �=�=�F�O�O� +� �M�M�#�u� %� �Jric���|j}|jD]P}t|d�r|jtzsn5|j }t |t�s�A|j|us�Pnt}|turd}n%||urtd|j�d���||�}|||f} |j}t|�jtjurt|dd�r td��|�}|r t"||fSt"|fS#t$rKt|dd�rtd|j�d|���d� |j }n#t$rd}YnwxYwY�fwxYw)N� __flags__zcannot pickle z object� __slots__zNa class that defines __slots__ without defining __getstate__ cannot be pickledzf object: a class that defines __slots__ without defining __getstate__ cannot be pickled with protocol )� __class__�__mro__�hasattrr*� _HEAPTYPEr#� isinstance� _new_type�__self__rr �__name__� __getstate__�type�getattr�AttributeError�__dict__r() �self�protor%r&�newr'�args�getstate�dicts r� _reduce_exr?7sv�� �.�.�C�� � �� �4�� %�d�n�n�y�.H� ��l�l�� �c�9� %�#�,�,�$�*>� � ��� �v�~��� �3�;��n�S�\�\�,<�G�D�E� E��T� �� ��u� �D���$�$�� ��J� #� #�v�':�':� :� �D�+�t� ,��F�G� G��z�� ��t�T�)�)��t�#�#��' � � �4��d� +��n�S�\�\�,<�=-�.3�G�5�6�<@� @� ��=�=�D��� ��D� �� �s6�( D � 2E�> E � E� E�E�E�E�Ec�(�|j|g|���Sr�r#)r%r<s r� __newobj__rBbs�� �3�;�;�s� "�T� "�"rc�.�|j|g|��i|��S)zUsed by pickle protocol 4, instead of __newobj__ to allow classes with keyword-only arguments to be pickled correctly. rA)r%r<�kwargss r� __newobj_ex__rEes�� �3�;�;�s� ,�T� ,�V� ,�,rc��|jjd�}|�|Sg}t|d�sn�|jD]�}d|jvs�|jd}t |t �r|f}|D]�}|dvr�|j d�rW|jd�sF|jjd�}|r|jd|�|����^|j|��p|j|����� ||_ |S#Y|SxYw)a�Return a list of slot names for a given class. This needs to find slots defined by the class and its bases, so we can't simply return the __slots__ attribute. We must walk down the Method Resolution Order and concatenate the __slots__ of each class found there. (This assumes classes don't modify their __slots__ attribute to misrepresent their slots after the class is defined.) � __slotnames__r+)r8� __weakref__�__�_) r8�getr.r-r0�str� startswith�endswithr3�lstrip�appendrG)r%�namesr�slots�name�strippeds r� _slotnamesrUks�� �L�L� � �_� -�E� ��� � �E� �3� � $� ����A��a�j�j�(�� � �;�/���e�S�)�"�H�E�!�D��:�:� �����.�t�}�}�T�7J�#$�:�:�#4�#4�S�#9��#�!�L�L�H�d�)C�D�!�L�L��.�� � �T�*�"� �* �!��� �L�� � � �L�s �7D�Dc�l�t|�}d|cxkrdkstd��td��||f}tj|�|k(rtj|�|k(ry|tvrtd|�dt|����|tvrtd|�dt|����|t|<|t|<y) zRegister an extension code.�i���zcode out of rangeN�key z! is already registered with code zcode z is already in use for key )�int� ValueError�_extension_registryrK�_inverted_registry��modulerS�code�keys rrr�s��� �t�9�D� �� "� � "��,�-�-� #��,�-�-� �4�.�C�����$��,����t�$��+�� �!�!���2�3�7�9�:� :� �!�!��� 2�4� 8�:�;� ;�#����"��t�rc���||f}tj|�|k7stj|�|k7rtd|�d|����t|=t|=|tvrt|=yy)z0Unregister an extension code. For testing only.rXz is not registered with code N)r[rKr\rZ�_extension_cacher]s rrr�sn�� �4�.�C�����$��,����t�$��+���t�%�&� &��C� ��4� � ��� �T� "� rc�,�tj�yr)rb�clear�rrrr�s�����rr)�__doc__�__all__r rrrrr!r5rYrLr(r/r#r1r?rBrErUr[r\rbrrrrerr�rhs����  I����$�9� %��w���(�:��t�C�#�I�� �%�� � � ���� � �'$�V#�-� 1�x������#�$ #�r