Hacked By AnonymousFox

Current Path : /opt/alt/python312/lib64/python3.12/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/multiprocessing/__pycache__/shared_memory.cpython-312.opt-2.pyc

�

�Q�fH���	ddgZddlmZddlZddlZddlZddlZddlZddlZejdk(rddl
Z
dZnddlZdZdd	l
mZejej zZd
ZerdZndZd
�ZGd�d�ZdZGd�d�Zy)�SharedMemory�
ShareableList�)�partialN�ntFT�)�resource_tracker�z/psm_�wnsm_c�r�	ttt�z
dz}ttj|�z}|S)N�)�_SHM_SAFE_NAME_LENGTH�len�_SHM_NAME_PREFIX�secrets�	token_hex)�nbytes�names  �D/opt/alt/python312/lib64/python3.12/multiprocessing/shared_memory.py�_make_filenamer(s4��<�#�c�*:�&;�;��
A�F��g�/�/��7�7�D��K�c��eZdZ	dZdZdZdZejZ	dZ
erdndZdd�Z
d�Zd�Zd	�Zed
��Zed��Zed��Zd
�Zd�Zy)rN���i�TFc��|dk\std��|r,ttjz|_|dk(rtd��|�(|jtj
zstd��t�r)|�E	t�}	tj||j|j��|_||_
nK|jrd|zn|}tj||j|j��|_||_
	|r"|r tj|j|�tj |j�}|j"}t%j$|j|�|_t-j.|jd��n�|�r"	|�
t�n|}t1j2t0j4t0j6t0j8|dz	d	z|d	z|�}	t1j:�}|t0j<k(rd|�Ktt>j@tjBt>j@�|t0j<��	t1jD|���t%j$d
||��|_t1jD|�||_
n�||_
t1jFt0jHd|�}	t1jJ|t0jHddd�}t1jD|�	t1jL|�}t1jN|�t%j$d
||��|_||_(tS|j&�|_*y#t$rY��+wxYw#t($r|j+��wxYw#t1jD|�wxYw#t1jD|�wxYw#t1jN|�wxYw)
Nrz!'size' must be a positive integerz4'size' must be a positive number different from zeroz&'name' can only be None if create=True)�mode�/�
shared_memory� l��r)�tagnameF)+�
ValueError�_O_CREX�os�O_RDWR�_flags�O_EXCL�
_USE_POSIXr�_posixshmem�shm_open�_mode�_fd�FileExistsError�_name�_prepend_leading_slash�	ftruncate�fstat�st_size�mmap�_mmap�OSError�unlinkr�register�_winapi�CreateFileMapping�INVALID_HANDLE_VALUE�NULL�PAGE_READWRITE�GetLastError�ERROR_ALREADY_EXISTS�errno�EEXIST�strerror�CloseHandle�OpenFileMapping�
FILE_MAP_READ�
MapViewOfFile�VirtualQuerySize�UnmapViewOfFile�_size�
memoryview�_buf)	�selfr�create�size�stats�	temp_name�h_map�last_error_code�p_bufs	         r�__init__zSharedMemory.__init__KsO���q�y��@�A�A��!�B�I�I�-�D�K��q�y� �!W�X�X��<����b�i�i� 7��E�F�F���|��)�+�D�!�#.�#7�#7� � �K�K�!%���$���"&�D�J��%)�%@�%@�s�T�z�d��&�/�/���K�K�������
"��
�
��d��L�L����4�0�������*���}�}��!�Y�Y�t�x�x��6��
�

�%�%�d�j�j�/�B���48�L�� 0�d�I�$�5�5��4�4�����.�.����z�1��z�)�!�
�E�3�*1�*>�*>�*@��*�g�.J�.J�J�#�/�&5�$)�L�L�$&�K�K����$=�$(�$+�$@�$@�	'"�!"�!)� �+�+�E�2�&*�Y�Y�r�4��%K��
��+�+�E�2�!*�D�J��"��
� �/�/��)�)�����
	/�#�1�1���-�-�����E��'�'��.�3�"�3�3�E�:�D��+�+�E�2�!�Y�Y�r�4��>��
���
��t�z�z�*��	��k+�!� �!��$�
����
��
��J �+�+�E�2��,�'�'��.���+�+�E�2�sJ�>1N�A4N!�9A4N?�N?�+'O�(O3�	N�N�!N<�?O�O0�3P
c�D�	|j�y#t$rYywxYw�N)�closer2�rHs r�__del__zSharedMemory.__del__�s"��	��J�J�L���	��	�s��	�c�L�|j|jd|jffS)NF)�	__class__rrJrTs r�
__reduce__zSharedMemory.__reduce__�s)���N�N��	�	���	�	�
�
�	
rc�h�|jj�d|j�d|j�d�S)N�(z, size=�))rW�__name__rrJrTs r�__repr__zSharedMemory.__repr__�s.���.�.�)�)�*�!�D�I�I�=���	�	�{�!�L�Lrc��	|jSrR)rGrTs r�bufzSharedMemory.buf�s��>��y�y�rc��	|j}tr6|jr*|jjd�r|jdd}|S)Nrr)r+r%r,�
startswith)rH�
reported_names  rrzSharedMemory.name�s@��>��
�
�
��$�5�5��z�z�$�$�S�)� $�
�
�1�2��
��rc��	|jSrR)rErTs rrJzSharedMemory.size�s����z�z�rc�4�	|j�!|jj�d|_|j�!|jj�d|_tr7|j
dk\r't
j|j
�d|_yyy)Nrr)rG�releaser1rSr%r)r!rTs rrSzSharedMemory.close�st��	0��9�9� ��I�I�����D�I��:�:�!��J�J�����D�J��$�(�(�a�-��H�H�T�X�X���D�H�(�:rc��	trM|jr@tj|j�t	j
|jd�yyy)Nr)r%r+r&�
shm_unlinkr�
unregisterrTs rr3zSharedMemory.unlink�s?��	'�
�$�*�*��"�"�4�:�:�.��'�'��
�
�O�D�%�:r)NFr)r\�
__module__�__qualname__r+r)r1rGr!r"r#r(r%r,rPrUrXr]�propertyr_rrJrSr3�rrrr2s���
B� 
�E�
�C��E��D�
�Y�Y�F��E�%/�T�U��l+�\�
�M��������������Er�utf8c�F�eZdZ	edededededdjdiZ	dZ
d�d	�d
�d�d�Zed
��Z
d!dd�d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zed��Zed��Zed��Zed��Zed��Zed��Zed��Zd�Zd �Z e!e"jF�Z$y)"r�q�dzxxxxxxx?z%dsNzxxxxxx?x�c��|SrRrl��values r�<lambda>zShareableList.<lambda>s��rc�J�|jd�jt�S�N�)�rstrip�decode�	_encodingrss rruzShareableList.<lambda>s�����g�.�5�5�i�@rc�$�|jd�Srw)ryrss rruzShareableList.<lambda>s
�����g�.rc��yrRrl)�_values rruzShareableList.<lambda>s��$r)rrr�c��	t|ttdjf�syt|t�ryt|t�ryy)Nrrrr)�
isinstance�str�bytesrWrss r�_extract_recreation_codez&ShareableList._extract_recreation_codes>��	2��%�#�u�d�n�n�!=�>��
��s�
#��
��u�
%��r�rc��	�|�|��d|xsd}|D�cgc]r}t|ttf�s|jt	|�nA|jt	|�|j
t
|�|j
zdzzfz��t}}t
|�|_d}dg|_|D]B}||ddk7r|j
n
t|dd�z
}|jj|��D|D�cgc]}|j|���}}tjd|jzdj|�z|j z|j"z�}t%|d|�	�|_nt%|�|_|��,t(�	tj*d|jz|j&j,d|jg|j���tj*dj�|j&j,|j.g�	fd
�|D����tj*|j |j&j,|j0g�	fd�|D����tj*|j"|j&j,|j2g���yt
|�|_t5tj6|j|j&j,d��|_ycc}wcc}w)
Nrlrrr�sro�T)rIrJc3�d�K�|]'}t|t�r|j��n|���)y�wrR)r�r��encode��.0�v�_encs  �r�	<genexpr>z)ShareableList.__init__.<locals>.<genexpr>Zs(�����P�x�!�J�q�#�$6�!�(�(�4�.�A�=�x�s�-0c3�@�K�|]}|j�����y�wrR)r�r�s  �rr�z)ShareableList.__init__.<locals>.<genexpr>`s�����3�(�Q�!�(�(�4�.�(���rq)r�r�r��_types_mapping�type�
_alignmentr�	_list_len�_allocated_offsets�int�appendr��struct�calcsize�_format_size_metainfo�join�_format_packing_metainfo�_format_back_transform_codesr�shmr{�	pack_intor_�_offset_data_start�_offset_packing_formats�_offset_back_transform_codes�list�unpack_from)
rH�sequencer�item�_formats�offset�fmt�_recreation_codes�requested_sizer�s
         @rrPzShareableList.__init__*s�����<�8�/��~�2�H�%�
�%�D�	&�d�S�%�L�9��#�#�D��J�/��,�,�T�$�Z�8����3�t�9����+G�!�+K�L�<���
%�

��!��]�D�N��F�()�c�D�#����S��W��^�$�/�/��S��"�X��N���'�'�.�.�v�6� �AI�!�@H���-�-�d�3��
�!�$�_�_��d�0�0�0�����!�"��-�-�.��1�1�2��N�$�D��N�K�D�H�#�D�)�D�H����D�����d�0�0�0����������	
�
�)�)�
�
�������!�������'�'�
�Q�x�P�	
�
����-�-�������,�,�
�4�(�3�	
�
����1�1�������1�1�
�$�	
�!��Y�D�N�&*��"�"��.�.��H�H�L�L���'�D�#��}��$!s�A7K>�/Lc�N�	|dk\r|n||jz}||jk\s|jdkrtd��tjd|jj
|j|dzz�d}|jd�}|jt�}|S)Nr� Requested position out of range.�8srqrx)
r��
IndexErrorr�r�r�r_r�ryrzr{)rH�positionr�r��
fmt_as_strs     r�_get_packing_formatz!ShareableList._get_packing_formatss���H�'�1�}�8�(�T�^�^�2K������&�D�N�N�Q�,>��?�@�@������H�H�L�L��(�(�8�a�<�7�
��	

��
�h�h�w����Z�Z�	�*�
��rc���	||jk\s|jdkrtd��tjd|jj
|j|z�d}|j|}|S)Nrr��b)r�r�r�r�r�r_r��_back_transforms_mapping)rHr��transform_code�transform_functions    r�_get_back_transformz!ShareableList._get_back_transform�sw��C�����&�D�N�N�Q�,>��?�@�@��+�+���H�H�L�L��-�-��8�
��	
��
"�:�:�>�J��!�!rc��	||jk\s|jdkrtd��tjd|jj
|j|dzz|jt��|j|�}tjd|jj
|j|z|�y)Nrr�r�rqr�)r�r�r�r�r�r_r�r�r{r�r�)rHr�r�rtr�s     r�!_set_packing_format_and_transformz/ShareableList._set_packing_format_and_transform�s���	?�
����&�D�N�N�Q�,>��?�@�@������H�H�L�L��(�(�8�a�<�7����i�(�		
��6�6�u�=�������H�H�L�L��-�-��8��		
rc�F�|dk\r|n||jz}	|j|j|z}tj|j|�|jj|�\}|j|�}||�}|S#t$rtd��wxYw)Nrzindex out of range)
r�r�r�r�r�r�r�r_r�r�)rHr�r�r��back_transforms     r�__getitem__zShareableList.__getitem__�s���'�1�}�8�(�T�^�^�2K��	3��,�,�t�/F�/F�x�/P�P�F��%�%��(�(��2��������D�Q��1�1�(�;���1������
�	3��1�2�2�	3�s�AB�B c��|dk\r|n||jz}	|j|}|j|z}|j|�}t|ttf�s|jt|�}|}nw|j|dz|z
}t|t�r|jt�n|}t|�|kDrtd��|ddk(r|}n|jt|fz}|j|||�tj ||j"j$||�y#t$rt	d��wxYw)Nrzassignment index out of rangerz(bytes/str item exceeds available storagerr�)r�r�r�r�r�r�r�r�r�r�r�r{rrr�r�r�r�r_)	rHr�rt�item_offsetr��current_format�
new_format�
encoded_value�allocated_lengths	         r�__setitem__zShareableList.__setitem__�sO��'�1�}�8�(�T�^�^�2K��	>��1�1�(�;�K��,�,�{�:�F�!�5�5�h�?�N��%�#�u��.��,�,�T�%�[�9�J�!�M�#�6�6�x�!�|�D�{�R��!+�5�#� 6�#�\�\�)�4�<A�
��=�!�$4�4� �!K�L�L��b�!�S�(�+�
�!�0�0��5�$�9��
�	
�.�.����	
�
	����T�X�X�\�\�6�=�I��3�	>��<�=�=�	>�s�/D/�/Ec�\�t|j|jj��dfS)Nr�rl)rrWr�rrTs rrXzShareableList.__reduce__�s ���t�~�~�D�H�H�M�M�:�B�>�>rc�^�tjd|jjd�dS)Nror)r�r�r�r_rTs r�__len__zShareableList.__len__�s$���!�!�#�t�x�x�|�|�Q�7��:�:rc�z�|jj�dt|��d|jj�d�S)NrZz, name=r[)rWr\r�r�rrTs rr]zShareableList.__repr__�s3���.�.�)�)�*�!�D��J�<�w�t�x�x�}�}�>O�q�Q�Qrc�`��	dj�fd�t�j�D��S)Nr�c3�@�K�|]}�j|����y�wrR)r�)r��irHs  �rr�z'ShareableList.format.<locals>.<genexpr>�s!�����
�1F�A�D�$�$�Q�'�1F�r�)r��ranger�rTs`r�formatzShareableList.format�s-���G��w�w�
�16�t�~�~�1F�
�
�	
rc�(�	d|jdzzS)Nror�r�rTs rr�z#ShareableList._format_size_metainfo�s��H��d�n�n�q�(�)�)rc�"�	d|jzS)Nr�r�rTs rr�z&ShareableList._format_packing_metainfo�s��H��d�n�n�$�$rc�"�	d|jzS)Nr�r�rTs rr�z*ShareableList._format_back_transform_codes�s��H��T�^�^�#�#rc�&�|jdzdzS)Nrrqr�rTs rr�z ShareableList._offset_data_start�s������"�a�'�'rc�:�|j|jdzS)Nr)r�r�rTs rr�z%ShareableList._offset_packing_formats�s���&�&��)@�)@��)D�D�Drc�:�|j|jdzzS)Nrq)r�r�rTs rr�z*ShareableList._offset_back_transform_codess���+�+�d�n�n�q�.@�@�@rc�.��	t�fd�|D��S)Nc3�(�K�|]	}�|k(���y�wrRrl)r��entryrts  �rr�z&ShareableList.count.<locals>.<genexpr>
s�����4�t�e�5�E�>�t�s�)�sum)rHrts `r�countzShareableList.counts���M��4�t�4�4�4rc�X�	t|�D]\}}||k(s�|cSt|�d���)Nz not in this container)�	enumerater)rHrtr�r�s    r�indexzShareableList.indexs<��	:� )���O�H�e���~��� /���y�(>�?�@�@rrR)%r\rirjr��float�boolr�r�rWr�r�r��staticmethodr�rPr�r�r�r�r�rXr�r]rkr�r�r�r�r�r�r�r�r��classmethod�types�GenericAlias�__class_getitem__rlrrrr�sI��*�&	�S�
�s��j��U�
�u����
�
�N��J��@�.��	 ������G�d�G�R� 
"�
�,�"J�B?�;�R��
��
��*��*��%��%��$��$��(��(�
�E��E��A��A�5�
A�$�E�$6�$6�7�r)�__all__�	functoolsrr0r!r<r�rr�rr5r%r&r�r�O_CREATr$r r
rrrr{rrlrr�<module>r�s����
�O�
-����	��
����7�7�d�?���J���J��
�*�*�r�y�y�
 ����������BE�BE�J
�	�]8�]8r

Hacked By AnonymousFox1.0, Coded By AnonymousFox