HEX
Server: LiteSpeed
System: Linux server902.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: deshuvsd (2181)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //opt/hc_python/lib/python3.12/site-packages/inotify/__pycache__/adapters.cpython-312.pyc
�

J�/i�3���ddlZddlZddlZddlZddlZddlZddlmZmZddl	Z
ddlZ
dZdZ
dZeje�Zej$dgd��Zej(e
�Zeeej0j3dd	���ZGd
�de�ZGd�d
e�ZGd�de�ZGd�de�Z Gd�de �Z!Gd�de �Z"y)�N)�EINTR�ENOENT��iIII)�
IN_Q_OVERFLOW�
IN_UNMOUNT�_INOTIFY_EVENT)�wd�mask�cookie�len�DEBUG�0c��eZdZy)�EventTimeoutExceptionN)�__name__�
__module__�__qualname__���?/opt/hc_python/lib/python3.12/site-packages/inotify/adapters.pyrr(s��rrc���eZdZ�fd�Z�xZS)�TerminalEventExceptionc�:��tt|�|�||_y�N)�superr�__init__�event)�self�	type_namer�	__class__s   �rrzTerminalEventException.__init__-s���
�$�d�4�Y�?���
r)rrrr�
__classcell__�r!s@rrr,s
����rrc��eZdZgefd�Zd�Zd�Zejjfd�Z
d
d�Zd
d�Zd�Z
d�Zd	d
d	efd�Zed��Zy	)�Inotifyc��||_i|_i|_d|_tj
j
�|_tjd|j�tj�|_|jj|jtj�d|_|D]}|j!|��y)NrzInotify handle is (%d).)�_Inotify__block_duration�_Inotify__watches�_Inotify__watches_r�_Inotify__buffer�inotify�calls�inotify_init�_Inotify__inotify_fd�_LOGGER�debug�select�epoll�_Inotify__epoll�register�POLLIN�_Inotify__last_success_return�	add_watch)r�paths�block_duration_s�paths    rrzInotify.__init__3s��� 0�����������
�#�M�M�6�6�8����
�
�/��1B�1B�C��|�|�~��������d�/�/����?�%)��"��D��N�N�4� �rc�Z�	|j�S#t$r|jcYSwxYw)z=Allow the block-duration to be an integer or a function-call.)r'�	TypeError�rs r�__get_block_durationzInotify.__get_block_durationDs1��	)��(�(�*�*���	)��(�(�(�	)�s��*�*c�l�tjd�tj|j�y)NzCleaning-up inotify.)r/r0�os�closer.r=s r�__del__zInotify.__del__Ms!���
�
�,�-�
����"�"�#rc�^�tjd|�||jvrtjd|�y|j	d�}t
jj|j||�}tjd||�||j|<||j|<|S)NzAdding watch: [%s]z Path already being watched: [%s]�utf8zAdded watch (%d): [%s])
r/r0r(�warning�encoder+r,�inotify_add_watchr.r))r�path_unicoder�
path_bytesr
s     rr7zInotify.add_watchQs����
�
�*�L�9��4�>�>�)��O�O�>��M��!�(�(��0�
�
�]�]�
,�
,�T�->�->�
�D�
Q���
�
�.��L�A�')����|�$�+�������	rc��|jj|�}|�ytjd||�|j|=|j	||�y)z�Remove our tracking information and call inotify to stop watching
        the given path. When a directory is removed, we'll just have to remove
        our tracking since inotify already cleans-up the watch.
        Nz*Removing watch for watch-handle (%d): [%s])r(�getr/r0�remove_watch_with_id)rr:�superficialr
s    r�remove_watchzInotify.remove_watchgsR���^�^�
�
��
%��
�:���
�
�B��$�	 �
�N�N�4� ��!�!�"�k�2rc��|j|=|durAtjd|�tjj|j|�yy)NFz%Removing watch for watch-handle (%d).)r)r/r0r+r,�inotify_rm_watchr.)rr
rMs   rrLzInotify.remove_watch_with_idxsF�����R� ��%���M�M�A�2�F��M�M�*�*�4�+<�+<�b�A� rc���g}tjjj�D](\}}||zs�|j	|�||z}|dk(s�(n|dk(sJd|fz��|S)Nrz*We could not resolve all event-types: (%d))r+�	constants�MASK_LOOKUP�items�append)r�
event_type�names�bit�names     r�_get_event_nameszInotify._get_event_names�sz���� �*�*�6�6�<�<�>�I�C���C�����T�"��c�!�
���?��
?��Q��	L�;�z�m�K�	L���rc#�K�tj|d�}|sy|xj|z
c_	t|j�}|tkrt
j
d�y|jdt}tjt|�}t|�}|j|j�}t
j
dj|��t|jz}||kry|jt|}	|	jd�}
|j|d|_|jj!|j"�}|�|
j%d�}||||f��t|j�}
|
tkry��Z�w)z1Handle a series of events coming-in from inotify.iNzNot enough bytes for a header.zEvents received in stream: {}�rD)r@�readr*r
�_STRUCT_HEADER_LENGTHr/r0�struct�unpack�_HEADER_STRUCT_FORMATr	rZr�format�rstripr)rKr
�decode)rr
�b�length�
peek_slice�
header_raw�header�
type_names�event_length�filename�filename_bytesr:�filename_unicode�
buffer_lengths              r�_handle_inotify_eventzInotify._handle_inotify_event�sc����
�G�G�B�������
�
���
������'�F��-�-��
�
�>�?�����'=�(=�>�J����1�&�(�J�$�Z�0�F��.�.�v�{�{�;�J��M�M�9�@�@��L�M�1�F�J�J�>�L���$���}�}�%:�<�H�H�&�_�_�U�3�N� �M�M�,�-�8�D�M��#�#�'�'��	�	�2�D���#1�#8�#8��#@� ��z�4�1A�B�B���
�
�.�M��4�4��K�s�F
FNTc#��K�d|_tj�}	|j�}	|jj	|�}|D]�\}
}|j|�}tjdj|��|j|
�D]V\}
}}}tj�}|
|||f}|D],}|�|||�dur
||f|_y||vs�"t||��|���X��|�tj�|z
}	|	|kDry|durd����#t
$rB}|jtk7r�|�!tj�|z
}	|	|kDrYd}~yYd}~��Dd}~wwxYw�w)z�Yield one event after another. If `timeout_s` is provided, we'll
        break when no event is received for that many seconds.
        NTzEvents received from epoll: {}F)r6�time�_Inotify__get_block_durationr3�poll�IOError�errnorrZr/r0rbrpr)r�	timeout_s�yield_nones�filter_predicate�terminal_events�
last_hit_sr9�events�e�time_since_event_s�fdrVrWrirjr:rlr s                  r�	event_genzInotify.event_gen�s�����&*��"��Y�Y�[�
��#�8�8�:��
����*�*�+;�<��#)���J��-�-�j�9���
�
�>�E�E�e�L�M� �5�5�b�9�9�V�Z��x�!%����J���T�8�<�A�%/�	�+�7�+�I�q�9�U�B�;D�a�.�T�7�#�&�/�9�"8��A�"F�F�
&0��G�:�#)�*�$�%)�Y�Y�[�:�%=�"�%�	�1���d�"��
�_���	
��7�7�e�#���(�)-����z�)A�&�)�I�5����	
�s5�-E*�D�BE*�=E*�	E'�%2E"�E*�"E'�'E*c��|jSr)r6r=s r�last_success_returnzInotify.last_success_return�s���)�)�)r�F)rrr�_DEFAULT_EPOLL_BLOCK_DURATION_SrrsrBr+rR�
IN_ALL_EVENTSr7rNrLrZrp�_DEFAULT_TERMINAL_EVENTSr��propertyr�rrrr%r%2si���2Q�!�")�$�,3�+<�+<�+J�+J��,3�"B�
�.�b!�d�T�4�<�|�*��*rr%c�^�eZdZejj
efd�Zdd�Ze	d��Zd�Z
y)�	_BaseTreec���|tjjztjjztjjz|_t
|��|_y)N)r9)r+rR�IN_ISDIR�	IN_CREATE�	IN_DELETE�_maskr%�_i)rrr9s   rrz_BaseTree.__init__sX��
��)�)�2�2�3��)�)�3�3�4� �)�)�3�3�4��
�
�+;�<��rc+�dK�|jjd	i|��D�]}|��|\}}}}|jtjj
z�r�tjj||�}|jtjjzs'|jtjjzrLtjj|�dus|dur'tjd|�|j|�|jtjjzr4tjd|�|jj!|d��n�|jtjj"zr4tjd|�|jj!|d��nc|jtjjzr<tjd|�|jj%||j&�|����y�w)
aJThis is a secondary generator that wraps the principal one, and
        adds/removes watches as directories are added/removed.

        If we're doing anything funky and allowing the events to queue while a
        rename occurs then the folder may no longer exist. In this case, set
        `ignore_missing_new_folders`.
        NTFz^A directory has been created. We're adding a watch on it (because we're being recursive): [%s]zlA directory has been removed. We're being recursive, but it would have automatically been deregistered: [%s])rMzlA directory has been renamed. We're being recursive, but it would have automatically been deregistered: [%s]z^A directory has been renamed. We're adding a watch on it (because we're being recursive): [%s]r)r�r�rr+rRr�r@r:�join�IN_MOVED_TOr��existsr/r0�
_load_treer�rN�
IN_MOVED_FROMr7r�)	r�ignore_missing_new_folders�kwargsrrirjr:rl�	full_paths	         rr�z_BaseTree.event_gens�����'�T�W�W�&�&�0��0�E�� �7<�4���T�8��;�;��!2�!2�!;�!;�;� "�����T�8� <�I� ���w�'8�'8�'D�'D�D����w�'8�'8�'B�'B�B������y�1�T�9�2�e�;��
�
�'?�@I�K�
���	�2��{�{�W�%6�%6�%@�%@�@��
�
�'N�'0�1����,�,�Y�D�,�I����w�'8�'8�'F�'F�F��
�
�'N�'0�1�
���,�,�Y�D�,�I����w�'8�'8�'D�'D�D��
�
�'?�@I�K����)�)�)�T�Z�Z�@��K�Y1�s�H.H0c��|jSr)r�r=s rr+z_BaseTree.inotifyFs���w�w�rc�x�g}|g}|r�|d}|d=	tj|�}|j|�|D]U}tjj||�}tjj|�dur�E|j|��W|r��|D])}	|jj||j��+y#t$rtj	d|�Y��wxYw#tjj$r4}|jt k(rtj	d|�Yd}~���d}~wwxYw)Nrz+Path %s disappeared before we could list itFz,Path %s disappeared before we could watch it)r@�listdir�FileNotFoundErrorr/rErUr:r��isdirr�r7r�r+r,�InotifyErrorrvr)	rr:r8�q�current_path�	filenamesrl�entry_filepathr}s	         rr�z_BaseTree._load_treeJs����
�F����Q�4�L��!��
��J�J�|�4�	�

�L�L��&�%��!#�����l�H�!E���7�7�=�=��0�E�9������(�&��&�D�
����!�!�$��
�
�3���%�
���� M�|�\��
�� �=�=�-�-�
��7�7�f�$��O�O�$R�TX�Y����	
�s/�C�&C(�C%�$C%�(D9�)D4�3D4�4D9Nr�)rrrr+rRr�r�rr�r�r�rrrr�r�s8��#�-�-�;�;�"A�
=�5�n����rr�c�Z��eZdZdZej
jef�fd�	Z�fd�Z	�xZ
S)�InotifyTreezRecursively watch a path.c�R��tt|�||��|j|�y�N)rr9)rr�rr�)rr:rr9r!s    �rrzInotifyTree.__init__os$���
�k�4�)�t�FV�)�W�����rc�N��tjd|�t�|�
|�S)Nz$Adding initial watches on tree: [%s])r/r0rr�)rr:r!s  �rr�zInotifyTree._load_treeus"����
�
�<�d�C��w�!�$�'�'r)rrr�__doc__r+rRr�r�rr�r"r#s@rr�r�ls'���#�")�"3�"3�"A�"A�"A��(�(rr�c�V��eZdZdZej
jef�fd�	Zd�Z	�xZ
S)�InotifyTreesz'Recursively watch over a list of trees.c�R��tt|�||��|j|�yr�)rr�r�_load_trees)rr8rr9r!s    �rrzInotifyTrees.__init__}s&���
�l�D�*��GW�*�X�����rc	��tjddjtt|���|D]}|j|��y)Nz%Adding initial watches on trees: [%s]�,)r/r0r��map�strr�)rr8r:s   rr�zInotifyTrees._load_trees�s7���
�
�=�s�x�x��C�QV��?X�Y��D��O�O�D�!�r)rrrr�r+rRr�r�rr�r"r#s@rr�r�zs"���1�#*�#4�#4�#B�#B�"A� �"rr�)#�loggingr1r@r_�collectionsrrrvrr�inotify.constantsr+�
inotify.callsr�rar��	getLoggerrr/�
namedtupler	�calcsizer^�bool�int�environrK�	_IS_DEBUG�	Exceptionrr�objectr%r�r�r�rrr�<module>r�s����
�	�
������#$�������'�
�
�H�
%��'��'�'�$����(����(=�>����R�Z�Z�^�^�G�S�1�2�3�	�	�I�	��Y��M*�f�M*�`g��g�T(�)�(�"�9�"r