^Rc@sdZddlZddlZddlZyddlZejZWnek rbdZe ZnXdZ e dkrx-ej dD]Z e e pdGe GHqWndS(s0Guess which db package to use to open a db file.iNcCsyqt|tjdd}|jtjdkoBtjdkslt|tjdd}|jndSWn|tk ryQt|tjdd}|jtdk rtj|}|jdSWqtt fk rqXnXytj |tjdtj |tjdj }|d kr8d St|tjdd}z|j d dkrnd SWd|jXWnttfk rnXyt|d}Wntk rdSX|j d}|j|d d!}t|dkrdSytjd|\}Wntjk r,dSX|dkr=dS|dkrMdSytjd|d\}Wntjk rdSX|dkrdSdS( sgGuess which db package to use to open a db file. Return values: - None if the database file can't be read; - empty string if the file can be read but can't be recognized - the module name (e.g. "dbm" or "gdbm") if recognized. Importing the given module may still fail, and opening the database using that module may still fail. tpagtrbsGNU gdbmtos2emxtdirtdbmtdbtdatitdumbdbmit't"Niits=liΚWi͚WiϚWtgdbmiaiatbsddb185itdbhash(RR (iΚWi͚WiϚW(iaia(iaia(topentostextseptcloseRtlibrarytsystplatformtIOErrortNonet _dbmerrortstattst_sizetreadtOSErrortlentstructtunpackterror(tfilenametftdtsizets16tstmagic((s/usr/lib/python2.7/whichdb.pytwhichdbsj             t__main__itUNKNOWN(t__doc__RRRRRRt ImportErrorRRR't__name__targvR (((s/usr/lib/python2.7/whichdb.pyts        b