%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.12/multiprocessing/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.12/multiprocessing/__pycache__/context.cpython-312.pyc

�

���f�-����ddlZddlZddlZddlmZddlmZdZGd�de�ZGd�d	e�Z	Gd
�de�Z
Gd�d
e�ZGd�de�Z
Gd�dej�ZGd�de
�Zej"dk7r�Gd�dej�ZGd�dej�ZGd�dej�ZGd�de
�ZGd�de
�ZGd�d e
�Ze�e�e�d!�Zej"d"k(reed#�Zn@eed$�Zn4Gd%�dej�ZGd&�de
�Zd#e�iZeed#�Zd'�Zej6�Zd(�Zd)�Zd*�Zy)+�N�)�process)�	reduction�c��eZdZy)�ProcessErrorN��__name__�
__module__�__qualname__r��./usr/lib/python3.12/multiprocessing/context.pyrr���r
rc��eZdZy)�BufferTooShortNr	rr
rrrrr
rc��eZdZy)�TimeoutErrorNr	rr
rrrrr
rc��eZdZy)�AuthenticationErrorNr	rr
rrrrr
rc��eZdZeZeZeZeZeej�Z	eej�Z
eej�Zd�Zd�Z
d"d�Zd�Zd�Zd#d�Zd$d	�Zd$d
�Zd�Zd%d�Zd&d
�Zd&d�Zd�Z		d'd�Zd�Zd�Zdd�d�Zdd�d�Zd�Zd�Zd#d�Z d�Z!d�Z"d�Z#d#d�Z$d(d�Z%d(d�Z&e'd��Z(e(jRd ��Z(d!�Z*y))�BaseContextc�H�tj�}|�td��|S)z(Returns the number of CPUs in the systemzcannot determine number of cpus)�os�	cpu_count�NotImplementedError)�self�nums  rrzBaseContext.cpu_count)s#���l�l�n���;�%�&G�H�H��Jr
c�`�ddlm}||j���}|j�|S)z�Returns a manager associated with a running server process

        The managers methods such as `Lock()`, `Condition()` and `Queue()`
        can be used to create shared objects.
        r)�SyncManager��ctx)�managersr�get_context�start)rr�ms   r�ManagerzBaseContext.Manager1s(��	*��D�,�,�.�/��	���	��r
Tc��ddlm}||�S)z1Returns two connection object connected by a piper)�Pipe)�
connectionr()r�duplexr(s   rr(zBaseContext.Pipe<s��$��F�|�r
c�<�ddlm}||j���S)z#Returns a non-recursive lock objectr)�Lockr )�synchronizer,r#)rr,s  rr,zBaseContext.LockAs��%���(�(�*�+�+r
c�<�ddlm}||j���S)zReturns a recursive lock objectr)�RLockr )r-r/r#)rr/s  rr/zBaseContext.RLockF���&���)�)�+�,�,r
Nc�>�ddlm}|||j���S)zReturns a condition objectr)�	Conditionr )r-r2r#)r�lockr2s   rr2zBaseContext.ConditionKs��*���4�#3�#3�#5�6�6r
c�>�ddlm}|||j���S)zReturns a semaphore objectr)�	Semaphorer )r-r5r#)r�valuer5s   rr5zBaseContext.SemaphorePs��*���D�$4�$4�$6�7�7r
c�>�ddlm}|||j���S)z"Returns a bounded semaphore objectr)�BoundedSemaphorer )r-r8r#)rr6r8s   rr8zBaseContext.BoundedSemaphoreUs��1���4�+;�+;�+=�>�>r
c�<�ddlm}||j���S)zReturns an event objectr)�Eventr )r-r:r#)rr:s  rr:zBaseContext.EventZr0r
c�B�ddlm}|||||j���S)zReturns a barrier objectr)�Barrierr )r-r<r#)r�parties�action�timeoutr<s     rr<zBaseContext.Barrier_s��(��w���T�5E�5E�5G�H�Hr
c�>�ddlm}|||j���S)�Returns a queue objectr)�Queuer )�queuesrBr#)r�maxsizerBs   rrBzBaseContext.Queueds��!��W�$�"2�"2�"4�5�5r
c�>�ddlm}|||j���S)rAr)�
JoinableQueuer )rCrFr#)rrDrFs   rrFzBaseContext.JoinableQueueis��)��W�$�*:�*:�*<�=�=r
c�<�ddlm}||j���S)rAr)�SimpleQueuer )rCrHr#)rrHs  rrHzBaseContext.SimpleQueuens��'��t�/�/�1�2�2r
c�D�ddlm}||||||j���S)zReturns a process pool objectr)�Pool)�context)�poolrJr#)r�	processes�initializer�initargs�maxtasksperchildrJs      rrJzBaseContext.Poolss)��	��I�{�H�6F� �,�,�.�0�	0r
c� �ddlm}||g|���S)zReturns a shared objectr)�RawValue)�sharedctypesrR)r�typecode_or_type�argsrRs    rrRzBaseContext.RawValuezs��*��(�0�4�0�0r
c� �ddlm}|||�S)zReturns a shared arrayr)�RawArray)rSrW)rrT�size_or_initializerrWs    rrWzBaseContext.RawArrays��*��(�*=�>�>r
)r3c�D�ddlm}||g|��||j�d��S)z$Returns a synchronized shared objectr)�Value�r3r!)rSrZr#)rrTr3rUrZs     rrZzBaseContext.Value�s/��'��%�-��-�4��)�)�+�-�	-r
c�B�ddlm}|||||j���S)z#Returns a synchronized shared arrayr)�Arrayr[)rSr]r#)rrTrXr3r]s     rr]zBaseContext.Array�s&��'��%�':���)�)�+�-�	-r
c�j�tjdk(r ttdd�rddlm}|�yyy)z�Check whether this is a fake forked process in a frozen executable.
        If so then run code specified by commandline and exit.
        �win32�frozenFr)�freeze_supportN)�sys�platform�getattr�spawnra)rras  rrazBaseContext.freeze_support�s-���<�<�7�"�w�s�H�e�'D�-���(E�"r
c��ddlm}|�S)zZReturn package logger -- if it does not already exist then
        it is created.
        r)�
get_logger)�utilrg)rrgs  rrgzBaseContext.get_logger�s��	%��|�r
c��ddlm}||�S)z8Turn on logging and add a handler which prints to stderrr)�
log_to_stderr)rhrj)r�levelrjs   rrjzBaseContext.log_to_stderr�s��'��U�#�#r
c��ddlm}y)zVInstall support for sending connections and sockets
        between processes
        r)r)N)�r))rr)s  r�allow_connection_picklingz%BaseContext.allow_connection_pickling�s��	!r
c� �ddlm}||�y)z�Sets the path to a python.exe or pythonw.exe binary used to run
        child processes instead of sys.executable when using the 'spawn'
        start method.  Useful for people embedding Python.
        r)�set_executableN)rerp)r�
executablerps   rrpzBaseContext.set_executable�s��
	*��z�"r
c� �ddlm}||�y)zkSet list of module names to try to load in forkserver process.
        This is really just a hint.
        r)�set_forkserver_preloadN)�
forkserverrs)r�module_namesrss   rrsz"BaseContext.set_forkserver_preload�s��	7��|�,r
c�z�|�|S	t|}|j�|S#t$rtd|z�d�wxYw)Nzcannot find context for %r)�_concrete_contexts�KeyError�
ValueError�_check_available)r�methodr!s   rr#zBaseContext.get_context�sU���>��K�	N�$�V�,�C�	�����
���	N��9�F�B�C��M�	N�s�	!�:c��|jS�N)�_name�r�
allow_nones  r�get_start_methodzBaseContext.get_start_method�s���z�z�r
c��td��)Nz+cannot set start method of concrete context)ry�rr{�forces   r�set_start_methodzBaseContext.set_start_method�s���F�G�Gr
c�4�t�jd�S)z_Controls how objects will be reduced to a form that can be
        shared with other processes.r)�globals�get�rs r�reducerzBaseContext.reducer�s���y�}�}�[�)�)r
c��|t�d<y)Nr)r�)rrs  rr�zBaseContext.reducer�s��!*��	�+�r
c��yr}rr�s rrzzBaseContext._check_available�s��r
)Tr})r)NN)r)NNrN�F)+r
rrrrrr�staticmethodr�current_process�parent_process�active_childrenrr&r(r,r/r2r5r8r:r<rBrFrHrJrRrWrZr]rargrjrnrprsr#r�r��propertyr��setterrzrr
rrrs���L�#�N��L�-��"�7�#:�#:�;�O�!�'�"8�"8�9�N�"�7�#:�#:�;�O��	��
,�
-�
7�
8�
?�
-�
I�
6�
>�
3�
?A�"�0�1�
?�
37�-�DH�-���$�
!�#�-���H��*��*�

�^�^�+��+�
r
rc�0�eZdZdZed��Zed��Zy)�ProcessNc�\�tj�jj|�Sr})�_default_contextr#r��_Popen)�process_objs rr�zProcess._Popen�s"���+�+�-�5�5�<�<�[�I�Ir
c�Z�tj�jj�Sr})r�r#r��_after_forkrr
rr�zProcess._after_fork�s ���+�+�-�5�5�A�A�C�Cr
�r
rr�
_start_methodr�r�r�rr
rr�r��s1���M��J��J��D��Dr
r�c�@��eZdZeZd�Zd�fd�	Zdd�Zdd�Zd�Z�xZ	S)�DefaultContextc� �||_d|_yr})r��_actual_context)rrKs  r�__init__zDefaultContext.__init__�s�� '���#��r
c�x��|�)|j�|j|_|jSt�|�
|�Sr})r�r��superr#)rr{�	__class__s  �rr#zDefaultContext.get_context�s>����>��#�#�+�'+�'<�'<��$��'�'�'��7�&�v�.�.r
c�z�|j�
|std��|�
|rd|_y|j|�|_y)Nzcontext has already been set)r��RuntimeErrorr#r�s   rr�zDefaultContext.set_start_method�sA�����+�E��=�>�>��>�e�#'�D� ��#�/�/��7��r
c�n�|j�|ry|j|_|jjSr})r�r�r~rs  rr�zDefaultContext.get_start_method�s4�����'���#'�#8�#8�D� ��#�#�)�)�)r
c��tjdk(rdgStjdk(rddgnddg}tjr|j	d�|S)z=Returns a list of the supported start methods, default first.r_re�darwin�forkrt)rbrcr�HAVE_SEND_HANDLE�append)r�methodss  r�get_all_start_methodsz$DefaultContext.get_all_start_methodssM���<�<�7�"��9��+.�<�<�8�+C�w��'�&�RY�IZ�G��)�)����|�,��Nr
r}r�)
r
rrr�r�r#r�r�r��
__classcell__)r�s@rr�r��s!����G�$�/�8�*�r
r�r_c� �eZdZdZed��Zy)�ForkProcessr�c��ddlm}||�S�Nr)�Popen)�
popen_forkr��r�r�s  rr�zForkProcess._Popens��)���%�%r
N�r
rrr�r�r�rr
rr�r�s���
�	�	&�
�	&r
r�c�0�eZdZdZed��Zed��Zy)�SpawnProcessrec��ddlm}||�Sr�)�popen_spawn_posixr�r�s  rr�zSpawnProcess._Popen���0���%�%r
c��yr}rrr
rr�zSpawnProcess._after_fork#���
r
Nr�rr
rr�r��-���
�	�	&�
�	&�
�	�
�	r
r�c� �eZdZdZed��Zy)�ForkServerProcessrtc��ddlm}||�Sr�)�popen_forkserverr�r�s  rr�zForkServerProcess._Popen*s��/���%�%r
Nr�rr
rr�r�(s��$�
�	�	&�
�	&r
r�c��eZdZdZeZy)�ForkContextr�N)r
rrr~r�r�rr
rr�r�/s�����r
r�c��eZdZdZeZy��SpawnContextreN�r
rrr~r�r�rr
rr�r�3������r
r�c��eZdZdZeZd�Zy)�ForkServerContextrtc�:�tjstd��y)Nz%forkserver start method not available)rr�ryr�s rrzz"ForkServerContext._check_available:s���-�-� �!H�I�I�.r
N)r
rrr~r�r�rzrr
rr�r�7s����#��	Jr
r�)r�rertr�rer�c�0�eZdZdZed��Zed��Zy)r�rec��ddlm}||�Sr�)�popen_spawn_win32r�r�s  rr�zSpawnProcess._PopenNr�r
c��yr}rrr
rr�zSpawnProcess._after_forkSr�r
Nr�rr
rr�r�Lr�r
c��eZdZdZeZyr�r�rr
rr�r�Xr�r
c�(�t|t_yr})rwr�r�)r{s r�_force_start_methodr�es��'9�&�'A��$r
c�$�ttdd�S)N�spawning_popen)rd�_tlsrr
r�get_spawning_popenr�ns���4�)�4�0�0r
c��|t_yr})r�r�)�popens r�set_spawning_popenr�qs
���D�r
c�Z�t��!tdt|�jz��y)NzF%s objects should only be shared between processes through inheritance)r�r��typer
)�objs r�assert_spawningr�ts4����#��
#�%)�#�Y�%7�%7�
8��	�$r
) rrb�	threadingrmrr�__all__�	Exceptionrrrr�objectr�BaseProcessr�r�rcr�r�r�r�r�r�rwr�r��localr�r�r�r�rr
r�<module>r�s���	�
����
��	�9�	�	�\�	�	�<�	�	�,�	�x
�&�x
�|D�g�!�!�D�&�[�&�Z�<�<�7��&�g�)�)�&�
�w�*�*�
�&�G�/�/�&��k���{��J�K�J��
���'�)���
�|�|�x��*�*<�W�*E�F��)�*<�V�*D�E��
�w�*�*�
��{��
	�����&�&8��&A�B��B��y�����1� �r

Zerion Mini Shell 1.0