Файловый менеджер - Редактировать - /home/digitalm/venv/lib/python3.7/site-packages/watchdog/utils/__pycache__/dirsnapshot.cpython-37.pyc
Назад
B �P�g5. � @ sZ d Z ddlmZ ddlZddlZddlmZ G dd� d�ZG dd� d�ZG d d � d �Z dS )u� :module: watchdog.utils.dirsnapshot :synopsis: Directory snapshots and comparison. :author: yesudeep@google.com (Yesudeep Mangalapilly) :author: contact@tiger-222.fr (Mickaël Schoentgen) .. ADMONITION:: Where are the moved events? They "disappeared" This implementation does not take partition boundaries into consideration. It will only work when the directory tree is entirely on the same file system. More specifically, any part of the code that depends on inode numbers can break if partition boundaries are crossed. In these cases, the snapshot diff will represent file/directory movement as created and deleted events. Classes ------- .. autoclass:: DirectorySnapshot :members: :show-inheritance: .. autoclass:: DirectorySnapshotDiff :members: :show-inheritance: .. autoclass:: EmptyDirectorySnapshot :members: :show-inheritance: � )�annotationsN)�S_ISDIRc @ s� e Zd ZdZddd�Zdd� Zdd� Zed d � �Zedd� �Z ed d� �Z edd� �Zedd� �Zedd� �Z edd� �Zedd� �ZdS )�DirectorySnapshotDiffa� Compares two directory snapshots and creates an object that represents the difference between the two snapshots. :param ref: The reference directory snapshot. :type ref: :class:`DirectorySnapshot` :param snapshot: The directory snapshot which will be compared with the reference snapshot. :type snapshot: :class:`DirectorySnapshot` :param ignore_device: A boolean indicating whether to ignore the device id or not. By default, a file may be uniquely identified by a combination of its first inode and its device id. The problem is that the device id may (or may not) change between system boots. This problem would cause the DirectorySnapshotDiff to think a file has been deleted and created again but it would be the exact same file. Set to True only if you are sure you will always use the same device. :type ignore_device: :class:`bool` Fc sN �j � j }� j �j }|r&dd� }ndd� }x<� j �j @ D ],}|� |�|�|�kr<|�|� |�|� q<W t� }x@t|�D ]4}� �|�} ��| �} | r||�|� |�|| f� q|W x@t|�D ]4}��|�} � �| �}|r�|�|� |�||f� q�W t� }xb� j �j @ D ]R}|� |�|�|�k�r � �|���|�k�sP� �|���|�k�r |�|� �q W xH|D ]@\}} � �|���| �k�s�� �|���| �k�rf|�|� �qfW �fdd�|D �| _� fdd�|D �| _ � fdd�|D �| _ � fdd�|D �| _t|t| j� �| _ t|t| j � �| _t|t| j � �| _t|t| j� �| _d S ) Nc S s | � |�d S )Nr )�inode)� directory� full_path� r �P/home/digitalm-up/venv/lib/python3.7/site-packages/watchdog/utils/dirsnapshot.py� get_inodeX s z1DirectorySnapshotDiff.__init__.<locals>.get_inodec S s | � |�S )N)r )r r r r r r ] s c s g | ]}� � |�r|�qS r )�isdir)�.0�path)�snapshotr r � <listcomp>� s z2DirectorySnapshotDiff.__init__.<locals>.<listcomp>c s g | ]}� � |�r|�qS r )r )r r )�refr r r � s c s g | ]}� � |�r|�qS r )r )r r )r r r r � s c s"