o
    Wi	                     @  s   d dl mZ d dlZd dlZd dlmZ d dlmZ d dlmZ d dl	m
Z d dlmZ d dlmZ d dlmZ d d	lmZ dddZdddZddddZedkrWee dS )     )annotationsN)Iterable)Sequence)apply_defaults)git)load_config)MANIFEST_HOOK_DICT)
Classifier	filenamesIterable[str]includestrexcludereturnboolc                 C  sJ   |dkrdS t |t |}}| D ]}||r"||r" dS qdS )Nz^$TF)recompilesearch)r
   r   r   
include_re
exclude_refilename r   `/home/ubuntu/.local/lib/python3.10/site-packages/pre_commit/meta_hooks/check_useless_excludes.pyexclude_matches_any   s   r   config_fileintc           
   	   C  s   t | }t }t||d |d }d}|d }t|d|s)td|d d}|d D ]A}|d	 D ]:}|d
g  t|t	}|
|j|d
 |d |d }|d |d }	}t||	|smtd|d|d  d d}q3q-|S )Nfilesr   r    zThe global exclude pattern z does not match any files   reposhookstypestypes_orexclude_typeszThe exclude pattern z for id)r   r   get_all_filesr	   from_configr   print
setdefaultr   r   by_typesr
   )
r   configr
   
classifierretvr   repohooknamesr   r   r   r   check_useless_excludes   s>   

r0   argvSequence[str] | Nonec                 C  sF   t  }|jddtjgd || }d}|jD ]}|t|O }q|S )Nr
   *)nargsdefaultr   )argparseArgumentParseradd_argumentCCONFIG_FILE
parse_argsr
   r0   )r1   parserargsr,   r   r   r   r   mainG   s   

r>   __main__)r
   r   r   r   r   r   r   r   )r   r   r   r   )N)r1   r2   r   r   )
__future__r   r6   r   collections.abcr   r   cfgvr   pre_commit.constants	constantsr9   
pre_commitr   pre_commit.clientlibr   r   pre_commit.commands.runr	   r   r0   r>   __name__
SystemExitr   r   r   r   <module>   s"    

(
