o
     JAf                     @   s   	 g d Z ddlZddlZddlZddlZG dd deZg dZdai Z	ee
fZzddlmZ W n ey<   dZY nw dd	d
Zdd Zedkr]ejdd D ]ZeeepYde qQdS dS ))openwhichdberror    Nc                   @   s   e Zd ZdS )r   N)__name__
__module____qualname__ r   r   #/usr/lib/python3.10/dbm/__init__.pyr   &   s    r   )dbm.gnudbm.ndbmdbm.dumb)ndbmr  c              	   C   s   	 t d u r-tD ]}z	t|dgd}W n	 ty   Y qw t s |a |t|< qt s-tdt d|vr5t| nd }|d u rLd|v sCd|v rFt }n!td d|dkrVtd d	|tvrctd d
|t| }|| ||S )Nr   )fromlistzno dbm clone found; tried %sncr   z=db file doesn't exist; use 'c' or 'n' flag to create a new db zdb type could not be determinedz/db type is {0}, but the module is not available)	_defaultmod_names
__import__ImportError_modulesr   r   formatr   )fileflagmodenamemodresultr   r   r	   r   5   s4   
r   c                 C   s  	 zt | d d}|  t | d d}|  W dS  tyN   zt | d d}|  td urAt| }|  W Y dS W n	 tyK   Y nw Y nw z;t| d  t| d j}|dkrfW dS t | d d}z|d	d
v r~W |  W dS W |  n|  w W n	 ty   Y nw zt | d}W n
 ty   Y d S w | |d}W d    n1 sw   Y  |dd }t	|dkrdS z	t
d|\}W n t
jy   Y dS w |dv rdS zt
d|dd  \}W dS  t
jy   Y dS w )Nz.pagrbz.dirr   z.dbz.datr   r      )   '   "      r   z=l)iΚWi͚WiϚWr
   )ior   closeOSErrorr   osstatst_sizereadlenstructunpackr   )filenamefdsizeZs16smagicr   r   r	   r   b   sx   
r   __main__r!   ZUNKNOWN)r   r   )__all__r'   r*   r/   sys	Exceptionr   r   r   r   r)   dbmr   r   r   r   r   argvr1   printr   r   r   r	   <module>   s.    
-Y