Your IP : 3.148.145.219


Current Path : /usr/lib64/python3.6/site-packages/gi/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/site-packages/gi/__pycache__/_ossighelper.cpython-36.pyc

3

��<_�!�@s�ddlmZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
dd�Zdae
dd��Z
d	d
�Ze�ZejZeje_ejge_ejej�ejkr�eej�ZndZdd
�Ze
dd��Zdd�Zgadae
dd��ZdS)�)�print_functionN)�closing�contextmanagerc
Cspt|d�r|jd�nVyddl}Wntk
r>td��Yn.X|j�}|j||j�}|j||j||jB�dS)z�Ensures that the socket is not inherited by child processes

    Raises:
        EnvironmentError
        NotImplementedError: With Python <3.4 on Windows
    �set_inheritableFrNz+Not implemented for older Python on Windows)	�hasattrr�fcntl�ImportError�NotImplementedError�filenoZF_GETFDZF_SETFDZ
FD_CLOEXEC)�sockr�fd�flags�r�$/usr/lib64/python3.6/_ossighelper.py�ensure_socket_not_inheritables
rFc	'#s�trdVdSddlm�tjdkp4tjdd�d
k}ttd�}|sL|rVdVdStj	�\�}t
����"t
|���x"�|gD]}|jd	�t|�q�Wyt
j|j��}Wntk
r�dVdSXd
a��fdd�}zxtjdk�r��jj�j��}n�jj�j��}�j|�j�jj�jjB�jjB�jjB|�}z
dVWd�j|�XWdt
j|�}||j�k�rzt
j|�d	aXWdQRXWdQRXdS)aA decorator for functions which create a glib event loop to keep
    Python signal handlers working while the event loop is idling.

    In case an OS signal is received will wake the default event loop up
    shortly so that any registered Python signal handlers registered through
    signal.signal() can run.

    Works on Windows but needs Python 3.5+.

    In case the wrapped function is not called from the main thread it will be
    called as is and it will not wake up the default loop for signals.
    Nr)�GLib�nt����
socketpairFTcsN|�j@rFyt�jd��Stk
r@}zt|�dSd}~XnXdSdSdS)N�FT)ZIO_IN�boolZrecv�EnvironmentError�print)�sourceZ	condition�e)r�read_socketrr�
signal_notifyis
z'wakeup_on_signal.<locals>.signal_notify)rr)�_wakeup_fd_is_activeZ
gi.repositoryr�os�name�sys�version_infor�socketrrZsetblockingr�signal�
set_wakeup_fdr
�
ValueErrorZ	IOChannelZwin32_new_socketZunix_newZio_add_watchZPRIORITY_DEFAULTZIOCondition�INZHUPZNVALZERRZ
source_remove)	Zset_wakeup_fd_supports_socketZhas_socketpairZwrite_socketrZorig_fdrZchannelZ	source_idZwrite_fdr)rrr�wakeup_on_signal8sL




r)cCsJtjdkrtjddtj�Stjdkr<tjdtjdd��Stjd�SdS)Nrz
python dll�cygwinzlibpython%d.%d.dllr)r r!�ctypesZPyDLLr"Z	dllhandle�platformr#rrrr�create_pythonapi�s


r-rcCs tjtj�tjkottj�tkS)z?Returns if on SIGINT the default Python handler would be called)r%�	getsignal�SIGINT�default_int_handler�PyOS_getsig�startup_sigint_ptrrrrr�sigint_handler_is_default�sr3ccsbt�s
t�tjtj|�ttj�}z
dVWdtjtj�|kr\ttj�|kr\tjtjtj�XdS)z�Context manager for saving/restoring the SIGINT handler default state.

    Will only restore the default handler again if the handler is not changed
    while the context is active.
    N)r3�AssertionErrorr%r/r1r.r0)ZhandlerZsig_ptrrrr�&sigint_handler_set_and_restore_default�s


r5cCstj�jdkS)z@Returns True in case the function is called from the main threadZ
MainThread)�	threadingZcurrent_threadr!rrrr�is_main_thread�sr7ccs�t�sdVdSt�sPtrFtj|�z
dVWdtj�}trB|�XndVdSdadd�}tj|�zt|��dVWdQRXWdtr�tjtj	d�ntj�XdS)a�Installs a SIGINT signal handler in case the default Python one is
    active which calls 'callback' in case the signal occurs.

    Only does something if called from the main thread.

    In case of nested context managers the signal handler will be only
    installed once and the callbacks will be called in the reverse order
    of their registration.

    The old signal handler will be restored in case no signal handler is
    registered while the context is active.
    NFcSstrdSdatj��dS)NT)�_sigint_called�_callback_stack�pop)Zsig_num�framerrr�sigint_handler�sz0register_sigint_fallback.<locals>.sigint_handler)
r7r3r9�appendr:r8r5r%r0r/)�callback�cbr<rrr�register_sigint_fallback�s,




r@���)Z
__future__rr r"r$r%r+r6�
contextlibrrrrr)r-Zpydllr1Zc_void_pZrestypeZc_intZargtypesr.r/r0r2r3r5r7r9r8r@rrrr�<module>s0V


?>