Your IP : 216.73.216.213
3
� f� � - @ s d Z ddlZyddlZW n ek
r0 dZY nX yddljZW n ek
rX dZY nX yddljZ W n ek
r� dZ Y nX yddljZ
W n ek
r� dZ
Y nX ddlZyddlZW n ek
r� ddlZY nX ej
d Zdd� Zdd� Zedk�rejeej
dd� �� dS ) aM
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 dbm (open any supported format)
-b - open as bsddb btree file
-d - open as dbm.ndbm file
-g - open as dbm.gnu 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.
� Nc C s t jjtt� � d S )N)�sys�stderr�write�__doc__�globals� r r �</opt/alt/python36/lib64/python3.6/Tools/scripts/pickle2db.py�usage4 s r c # C s y"t j | dddddddg�\}} W n t jk
r> t� dS X t| �d ksXt| �d
krbt� dS t| �dkr~tj}| d }nDyt| d d�}W n( tk
r� tjj d| d � dS X | d }d }�xj|D �]`\}}|d"k�ry
t
j}W n" tk
�r tjj d� dS X q�|d#k�rLy
t
j
}W n" tk
�rH tjj d� dS X q�|d$k�r�y
t
j}W n" tk
�r� tjj d� dS X q�|d%k�r�y
tj}W n" tk
�r� tjj d� dS X q�|d&k�r�y
tj}W n" tk
�r� tjj d� dS X q�|d'kr�y
tj}W q� tk
�r. tjj d� dS X q�W |d k�rjt
d k�rdtjj d� tjj d� dS t
j}y||d�}W n4 t
jk
�r� tjj d | � tjj d!� dS X xt|j� �D ]}||= �q�W x:ytj|�\} }
W n tk
�r� P Y nX |
|| <