PK APOCALYPSE V1

APOCALYPSE V1

Current Path : /opt/hc_python/lib/python3.12/site-packages/inotify/__pycache__/
Upload File :
Current File : //opt/hc_python/lib/python3.12/site-packages/inotify/__pycache__/adapters.cpython-312.pyc

�

���g�3���ddlZddlZddlZddlZddlZddlZddlmZddlZ	ddl
Z	dZdZdZ
eje�Zej"dgd��Zej&e�Zeeej.j1dd	���ZGd
�de�ZGd�d
e�ZGd�de�ZGd�de�ZGd�de�Z Gd�de�Z!y)�N)�EINTR��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.r/�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.r/r'�warning�encoder*r+�inotify_add_watchr-r()r�path_unicoder
�
path_bytesr	s     rr6zInotify.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.r/�remove_watch_with_id)rr9�superficialr	s    r�remove_watchzInotify.remove_watchgsP���^�^�
�
��
%��
�:���
�
�B��$�	 �
�N�N�4� ��!�!�"�%rc��|j|=|durAtjd|�tjj|j|�yy)NFz%Removing watch for watch-handle (%d).)r(r.r/r*r+�inotify_rm_watchr-)rr	rLs   rrKzInotify.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: {}�rC)r?�readr)r�_STRUCT_HEADER_LENGTHr.r/�struct�unpack�_HEADER_STRUCT_FORMATrrYr
�format�rstripr(rJr	�decode)rr	�b�length�
peek_slice�
header_raw�header�
type_names�event_length�filename�filename_bytesr9�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)r5�time�_Inotify__get_block_durationr2�poll�IOError�errnorrYr.r/raror)r�	timeout_s�yield_nones�filter_predicate�terminal_events�
last_hit_sr8�events�e�time_since_event_s�fdrUrVrhrir9rkrs                  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)r5r<s r�last_success_returnzInotify.last_success_return�s���)�)�)r�F)rrr�_DEFAULT_EPOLL_BLOCK_DURATION_SrrrrAr*rQ�
IN_ALL_EVENTSr6rMrKrYro�_DEFAULT_TERMINAL_EVENTSr�propertyr�rrrr$r$2si���2Q�!�")�$�,3�+<�+<�+J�+J��,&�"B�
�.�b!�d�T�4�<�|�*��*rr$c�X�eZdZejj
efd�Zdd�Ze	d��Zy)�	_BaseTreec���|tjjztjjztjjz|_t
|��|_y)N)r8)r*rQ�IN_ISDIR�	IN_CREATE�	IN_DELETE�_maskr$�_i)rr
r8s   rrz_BaseTree.__init__sX��
��)�)�2�2�3��)�)�3�3�4� �)�)�3�3�4��
�
�+;�<��rc+�K�|jjd	i|��D�]!}|��|\}}}}|jtjj
z�r�tjj||�}|jtjjzs'|jtjjzratjj|�dus|dur<tjd|�|jj||j�|jtjj zr4tjd|�|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])rLzlA 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�rr
r*rQr�r?r9�join�IN_MOVED_TOr��existsr.r/r6r��
IN_MOVED_FROMrM)	r�ignore_missing_new_folders�kwargsrrhrir9rk�	full_paths	         rrz_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�
���)�)�)�T�Z�Z�@��{�{�W�%6�%6�%D�%D�D��
�
�'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�IIc��|jSr)r�r<s rr*z_BaseTree.inotifyFs���w�w�rNr�)
rrrr*rQr�r�rrr�rrrr�r�s3��#�-�-�;�;�"A�
=�5�n���rr�c�V��eZdZdZej
jef�fd�	Zd�Z	�xZ
S)�InotifyTreezRecursively watch a path.c�`��tt|�||��||_|j	|�y�N)r
r8)rr�r�_InotifyTree__root_path�_InotifyTree__load_tree)rr9r
r8r s    �rrzInotifyTree.__init__Ns.���
�k�4�)�t�FV�)�W��������rc��tjd|�g}|g}|r�|d}|d=|j|�tj|�D]U}tj
j
||�}tj
j|�dur�E|j|��W|r��|D](}|jj||j��*y)Nz$Adding initial watches on tree: [%s]rF)r.r/rTr?�listdirr9r��isdirr�r6r�)rr9r7�q�current_pathrk�entry_filepaths       r�__load_treezInotifyTree.__load_treeVs����
�
�<�d�C���
�F����Q�4�L��!���L�L��&��J�J�|�4��!#�����l�H�!E���7�7�=�=��0�E�9������(�5�
��D��G�G���d�D�J�J�/�r)rrr�__doc__r*rQr�r�rr�r!r"s@rr�r�Ks"���#�")�"3�"3�"A�"A�"A��0rr�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�_InotifyTrees__load_trees)rr7r
r8r s    �rrzInotifyTrees.__init__ps&���
�l�D�*��GW�*�X����%� rc	���tjddjtt|���g}|}|r�|d}|d=|j|�t
j|�D]U}tjj||�}tjj|�dur�E|j|��W|r��|D](}|jj||j��*y)Nz%Adding initial watches on trees: [%s]�,rF)
r.r/r��map�strrTr?r�r9r�r�r6r�)rr7�foundr�r�rkr�r9s        r�__load_treeszInotifyTrees.__load_treesvs����
�
�=�s�x�x��C�QV��?X�Y�������Q�4�L��!���L�L��&��J�J�|�4��!#�����l�H�!E���7�7�=�=��0�E�9������(�5�
��D��G�G���d�D�J�J�/�r)rrrr�r*rQr�r�rr�r!r"s@rr�r�ms"���1�#*�#4�#4�#B�#B�"A�!�0rr�)"�loggingr0r?r^�collectionsrqrur�inotify.constantsr*�
inotify.callsr�r`r��	getLoggerrr.�
namedtupler�calcsizer]�bool�int�environrJ�	_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*�`F��F�R0�)�0�D0�9�0r

if you don't want to be vaporized in a nuclear explosion, i simply have to become nuclear myself… i am atomic