Rfc@sBdZddlZyddlZWnek r;dZnXyddlZWnek redZnXyddlZWnek rdZnXyddlZWnek rdZnXddlZyddl Z Wnek rddl Z nXej dZ dZ dZedkr>ejeej dndS(s, Synopsis: %(prog)s [-h|-b|-g|-r|-a|-d] [ picklefile ] dbfile Read the given picklefile as a series of key/value pairs and write to a new database. If the database already exists, any contents are deleted. The optional flags indicate the type of the output database: -a - open using anydbm -b - open as bsddb btree file -d - open as dbm file -g - open as gdbm file -h - open as bsddb hash file -r - open as bsddb recno file The default is hash. If a pickle file is named it is opened for read access. If no pickle file is named, the pickle input is read from standard input. Note that recno databases can only contain integer keys, so you can't dump a hash or btree database using db2pickle.py and reconstitute it to a recno database with %(prog)s unless your keys are integers. iNicCstjjttdS(N(tsyststderrtwritet__doc__tglobals(((s//usr/lib64/python2.7/Tools/scripts/pickle2db.pytusage4sc Csy1tj|dddddddg\}}Wntjk rOtdSXt|d kstt|d krtdSt|dkrtj}|d }nNyt|d d }Wn*tk rtjj d |d dSX|d}d}x|D]\}}|d"krOy t j }Wqt k rKtjj ddSXq|d#kry t j}Wqt k rtjj ddSXq|d$kry t j}Wqt k rtjj ddSXq|d%kry tj}Wqt k rtjj ddSXq|d&krSy tj}Wqt k rOtjj ddSXq|d'kry tj}Wqt k rtjj ddSXqqW|dkrt dkrtjj dtjj ddSt j }ny||d}Wn9t jk r.tjj d |tjj d!dSXx|jD] }||=q<Wx;ytj|\} } Wntk r}PnX| || s6              [