HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib64/python3.10/site-packages/billiard/__pycache__/spawn.cpython-310.pyc
o

!we�-�@s\ddlZddlZddlZddlZddlZddlZddlZddlmZm	Z	ddlm
Z
ddlmZgd�ZdZ
ejdkr@d	Zd	ZnejdkoJeed
d	�Zej���d�Zer^ej�ejd�anejad
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z dd�Z!d1dd �Z"d!d"�Z#d#d$�Z$d%d&�Z%d'd(�Z&gZ'd)d*�Z(d+d,�Z)d-d.�Z*d/d0�Z+dS)2�N�)�get_start_method�set_start_method)�process��util)�_main�freeze_support�set_executable�get_executable�get_preparation_data�get_command_line�import_main_pathz�Will add directory %r to path! This is necessary to accommodate pre-Django 1.4 layouts using setup_environ.
You can skip this warning by adding a DJANGO_SETTINGS_MODULE=settings environment variable.
�win32F�frozenzpythonservice.exez
python.execCs.tj�t|��\}}|tjks|st��}|S�N)�os�path�split�_module_dir�curdir�getcwd)�mod�dir�filename�r�G/home/arjun/projects/env/lib/python3.10/site-packages/billiard/spawn.py�_module_parent_dir3srcCsd|jvrtj�|j�S|jS)Nz__init__.py)�__file__rr�dirname)rrrrr:s
rcCs�dtjvrfztjd}Wn
tyYdSwtj�d�}|o!|j}z
|�dd�\}}Wn
ty6YdSwt	|�}z
tj
�t|��}Wn
t
yOYdSw|r_t�tttj
�|���|tjd<dSdS)N�DJANGO_PROJECT_DIR�DJANGO_SETTINGS_MODULEzdjango.conf.settings�.r)r�environ�KeyError�sys�modules�get�
configuredr�
ValueError�
__import__r�normpathr�AttributeError�warnings�warn�UserWarning�W_OLD_DJANGO_LAYOUT�realpath)�
settings_name�
conf_settingsr(�project_name�_�project�project_dirrrr�_Django_old_layout_hack__save@s2
�
����r8cCs.ztj�tjd�WdStyYdSw)Nr )r%r�appendrr#r$rrrr�_Django_old_layout_hack__loadZs
�r:cCs|adSr��_python_exe)�exerrrr
asr
cCstSrr;rrrrrfsrcCs t|�dkr|ddkrdSdS)z=
    Return whether commandline indicates we are forking
    �r�--billiard-forkTF)�len)�argvrrr�
is_forkingnsrBcCslttj�r4i}tjdd�D]}|�d�\}}|dkr d||<qt|�||<qtdi|��t��dSdS)zE
    Run code for process object if this in not the main process
    r>N�=�Noner)rBr%rAr�int�
spawn_main�exit)�kwds�arg�name�valuerrrr	xs

�r	cKsdttdd�rtjdgdd�|��D�Sd}|d�dd	�|��D��;}t��}tg|d
|dgS)zJ
    Returns prefix of command line used for spawning a child process
    rFr?cSsg|]}d|�qS)�%s=%rr��.0�itemrrr�
<listcomp>�sz$get_command_line.<locals>.<listcomp>z5from billiard.spawn import spawn_main; spawn_main(%s)z, css�|]}d|VqdS)rLNrrMrrr�	<genexpr>�s�z#get_command_line.<locals>.<genexpr>z-c)�getattrr%�
executable�items�joinr�_args_from_interpreter_flagsr<)rH�prog�optsrrrr
�s�r
c	Cstttj�sJ�tjdkr#ddl}ddlm}|||�}|�|tj	�}nddl
m}||j_
|}t|�}t�|�dS)z7
    Run code specified by data received over pipe
    rrNr)�steal_handle)�semaphore_tracker)rBr%rA�platform�msvcrt�	reductionrY�open_osfhandler�O_RDONLY�rZ�_semaphore_tracker�_fdrrG)	�pipe_handle�
parent_pid�
tracker_fdr\rY�
new_handle�fdrZ�exitcoderrrrF�s

rFcCs�ztjdjtjd<WntyYn	tyYnwtj�d�}tj�d�p*d}tj�d�}|rwddlm	}ddl
}|��}|�t
|��|jsyd	|_|pRtj}t|d
�r^|�|�}n|�|�}|�|pi|j�}|�|�|�|�dSdSdS)N�__main__�MP_MAIN_FILE�_MP_FORK_LOGLEVEL_�_MP_FORK_LOGFILE_�_MP_FORK_LOGFORMAT_rrrT�write)r%r&rrr#r$r,r'r`r�logging�
get_logger�setLevelrE�handlers�_rudimentary_setup�
__stderr__�hasattr�
StreamHandler�FileHandler�	Formatter�DEFAULT_LOGGING_FORMAT�setFormatter�
addHandler)�loglevel�logfile�formatrro�logger�handler�	formatterrrr�_setup_logging_in_child_hack�s8�


�
�r�c	Cs�t�tj|ddd��-}dt��_zt�|�}t|�t	�t�|�}Wt��`nt��`wWd�|�
�S1s;wY|�
�S)N�rbT)�closefd)r:�io�openr�current_process�_inheriting�pickle�load�preparer��
_bootstrap)rg�from_parent�preparation_data�selfrrrr�s


�	�	rcCstt��dd�rtd��dS)Nr�Fa
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.)rRrr��RuntimeErrorrrrr�_check_not_importing_main�s�r�cCs0t�ttjt��jd�}tjdurtj��|d<t	j
dd�}z|�d�}Wn	ty0Ynwtj
||<|j||t	jtj
t��t�d�t	jd}z|jj}Wnty]|j}Ynw|durh||d<|St	jdksqts�ts�t|d	d�}|dur�tj
�|�s�tj
dur�tj
�tj
|�}tj
�|�|d
<|S)zM
    Return info about parent needed by child to unpickle process object
    )�
log_to_stderr�authkeyN�	log_levelr`)rJ�sys_path�sys_argv�orig_dirr�start_methodri�init_main_from_namerr�init_main_from_path)r��dictr�_log_to_stderrrr�r��_logger�getEffectiveLevelr%r�indexr)�ORIGINAL_DIR�updaterArrrr&�__spec__rJr,�__name__r[�WINEXE�
WINSERVICErR�isabsrUr+)rJ�dr��i�main_module�
main_mod_name�	main_pathrrrr�sN�
�
�

�	�
rcCs�d|vr|dt��_d|vr|dt��_d|vr"|dr"t��d|vr/t���|d�d|vr8|dt_	d|vrA|dt_
d|vrLt�|d�d|vrU|dt_
d	|vr_t|d	�d
|vrkt|d
�dSd|vrwt|d�dSdS)
zE
    Try to get current process ready to unpickle process object
    rJr�r�r�r�r�rr�r�r�r�N)rr�rJr�rr�rprqr%rrAr�chdirr�r�_fixup_main_from_name�_fixup_main_from_path)�datarrrr�s.


�r�cCs�tjd}|dks|�d�rdSz|jj}Wnty"|j}Ynw||kr)dSt�|�t	�
d�}tj|ddd�}|j
�|�|tjd<tjd<dS)Nriz	.__main__�__mp_main__T)�run_name�	alter_sys)r%r&�endswithr�rJr,r��old_main_modulesr9�types�
ModuleType�runpy�
run_module�__dict__r�)�mod_name�current_main�current_main_namer��main_contentrrrr�Gs$

�

�r�cCs�tjd}tj�tj�|��d}|dkrdSt|dd�|kr!dSt�|�t	�
d�}tj|dd�}|j
�|�|tjd<tjd<dS)Nrir�ipythonrr�)r�)r%r&rr�splitext�basenamerRr�r9r�r�r��run_pathr�r�)r�r��	main_namer�r�rrrr�es


�r�cCst|�dS)z<
    Set sys.modules['__main__'] to module at main_path
    N)r�)r�rrrr�sr)NN),r�rr�r%r�r�r-r`rrrr�__all__r0r[r�r�rRrS�lowerr�rrU�exec_prefixr<rrr8r:r
rrBr	r
rFr�rr�rr�r�r�r�rrrrr�<module>sN



6(