MINI MINI MANI MO

Path : /lib64/python3.6/lib2to3/__pycache__/
File Upload :
Current File : //lib64/python3.6/lib2to3/__pycache__/btm_matcher.cpython-36.opt-2.pyc

3


 \@shdZddlZddlZddlmZddlmZddlmZGddde	Z
Gd	d
d
e	ZiaddZ
dS)
z+George Boutsioukis <gboutsioukis@gmail.com>N)defaultdict)pytree)reduce_treec@seZdZejZddZdS)BMNodecCs"i|_g|_ttj|_d|_dS)N)transition_tablefixersnextrcountidcontent)selfr+/usr/lib64/python3.6/lib2to3/btm_matcher.py__init__szBMNode.__init__N)__name__
__module____qualname__	itertoolsrrrrrrrsrc@s4eZdZddZddZddZddZd	d
ZdS)
BottomMatchercCs0t|_t|_|jg|_g|_tjd|_dS)NZRefactoringTool)	setmatchrrootZnodesr	loggingZ	getLoggerZlogger)rrrrrs

zBottomMatcher.__init__cCsL|jj|t|j}|j}|j||jd}x|D]}|jj|q4WdS)N)start)r	appendrZpattern_treeZget_linear_subpatternaddr)rfixerZtreeZlinearmatch_nodesZ
match_noderrr	add_fixer%s

zBottomMatcher.add_fixercCs|s
|gSt|dtrhg}xF|dD]:}|j||d}x&|D]}|j|j|dd|q>Wq&W|S|d|jkrt}||j|d<n|j|d}|ddr|j|dd|d}n|g}|SdS)Nr)rr)
isinstancetuplerextendrr)rpatternrrZalternativeZ	end_nodesendZ	next_noderrrr1s"
"zBottomMatcher.addc	Cs0|j}tt}x|D]}|}x|r&d|_x,|jD]"}t|tjr8|jdkr8d|_Pq8W|j	dkrp|j}n|j	}||j
kr|j
|}x|jD]"}||krg||<||j|qWnd|j}|j
dk	r|j
jrP||j
kr|j
|}x2|jD](}||jkrg||<||j|qW|j
}q$WqW|S)NT;Fr)rrlistZwas_checkedZchildrenr!rZLeafvaluetyperr	rparentkeys)	rZleavesZcurrent_ac_nodeZresultsZleafZcurrent_ast_nodeZchildZ
node_tokenrrrrrunSs>





zBottomMatcher.runcs*tdfdd|jtddS)Nz
digraph g{cs^xX|jjD]J}|j|}td|j|jt|t|jf|dkrNt|j|qWdS)Nz%d -> %d [label=%s] //%sr)rr+printr	type_reprstrr	r
)ZnodeZsubnode_keyZsubnode)
print_noderrr0s

z*BottomMatcher.print_ac.<locals>.print_node})r-r)rr)r0rprint_acs
zBottomMatcher.print_acN)rrrrr rr,r2rrrrrs
"=rcCsHts<ddlm}x*|jjD]\}}t|tkr|t|<qWtj||S)Nr)python_symbols)_type_reprsZpygramr3__dict__itemsr)int
setdefault)Ztype_numr3namevalrrrr.sr.)
__author__rrcollectionsrrrZ	btm_utilsrobjectrrr4r.rrrr<module>s	

OHA YOOOO