hNa#.dZdZdZdZdZdZdZy)cddlm}ddl}d}d}g}||}|j||||jd}|D]2}i}	|jD]
\}
}||	|
<|j
|	4|S)N)StringIO,"T)	delimiter	quotecharquotingskipinitialspace)iorcsv
DictReader	QUOTE_ALLitemsappend)	csvStringrrdelimquote	list_dictcsvFilelist_list_tuple
list_tupledictcol_name	col_values            3/home/s/sultans/web/python/demo/etl/util/convert.pycsv2objrsEEIy!GnnWX[XeXex|n}O%
%/%5%5%7!Xy&DN&8	&cddl}|jd}g}i}|jd|d}tdt|dz
D]}d}d}||D]!}	|	dk(s|	dk(r|rd}nd	}|	d
k(r|rd}	||	z
}#|jd|}
d}|
D]J}|j	dd
|}|j	dd|}|j	dd|}||}
|||
<|dz
}L|j|i}|S)Nr
z\s*,\s*Fr'Tr~)resplitrangelensubr)rr$linesrr	col_namesidx
col_stringreplacechar
col_valuesirrs              rcsv2obj_customr1(s"
OOD!EIDE!H-IQs5z!|$
#JDs{dckeG&*Gs{w$J
XXi4

#IsC3IsB3IsB3I |H&DN
FA
$	)%.rc0ddl}|j|}|S)Nr)jsonloads)
jsonStringr3rs   rjson2objr6Os

:&Ircddl}|jd}g}i}|D]T}|jd|}|r(|jd}|jd}|||<?|sB|j	|i}V|S)Nrrz<(.+?)>(.*?)</.+?>r )r$r%searchgroupr)		xmlStringr$r)rrlinefoundrrs	         rxml2objr>\s|
OOD!EID		.t4AHAI&DN  &rcd}|dj}|dj|dzz
}|D]S}|jD]\}}d|vsd|zdz||<|j}|dj|z
}|dz
}U|S)Nr!rz, rrr)keysjoinrvalues)rrr*rrrr/s       robj2csvrCvs
C!!!#I499Y$&&C$(JJL Xii!$i!4X%1[[]
tyy$$t
Krc4ddl}|j|d}|S)Nr)indent)r3dumps)rr3s  robj2jsonrHs::i:*DLrc
d}d}|dz
}|D]8}|dz
}|jD]\}}|dz
}|d|d|d|d	z
}|d
z
}:|dz
}|S)Nr!z<?xml version='1.0'?>
z<root> 
z    <row> 
z        <>z</z> 
z    </row> 
z	</root> 
)r)rxmlrnamevalues     robj2xmlrOs
C$C;C~ JJLLT%JCQtfAeWBtfD11C)	<CKrN)rr1r6r>rCrHrOrr<module>rQs)8 N4,r