OwlCyberSecurity - MANAGER
Edit File: _ossighelper.cpython-38.pyc
U �� ^� � @ s� d dl mZ d dlZd dlZd dlZd dlZd dlZd dlmZm Z ddl mZ dd� Zda e d d � �ZejZe�ej�ejkr�eej�ZndZdd � Ze dd� �Zdd� Zg adae dd� �ZdS )� )�print_functionN)�closing�contextmanager� )�_gic C sp t | d�r| �d� nVzddl}W n tk r> td��Y n.X | �� }|�||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_inheritableFr Nz+Not implemented for older Python on Windows) �hasattrr �fcntl�ImportError�NotImplementedError�filenoZF_GETFDZF_SETFDZ FD_CLOEXEC)�sockr �fd�flags� r �1/usr/lib/python3/dist-packages/gi/_ossighelper.py�ensure_socket_not_inheritable s � r Fc # s� t rdV dS ddlm� tjdkp4tjdd� dk} ttd�}|rH| sRdV dS t� � \�}t ����4 t |��� �|fD ]}|�d� t|� q~zt �|�� �}W n0 tk r� dV Y W 5 Q R � W 5 Q R � dS X d a � �fd d�}zxtjdk�r� j���� �}n� j���� �}� �|� j� jj� jjB � jjB � jjB |�}z dV W 5 � �|� X W 5 t �|�}||�� k�r�t �|� da X W 5 Q R X W 5 Q R X dS )a A 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� )� � � socketpairFTc sX |� j @ rPzt��d��W S tk rJ } zt|� W Y �dS d }~X Y nX dS dS d S )Nr FT)ZIO_IN�boolZrecv�EnvironmentError�print)�sourceZ condition�e�r Zread_socketr r � signal_notifyj s z'wakeup_on_signal.<locals>.signal_notify)�_wakeup_fd_is_activeZ gi.repositoryr �os�name�sys�version_infor �socketr r Zsetblockingr �signal� set_wakeup_fdr � ValueErrorZ IOChannelZwin32_new_socketZunix_newZio_add_watchZPRIORITY_DEFAULTZIOCondition�INZHUPZNVALZERRZ source_remove) Zset_wakeup_fd_supports_socketZhas_socketpairZwrite_socketr Zorig_fdr Zwrite_fdZchannelZ source_idr r r �wakeup_on_signal9 sZ � ���� r* ���c C s t �t j�t jkott j�tkS )z?Returns if on SIGINT the default Python handler would be called)r&