
    f j                         d dl Z d dlZd dlZd dlmZ d dlmZmZmZm	Z	 dZ
 e j        d          ZerddlmZ  G d d	          Z G d
 de          Z G d de          ZdS )    N)Path)TYPE_CHECKINGOptionalSequenceUnion)
BaseFilterDefaultFilterPythonFilterzwatchfiles.watcher   )Changec                       e Zd ZU dZdZdZee         ed<   	 dZ	ee         ed<   	 dZ
eeeef                  ed<   	 dd	Zd
ddedefdZdefdZdS )r   z
    Useful base class for creating filters. `BaseFilter` should be inherited and configured, rather than used
    directly.

    The class supports ignoring files in 3 ways:
    )_ignore_dirs_ignore_entity_regexes_ignore_paths ignore_dirsignore_entity_patternsignore_pathsreturnNc                     t          | j                  | _        t          d | j        D                       | _        t          t          t          | j                            | _	        d S )Nc              3   >   K   | ]}t          j        |          V  d S N)recompile).0rs     fC:\Users\Terasoftware\OneDrive\Desktop\faahhh\fyndo\fyndo\venv\Lib\site-packages\watchfiles/filters.py	<genexpr>z&BaseFilter.__init__.<locals>.<genexpr>(   s*      +_+_aBJqMM+_+_+_+_+_+_    )
setr   r   tupler   r   mapstrr   r   )selfs    r   __init__zBaseFilter.__init__&   sZ     011&++_+_4C^+_+_+_&_&_#"3sD,=#>#>??r   changer   pathc                 V    |                     t          j                                      t          j                  }t	           fd|D                       rdS |d         t	          fd j        D                       rdS  j        r|                     j                  rdS dS )aj  
        Instances of `BaseFilter` subclasses can be used as callables.
        Args:
            change: The type of change that occurred, see [`Change`][watchfiles.Change].
            path: the raw path of the file or directory that changed.

        Returns:
            True if the file should be included in changes, False if it should be ignored.
        c              3   *   K   | ]}|j         v V  d S r   )r   )r   pr$   s     r   r   z&BaseFilter.__call__.<locals>.<genexpr>6   s+      55!qD%%555555r   Fc              3   B   K   | ]}|                               V  d S r   )search)r   r   entity_names     r   r   z&BaseFilter.__call__.<locals>.<genexpr>:   s/      JJqxx$$JJJJJJr   T)lstripossepsplitanyr   r   
startswith)r$   r&   r'   partsr.   s   `   @r   __call__zBaseFilter.__call__+   s     BF##))"&115555u55555 	5BiJJJJd.IJJJJJ 	5 	DOOD4F$G$G 	54r   c                 t     d                      fd j        D                       } j        j         d| dS )Nz, c              3   D   K   | ]}| d t          |d          V  dS )=N)getattr)r   kr$   s     r   r   z&BaseFilter.__repr__.<locals>.<genexpr>B   s=      SSqA::a 6 6::SSSSSSr   ())join	__slots__	__class____name__)r$   argss   ` r   __repr__zBaseFilter.__repr__A   sG    yySSSSDNSSSSS.)33D3333r   )r   N)rA   
__module____qualname____doc__r?   r   r   r#   __annotations__r   r   r   r   r%   boolr6   rC   r   r   r   r   r      s           JI!#K####R,.HSM... 02L(5d+,111@ @ @ @
x s t    ,4# 4 4 4 4 4 4r   r   c                        e Zd ZU dZdZee         ed<   	 dZee         ed<   	 ddddde	ee                  de	ee                  de	ee
eef                           d	df fd
Z xZS )r	   zi
    The default filter, which ignores files and directories that you might commonly want to ignore.
    )__pycache__z.gitz.hgz.svnz.toxz.venvz.ideanode_modulesz.mypy_cachez.pytest_cachez.hypothesisr   )z
\.py[cod]$z\.___jb_...___$z\.sw.$z~$z^\.\#z^\.DS_Store$z
^flycheck_r   N)r   r   r   r   r   c                ~    ||| _         ||| _        ||| _        t                                                       dS )aC  
        Args:
            ignore_dirs: if not `None`, overrides the `ignore_dirs` value set on the class.
            ignore_entity_patterns: if not `None`, overrides the `ignore_entity_patterns` value set on the class.
            ignore_paths: if not `None`, overrides the `ignore_paths` value set on the class.
        N)r   r   r   superr%   )r$   r   r   r   r@   s       r   r%   zDefaultFilter.__init__e   sR      	+*D! 	A*@D' 	- ,Dr   )rA   rD   rE   rF   r   r   r#   rG   r   r   r   r   r%   __classcell__r@   s   @r   r	   r	   F   s          "K#    %-HSM    2
 04:>=A   hsm, !)# 7	
 xc4i(89: 
         r   r	   c                        e Zd ZdZddddeeeeef                           dee         ddf fdZ	d	d
dede
f fdZ xZS )r
   a2  
    A filter for Python files, since this class inherits from [`DefaultFilter`][watchfiles.DefaultFilter]
    it will ignore files and directories that you might commonly want to ignore as well as filtering out
    all changes except in Python files (files with extensions `('.py', '.pyx', '.pyd')`).
    Nr   )r   extra_extensionsr   rQ   r   c                z    dt          |          z   | _        t                                          |           dS )al  
        Args:
            ignore_paths: The paths to ignore, see [`BaseFilter`][watchfiles.BaseFilter].
            extra_extensions: extra extensions to ignore.

        `ignore_paths` and `extra_extensions` can be passed as arguments partly to support [CLI](../cli.md) usage where
        `--ignore-paths` and `--extensions` can be passed as arguments.
        )z.pyz.pyxz.pyd)r   N)r!   
extensionsrM   r%   )r$   r   rQ   r@   s      r   r%   zPythonFilter.__init__   s;     2E:J4K4KKl33333r   r&   r   r'   c                 |    |                     | j                  o!t                                          ||          S r   )endswithrS   rM   r6   )r$   r&   r'   r@   s      r   r6   zPythonFilter.__call__   s0    }}T_--P%''2B2B642P2PPr   )rA   rD   rE   rF   r   r   r   r#   r   r%   rH   r6   rN   rO   s   @r   r
   r
   |   s          >B*,	4 4 4 xc4i(89:4 #3-	4
 
4 4 4 4 4 4"Qx Qs Qt Q Q Q Q Q Q Q Q Q Qr   r
   )loggingr0   r   pathlibr   typingr   r   r   r   __all__	getLoggerloggermainr   r   r	   r
   r   r   r   <module>r]      s    				 				       ; ; ; ; ; ; ; ; ; ; ; ;
7		/	0	0  44 44 44 44 44 44 44 44n3 3 3 3 3J 3 3 3lQ Q Q Q Q= Q Q Q Q Qr   