0Hq?dZddlZddlZddlZddlmZddlmZmZddl m Z ej eZej ej edZej eddZe jeZe jeZejd=e jeej Z e jeej Zd Zdd Zd ZddZdZej Z dS)z Support code for test_*.py filesNdedent)pytreerefactor)driverz..z Grammar.txtprint)convertcTtt|dS)NT)debug)r parse_stringreformatstrings >F ""rlib2to3c|fd|D}ntjdz}|pi}tj||dS)a  A convenience function for creating a RefactoringTool for tests. fixers is a list of fixers for the RefactoringTool to use. By default "lib2to3.fixes.*" is used. options is an optional dictionary of options to be passed to the RefactoringTool. Nc g|] }dz|z S)z .fixes.fix_).0fix fixer_pkgs r z"get_refactorer...s#DDDc)m+c1DDDrz.fixesT)explicit)rget_fixers_from_packageRefactoringTool)r$fixersoptionss` rget_refactorerr+%s\DDDDVDDD1)h2FGGmG  #FGd C C CCrc#KtjtD]B\}}}|D]9}|dr"tj||V:CdS)Nz.py)oswalkproj_direndswithpathjoin)dirpathdirnames filenamesfilenames rall_project_filesr74sw(*(9(966$9! 6 6H  '' 6gll7H55555 666r)NN)rNN)!__doc__rr-os.pathtextwraprrrr lib2to3.pgen2r pgen2_driverr1dirname__file__test_dirnormpathr2r/ grammar_path load_grammargrammargrammar_no_print_statementkeywordsDriverr driver_no_print_statementr rr r+r7TestCaser!rrrIs&& %$$$$$$$000000 7??8 $ $ 7  BGLL488 9 9w||HdM:: #, #L 1 16\6|DD'0  Wfn = = =/L/ N ===4444 ### D D D D666  r