o
    noi                     @   sN   d dl mZmZmZ d dlmZ d dlmZ dddededej	fd	d
Z
dS )    )fieldsis_dataclassMISSING)matchers)CSTNodeFmatch_syntactic_trivianoder   returnc                   s   t | st|  di }t| D ]]}|j}t| |} s(|jdr(t }nB|jt	ur7||jkr7t }n3|j
t	urG||
 krGt }n#t|ttfr\t| fdd|D }nttt|jrjt| d}|||< qttt| j}|di |S )z%Convert a concrete node to a matcher.z is not a CSTNode
whitespacec                 3   s    | ]	}t | d V  qdS )r   N)node_to_matcher).0itemr    K/home/ubuntu/.local/lib/python3.10/site-packages/libcst/helpers/matchers.py	<genexpr>"   s
    

z"node_to_matcher.<locals>.<genexpr>r   Nr   )r   
ValueErrorr   namegetattr
startswithr   	DoNotCaredefaultr   default_factory
isinstancelisttupletypehasattr__name__r   )r	   r   attrsfieldr   childmatcherr   r   r   r      s.   





r   N)dataclassesr   r   r   libcstr   libcst._nodes.baser   boolBaseMatcherNoder   r   r   r   r   <module>   s   