
    	D,jj                        d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	m
Z
mZmZ d dlmZ d dlmZ d dlmZ d dlmZ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"  ej#        de$           d dl%m&Z&m'Z'm(Z(  edd)                                          Z*ej+        ej,        e-fZ.dZ/e&rdZ/dZ0 G d d          Z1d Z2d Z3d Z4d Z5e6dk    rej7        dd         Z8g Z9g Z:ej7        dd         D ]CZ; ee;          <                                re9 e2e;          z  Z9.e9=                    e;           D e1d          Z>e>?                    e9e:          Z@ e eAe@                      eBe@           dS dS )     N)Counterdefaultdict
namedtuple)	resources)Path)Cache)TreeContextfilename_to_lang)guess_lexer_for_filename)Token)tqdm)Query)dump)filter_important_files)Spinnerignore)category)USING_TSL_PACKget_language
get_parserTagzrel_fname fname line name kind      zUpdating repo mapc                       e Zd Zde Z e            Z	 	 	 	 	 	 	 	 	 ddZd Z	 	 	 dd	Z	d
 Z
ddZd Zd Zd Zd ZdefdZd Z	 ddZ	 	 	 	 	 ddZ	 	 	 	 ddZ e            Zd Zd ZdS )RepoMapz.aider.tags.cache.v   NF   autoc
                    || _         || _        |	| _        |st          j                    }|| _        |                                  d| _        || _        || _	        || _
        || _        || _        i | _        i | _        i | _        d| _        d | _        | j        r$| j                             d| j	                    d S d S )Ngffffff?r   z+RepoMap initialized with map_mul_no_files: )ioverboserefreshosgetcwdrootload_tags_cachecache_thresholdmax_map_tokensmap_mul_no_filesmax_context_windowrepo_content_prefix
main_model
tree_cachetree_context_cache	map_cachemap_processing_timelast_maptool_output)
self
map_tokensr%   r,   r    r+   r!   r*   r)   r"   s
             \/home/rurouni/.local/share/uv/tools/aider-chat/lib/python3.11/site-packages/aider/repomap.py__init__zRepoMap.__init__/   s      	9;;D	#( 0"4#6 $"$#$ < 	GUd>SUU    	 	    c                 Z   t          |          }|dk     r| j                            |          S |                    d          }t          |          }|dz  pd}|d d |         }d                    |          }| j                            |          }|t          |          z  |z  }|S )N   T)keependsd       )lenr,   token_count
splitlinesjoin)	r3   textlen_textlines	num_linesstepsample_textsample_tokens
est_tokenss	            r5   r?   zRepoMap.token_countY   s    t99c>>?..t444..JJ	C$1fffggenn33K@@"S%5%55@
r7   c                    | j         dk    rd S |sd S |st                      }|st                      }| j         }d}|r5| j        r.t          t	          || j        z            | j        |z
            }nd}|s| j        r|dk    r|}	 |                     ||||||          }	n2# t          $ r% | j        	                    d           d| _         Y d S w xY w|	sd S | j
        r7|                     |	          }
| j                            d|
dz  dd           |rd}nd	}| j        r| j                            |
          }nd	}||	z  }|S )Nr   i   z'Disabling repo map, git repo too large?z
Repo-map: r   .1fz	 k-tokenszother r=   )other)r(   setr*   minintr)   get_ranked_tags_mapRecursionErrorr    
tool_errorr!   r?   r2   r+   format)r3   
chat_filesother_filesmentioned_fnamesmentioned_identsforce_refreshr(   paddingtargetfiles_listing
num_tokensrL   repo_contents                r5   get_repo_mapzRepoMap.get_repo_mapg   s    !##F 	F 	%"uu 	%"uu,  	d5 	NT%::;;''1 FF
 F 	$d5 	$&1**#N	 44   MM  	 	 	GHIII"#DFF	
  	F< 	O))-88JG MZ$-> M M M MNNN 	EEE# 	3:::GGLLL%s   B! !+CCc                 r    	 t           j                            || j                  S # t          $ r |cY S w xY wN)r#   pathrelpathr%   
ValueErrorr3   fnames     r5   get_rel_fnamezRepoMap.get_rel_fname   sE    	7??5$)444 	 	 	 LLL	s   $' 66c                    | j         r,|r*| j                            dt          |                      t	          t          | dd          t                    rdS t          | j                  | j	        z  }	 |
                                rt          j        |           t          |          }d}d||<   ||         }||= || _        dS # t          $ rY}| j                            d| d           | j         r*| j                            dt          |                      Y d}~nd}~ww xY wt                      | _        dS )zPHandle SQLite errors by trying to recreate cache, falling back to dict if neededzTags cache error: 
TAGS_CACHENtestzUnable to use tags cache at z, falling back to memory cachezCache recreation error: )r!   r    tool_warningstr
isinstancegetattrdictr   r%   TAGS_CACHE_DIRexistsshutilrmtreer   rh   SQLITE_ERRORS)r3   original_errorra   	new_cachetest_key_es          r5   tags_cache_errorzRepoMap.tags_cache_error   sm    < 	MN 	MG  !Kc.6I6I!K!KLLLgdL$77>> 	FDI!44	J{{}} $d### dI H"(Ih(#A(# (DOF 	J 	J 	JG  StSSS   | J$$%HA%H%HIII	J &&s   7AC	 	
D,AD''D,c                     t          | j                  | j        z  }	 t          |          | _        d S # t
          $ r }|                     |           Y d }~d S d }~ww xY wr`   )r   r%   ro   r   rh   rs   ry   )r3   ra   rx   s      r5   r&   zRepoMap.load_tags_cache   sr    DI!44	%#DkkDOOO 	% 	% 	%!!!$$$$$$$$$	%s   4 
AAAc                     d S r`    )r3   s    r5   save_tags_cachezRepoMap.save_tags_cache   s    r7   c                     	 t           j                            |          S # t          $ r! | j                            d|            Y d S w xY w)NzFile not found error: )r#   ra   getmtimeFileNotFoundErrorr    rj   rd   s     r5   	get_mtimezRepoMap.get_mtime   se    	C7##E***  	C 	C 	CG  !A%!A!ABBBBBB	Cs   ! 'AAc                    |                      |          }|g S |}	 | j                            |          }nF# t          $ r9}|                     |           | j                            |          }Y d }~nd }~ww xY w|l|                    d          |k    rS	 | j        |         d         S # t          $ r2}|                     |           | j        |         d         cY d }~S d }~ww xY wt          |                     ||                    }	 ||d| j        |<   |                                  n9# t          $ r,}|                     |           ||d| j        |<   Y d }~nd }~ww xY w|S )Nmtimedata)r   r   )r   rh   getrs   ry   listget_tags_rawr}   )r3   re   	rel_fname
file_mtime	cache_keyvalrx   r   s           r5   get_tagszRepoMap.get_tags   s   ^^E**
I		1/%%i00CC 	1 	1 	1!!!$$$/%%i00CCCCCC	1 ?swww//:==:y1&99  : : :%%a(((y1&9999999:
 D%%eY7788	M3=t)L)LDOI&  """" 	M 	M 	M!!!$$$3=t)L)LDOI&&&&&&	M sK   8 
A;/A66A;B- -
C)7'C$C)$C)!D2 2
E(<"E##E(queryc                     t          |d          r|                    |          S ddlm}  ||          }|                    |          S )Ncapturesr   )QueryCursor)hasattrr   tree_sitterr   )r3   r   noder   cursors        r5   _run_captureszRepoMap._run_captures
  s]     5*%% 	(>>$''' 	,+++++U##t$$$r7   c           	   #     K   t          |          }|sd S 	 t          |          }t          |          }n-# t          $ r }t	          d| d|            Y d }~d S d }~ww xY wt          |          }|                                sd S |                                }| j                            |          }|sd S |	                    t          |d                    }	|                     t          ||          |	j                  }
t          t                    }g }|
                                D ]W\  }}|D ]}||                             |           ||                             |           |                    ||f           Xt$          rd |                                D             }n|}t'                      }|D ]\  }}|                    d          rd}n|                    d          rd}n6|                    |           t-          |||j                            d          ||j        d	         
          }|V  d|v rd S d|vrd S 	 t5          ||          }n# t          $ r Y d S w xY wt          |                    |                    }d |D             }|D ]}t-          |||dd
          V  d S )NzSkipping file : zutf-8c                 &    g | ]\  }}|D ]}||fS r|   r|   ).0tagnodesr   s       r5   
<listcomp>z(RepoMap.get_tags_raw.<locals>.<listcomp>9  s/    aaae[`aaSW$aaaar7   zname.definition.defzname.reference.refr   )r   re   namekindlinec                 F    g | ]}|d          t           j        v |d         S )r   r<   )r   Name)r   tokens     r5   r   z(RepoMap.get_tags_raw.<locals>.<listcomp>b  s,    IIIu%(ej2H2H%(2H2H2Hr7   )r
   r   r   	Exceptionprintget_scm_fnamerp   	read_textr    parsebytesr   r   	root_noder   r   itemsappendr   rM   
startswithaddr   rB   decodestart_pointr   
get_tokens)r3   re   r   langlanguageparsererr	query_scmcodetreer   captures_by_tagmatchesr   r   r   	all_nodessawr   resultlexertokensr   s                          r5   r   zRepoMap.get_tags_raw  sa     && 	F	#D))H%%FF 	 	 	1511C11222FFFFF	 "$''	!! 	F''))	w  '' 	F||E$0011 %%eHi&@&@$.QQ%d++"..** 	( 	(JC 2 2$++D1111C ''---NND#;'''' 	 aa7L7L7N7NaaaIIIee" 	 	ID#~~011  122 GGDMMM#Y%%g..%a(  F LLLLC<<FF	,UD99EE 	 	 	FF	 e&&t,,--IIIII 	 	E#      	 	s'   6 
A  AA I% %
I32I3c           	      (    dd l }t          t                    }t          t                    }t          t                    }	t	                      }
t          |                              t          |                    }t                      }t          |          }dt          |          z  }	 t           j                  }n@# t          $ r3} 
                    |           t           j                  }Y d }~nd }~ww xY wt          |          |z
  dk    r. j                            d           t          |d          }d}nd}|D ]L} j        r j                            d|            |r|s |t           d	|            	 t!          |                                          }n# t$          $ r d}Y nw xY w|s[| j        vrQ j                            d
|             j                            d            j                            |           ҉                     |          }d}||v r||z  }|                    |           ||v rt/          ||          }t!          |          }t          |j                  }|j        }t4          j                            |          \  }}|                    ||h          }|                    |          }|r||z  }|dk    r||
|<   t                               ||                    }||D ]}}|j        dk    rE||j                                     |           ||j        f}|	|                             |           R|j        dk    r ||j                                      |           ~N|s+t	          d |!                                D                       }t          |"                                                              t          |"                                                    }|#                                } |"                                D ]+}!|!|v r||!         D ]}"| $                    |"|"d|!           ,|D ]\}!|r |t           d	|!            ||!         }#d}$d|!v otK          d |!D                       }%d|!v otK          d |!D                       }&tK          d |!D                       otK          d |!D                       }'|!|v r|$dz  }$|%s|&s|'rt          |!          dk    r|$dz  }$|!&                    d          r|$dz  }$t          ||!                   dk    r|$dz  }$tO          ||!                   !                                D ]E\  }(})|#D ]=}"|$}*|(|v r|*dz  }*tQ          j)        |)          })| $                    |(|"|*|)z  |!           >F^|s	 |
rt	          |
|
          }+nt	                      }+	  |j*        | fddi|+},n=# tV          $ r0 	 |*                    | d          },n# tV          $ r g cY cY S w xY wY nw xY wt          tX                    }-| j-        D ]}.|r |t           d	|.            |,|.         }/t]          d  | /                    |.d!          D                       }0| /                    |.d!          D ]7\  }1}2}3|/|3d         z  |0z  |3d"<   |3d#         }!|-|2|!fxx         |3d"         z  cc<   8g }4t          |-!                                dd$ %          }-|-D ]5\  \  }}!}5||v r|4t          |	0                    ||!fg                     z  }46t           fd&|D                       }6t          d' |4D                       }7t          d( |,!                                D             d)          }8|8D ]8\  }5}||6v r|61                    |           ||7vr|4                     |f           9|6D ]}|4                     |f           |4S )*Nr   r;   zEInitial repo scan can be slow in larger repos, but only happens once.zScanning repo)descTFzProcessing r   zRepo-map can't include z:Has it been deleted from the file system but not from git?g        r   r   c              3   >   K   | ]\  }}|t          |          fV  d S r`   )r   )r   kvs      r5   	<genexpr>z*RepoMap.get_ranked_tags.<locals>.<genexpr>  s0      GGtq!q$q''lGGGGGGr7   g?)weightident      ?rw   c              3   >   K   | ]}|                                 V  d S r`   isalphar   cs     r5   r   z*RepoMap.get_ranked_tags.<locals>.<genexpr>  *      -I-Iaaiikk-I-I-I-I-I-Ir7   -c              3   >   K   | ]}|                                 V  d S r`   r   r   s     r5   r   z*RepoMap.get_ranked_tags.<locals>.<genexpr>  r   r7   c              3   >   K   | ]}|                                 V  d S r`   )isupperr   s     r5   r   z*RepoMap.get_ranked_tags.<locals>.<genexpr>  s*      661199;;666666r7   c              3   >   K   | ]}|                                 V  d S r`   )islowerr   s     r5   r   z*RepoMap.get_ranked_tags.<locals>.<genexpr>  s*      >Z>Zqqyy{{>Z>Z>Z>Z>Z>Zr7   
   r      2   )personalizationdanglingr   )r   c              3   .   K   | ]\  }}}|d          V  dS )r   Nr|   )r   _src_dstr   s       r5   r   z*RepoMap.get_ranked_tags.<locals>.<genexpr>  s-      bb2B$dtH~bbbbbbr7   )r   rankr   c                 "    | d         | d         fS )Nr<   r   r|   )xs    r5   <lambda>z)RepoMap.get_ranked_tags.<locals>.<lambda>%  s    QqT1Q4L r7   )reversekeyc              3   B   K   | ]}                     |          V  d S r`   rf   r   re   r3   s     r5   r   z*RepoMap.get_ranked_tags.<locals>.<genexpr>0  s1      +`+`%D,>,>u,E,E+`+`+`+`+`+`r7   c              3   &   K   | ]}|d          V  dS r   Nr|   )r   rts     r5   r   z*RepoMap.get_ranked_tags.<locals>.<genexpr>2  s&      %B%Bbe%B%B%B%B%B%Br7   c                     g | ]	\  }}||f
S r|   r|   )r   r   r   s      r5   r   z+RepoMap.get_ranked_tags.<locals>.<listcomp>4  s     KKKLT4D$<KKKr7   )r   )2networkxr   rM   r   rn   unionsortedr>   rh   rs   ry   r    r2   r   r!   UPDATING_REPO_MAP_MESSAGEr   is_fileOSErrorwarned_filesrj   r   rf   maxpartsr   r#   ra   splitextintersectionr   r   r   r   keysMultiDiGraphadd_edgeanyr   r   mathsqrtpagerankZeroDivisionErrorfloatr   sum	out_edgesr   remove)9r3   chat_fnamesother_fnamesrV   rW   progressnxdefines
referencesdefinitionsr   fnameschat_rel_fnamespersonalize
cache_sizerx   showing_barre   file_okr   current_perspath_objpath_componentsbasename_with_extbasename_without_extrw   components_to_checkmatched_identstagsr   r   identsGr   definerdefinersmulis_snakeis_kebabis_camel
referencernum_refsuse_mul	pers_argsrankedranked_definitionssrcsrc_ranktotal_weightr   dstr   ranked_tagsr   rel_other_fnames_without_tagsfnames_already_includedtop_ranks9   `                                                        r5   get_ranked_tagszRepoMap.get_ranked_tagsm  s	    	c"" &&
!#&&&&[!!''L(9(9::%% CKK'	.T_--JJ 	. 	. 	.!!!$$$T_--JJJJJJ	. v;;#c))GW   &777FKKK :	; :	;E| ;##$9%$9$9::: B B5@@@@AAA u++--//          111G(()J5)J)JKKKG''T   %))%000 **511IL##+##I...,,,"<== IH!(.11O (&(g&6&67H&I&I# !"1"7"79JL`8a"b"b0==>NOON ,+a-9	*eY7788D| ; ;8u$$CH%)))444$ch/C$((----X&&sx(//	:::;  	HGGw}}GGGGGJW\\^^$$11#joo6G6G2H2HIIOO
 \\^^ 	F 	FE
"""5> F F

7GCu
EEEEF  !	\ !	\E B5@@@@AAAu~HCuI#-I-I5-I-I-I*I*IHuI#-I-I5-I-I-I*I*IH6666666Z3>Z>ZTY>Z>Z>Z;Z;ZH(((r	 H  c%jjAoor	$$ s
75>""Q&&s
(/
50A(B(B(H(H(J(J \ \$
H' \ \G
 "G!_442  $y22HJJz77X;MUZJ[[[[\\  	 	_WWWIII	 R[AA8AyAAFF  	 	 	Qx88$   					 	 )//7 
	A 
	AC @5>>>>???c{HbbakkRU\`kFaFabbbbbL#$;;s;#>#> A Ac4'$x.8<GVW"C<000DL@0000A
 #$$&&:P:P
 
 
 %7 	E 	E NUED''4 C CDDDKK(++`+`+`+`S_+`+`+`(`(`%"%%B%Bk%B%B%B"B"BKKFLLNNKKKUYZZZ# 	- 	-KD%555-44U;;;333""E8,,,2 	) 	)Ex((((s`   /C 
D)C<<D!F//F>=F>4X 
X?X('X?(X94X?8X99X?>X?c                    |rt          t          |                    nd |rt          t          |                    nd |g}| j        dk    rC||rt          t          |                    nd |rt          t          |                    nd gz  }t          |          }d}|sc| j        dk    r| j        r| j        S | j        dk    rd}n$| j        dk    rd}n| j        dk    r| j        dk    }|r|| j        v r| j        |         S t          j                    }	|                     |||||          }
t          j                    }||	z
  | _        |
| j        |<   |
| _        |
S )Nr   FmanualalwaysfilesTr   )tupler   r"   r1   r0   r/   timeget_ranked_tags_map_uncached)r3   r  r  r(   rV   rW   rX   r   	use_cache
start_timer   end_times               r5   rP   zRepoMap.get_ranked_tags_map@  s    +6?E&%%&&&4+7AE&&&'''T
	 <6!!3CMf-..///3CMf-../// I )$$		 	1|x''DM'}$|x''!		(( 		'' 4s:	  1Y$.88~i00 Y[[
22~7GIY
 
 9;;#+j#8  %+y!r7   c                     |st                      }|s j        }|st                      }|st                      }t          t                    }                     |||||j                  }t          t           fd|D                                 }t          |          }	t          d |D                       fd|	D             }	d |	D             }	|	|z   }|                                 t          |          }
d}|
}d }d}t           fd|D                       }t                       _        t          t          |dz            |
          }||k    r|d	k    r
|d
z  dd}nt          |          }|                    t           d| d                                |d |         |          }                     |          }t#          ||z
            |z  }d}||k    r||k    s||k     r|}|}||k     rn,||k     r|dz   }n|dz
  }t          ||z   dz            }||k    |                                 |S )N)r  c              3   B   K   | ]}                     |          V  d S r`   r   r   s     r5   r   z7RepoMap.get_ranked_tags_map_uncached.<locals>.<genexpr>  s1      %Z%ZEd&8&8&?&?%Z%Z%Z%Z%Z%Zr7   c              3   &   K   | ]}|d          V  dS r   r|   )r   r   s     r5   r   z7RepoMap.get_ranked_tags_map_uncached.<locals>.<genexpr>  s&       ? ?CQ ? ? ? ? ? ?r7   c                     g | ]}|v|	S r|   r|   )r   fnranked_tags_fnamess     r5   r   z8RepoMap.get_ranked_tags_map_uncached.<locals>.<listcomp>  s$    VVVCU9U9U"9U9U9Ur7   c                     g | ]}|fS r|   r|   )r   r=  s     r5   r   z8RepoMap.get_ranked_tags_map_uncached.<locals>.<listcomp>  s    999B2%999r7   r   c              3   B   K   | ]}                     |          V  d S r`   r   r   s     r5   r   z7RepoMap.get_ranked_tags_map_uncached.<locals>.<genexpr>  s1      QQEd0077QQQQQQr7      i  g     @@rK   Kr   z tokensg333333?r<      )r   r(   rM   r   r   r.  rF   r   r   r>   rn   r-   rN   rO   rk   to_treer?   absend)r3   r  r  r(   rV   rW   spinr*  other_rel_fnamesspecial_fnamesnum_tagslower_boundupper_bound	best_treebest_tree_tokensr  middleshow_tokensr   r\   pct_errok_errr>  s   `                     @r5   r5  z$RepoMap.get_ranked_tags_map_uncachedu  s     	"66L 	1!0N 	%"uu 	%"uu011**Y + 
 
 "#%Z%Z%Z%Z\%Z%Z%Z"Z"Z[[/0@AA  ? ?; ? ? ???VVVV~VVV99.999${2		{##	QQQQ[QQQQQ&&S2-..99[(( }}!'&7777!&kkII2JJkJJJKKK<<GVG 4oFFD))$//J*~566GGFn,,>N1N1NSZ]cScSc 	#- V##N**$qj$qj+39::F5 [((8 	


r7   c                 l   |                      |          }|t          t          |                    |f}|| j        v r| j        |         S || j        vs| j        |         d         |k    r\| j                            |          pd}|                    d          s|dz  }t          ||dddddddd
  
        }||d| j        |<   | j        |         d         }t                      |_
        |                    |           |                                 |                                }|| j        |<   |S )	Nr   r=   
Fr   )colorline_numberchild_context	last_linemargin	mark_loisloi_padshow_top_of_file_parent_scope)contextr   r]  )r   r3  r   r-   r.   r    r   endswithr	   rM   lines_of_interestadd_lines_of_interestadd_contextrS   )	r3   	abs_fnamer   loisr   r   r   r]  ress	            r5   render_treezRepoMap.render_tree  sT   y))%t--u5$/!!?3'' T444&y1':eCC7$$Y//52D==&& !!#.3  G >Eu1U1UD#I.))4Y?$'EE!%%d+++nn"
r7   c                    |sdS d }d }d }d}d}t          |          |gz   D ]}|d         }	|	|v r|	|k    rZ|*|dz  }||dz   z  }||                     |||          z  }d }n|r|d|z   dz   z  }t          |          t          u r	g }|j        }|	}||                    |j                   d                    d |                                D                       dz   }|S )Nr=   r`   r   rT  z:
c                 "    g | ]}|d d         S )Nr;   r|   )r   r   s     r5   r   z#RepoMap.to_tree.<locals>.<listcomp>  s     GGG4D#JGGGr7   )	r   re  typer   re   r   r   rA   r@   )
r3   r  r  	cur_fnamecur_abs_fnamerc  output	dummy_tagr   this_rel_fnames
             r5   rD  zRepoMap.to_tree  s<    	2	 	$<<9+- 	& 	&C VN00 **#dNFi%//Fd..}iNNNFDD 6dY.55F99##D$'IM*	CH%%% GG63D3D3F3FGGGHH4Or7   )	r   NNNNFNr   r   )NNFr`   )NNNNF)NNNN)__name__
__module____qualname__CACHE_VERSIONro   rM   r   r6   r?   r^   rf   ry   r&   r}   r   r   r   r   r   r.  rP   r5  rn   r-   re  rD  r|   r7   r5   r   r   *   s       :=::N355L  ( ( ( (T  $ @ @ @ @D  &! &! &! &!P% % %  C C C  B%5 % % % %T T Tn W[Q Q Q Ql 3 3 3 3p M M M M^ J$ $ $L$ $ $ $ $r7   r   c                     t           j                            |           s| gS g }t          j        |           D ]>\  }}}|D ]5}|                    t           j                            ||                     6?|S r`   )r#   ra   isdirwalkr   rA   )	directory	src_filesr%   dirsr2  files         r5   find_src_filesry    s    7==## {IWY// 7 7dE 	7 	7DRW\\$556666	7r7   c                      t          j                     } d t          j        | dd          D             \  }}}d|d|d|d}|S )Nc                 2    g | ]}t          |d z            S )   )rO   )r   r   s     r5   r   z$get_random_color.<locals>.<listcomp>   s"    GGGs1s7||GGGr7   r<   g      ?#02x)randomcolorsys
hsv_to_rgb)huergbrd  s        r5   get_random_colorr    sZ    
-//CGGX%8a%F%FGGGGAq!
#a
#
#Q
#
#A
#
#
#CJr7   c                 P   t           r[d}	 t          j        t                                        d||  d          }|                                r|S n# t          $ r Y nw xY wd}	 t          j        t                                        d||  d          S # t          $ r Y d S w xY w)Nztree-sitter-language-packqueriesz	-tags.scmztree-sitter-languages)r   r   r2  __package__joinpathrp   KeyError)r   subdirra   s      r5   r   r   %  s     ,		?;//88""" D
 {{}}  	 	 	D	 %F{++44
 
 	

    s$   AA 
A A &0B 
B%$B%c                     ddl m}  d}t          d |                                 D                       }|D ]Q\  }}t	          |          }t          |                                          rdnd}d}|d|dd	|dd	|d
d	|dd	z  }R|dz  }|S )Nr   )PARSERSze
| Language | File extension | Repo map | Linter |
|:--------:|:--------------:|:--------:|:------:|
c              3   $   K   | ]\  }}||fV  d S r`   r|   )r   exr   s      r5   r   z-get_supported_languages_md.<locals>.<genexpr>G  s*      ==T4*======r7   u   ✓r=   z| 20z | z^8z^6z |
rT  )grep_ast.parsersr  r   r   r   r   rp   )r  rd  r   r   extr=  repo_maplinter_supports           r5   get_supported_languages_mdr  @  s    ((((((C ==W]]__=====D S S	c4   HHOO--5552RDRRRRRR8RRR>RRRRR4KCJr7   __main__r<   .)r%   )Cr  r   r#   r  rq   sqlite3sysr4  warningscollectionsr   r   r   	importlibr   pathlibr   	diskcacher   grep_astr	   r
   pygments.lexersr   pygments.tokenr   r   r   r   
aider.dumpr   aider.specialr   aider.waitingr   simplefilterFutureWarninggrep_ast.tslr   r   r   splitr   OperationalErrorDatabaseErrorr   rs   rq  r   r   ry  r  r   r  rn  argvr
  r  r  re   is_dirr   rmrP   r  r>   r   r|   r7   r5   <module>r     s     				    



   8 8 8 8 8 8 8 8 8 8                   2 2 2 2 2 2 2 2 4 4 4 4 4 4                               0 0 0 0 0 0 ! ! ! ! ! !  h 7 7 7 7 A A A A A A A A A Aj8>>@@AA )7+@'J  M/ f f f f f f f fR      6  ( zXabb\FKL!"" & &4;; 	&>>%000KKu%%%%	c			B%%k<@@HDX	E(OOOOO r7   