B A[@sPdZddlmZddlmZmZddlmZmZm Z ddiZ Gddde Z d S) zCFix UserDict. Incomplete! TODO: base this on fix_urllib perhaps? ) fixer_base)Name attr_chain) alternates build_pattern FixImportsUserDict collectionscsTeZdZdZdZeZdZddZfddZ fddZ fd d Z d d Z Z S) FixUserdictTcCsdt|jS)N|)joinrmapping)selfrO/opt/alt/python37/lib/python3.7/site-packages/libfuturize/fixes/fix_UserDict.pyr5szFixUserdict.build_patterncs||_tt|dS)N)rZPATTERNsuperrcompile_pattern)r) __class__rrr8s zFixUserdict.compile_patterncsHtt|j|}|rDd|kr@tfddt|dDr@dS|SdS)Nbare_with_attrc3s|]}|VqdS)Nr).0obj)matchrr Fsz$FixUserdict.match..parentF)rrranyr)rnoderesults)r)rrr?s zFixUserdict.matchcstt|||i|_dS)N)rr start_treereplace)rZtreefilename)rrrrKszFixUserdict.start_treecCs|d}|rl|j}t|j|}|t||jdd|krH||j|<d|kr||}|r|||n2|dd}|j|j}|r|t||jddS)NZ module_name)prefixZ name_importZmultiple_importsrr) getvalueZunicoderrrr!r transform)rrrZ import_modZmod_namenew_nameZ bare_namerrrr$Os    zFixUserdict.transform)__name__ __module__ __qualname__Z BM_compatibleZkeep_line_orderMAPPINGrZ run_orderrrrrr$ __classcell__rr)rrr *s  r N) __doc__Zlib2to3rZlib2to3.fixer_utilrrZlib2to3.fixes.fix_importsrrrr)r rrrrs