;
Ïâ"Ic               @   sê   d  Z  d d d d g Z d d l Z d d l Z d d l Z d d l Z Gd „  d e ƒ Z d d	 d
 d g Z d a
 i  Z e e f Z d d d „ Z d „  Z e d k o< x9 e j d d … D]  Z e e e ƒ p d e ƒ q¾ Wn d S(   uê  Generic interface to all dbm clones.

Use

        import dbm
        d = dbm.open(file, 'w', 0o666)

The returned object is a dbm.bsd, dbm.gnu, dbm.ndbm or dbm.dumb
object, dependent on the type of database being opened (determined by
the whichdb function) in the case of an existing dbm.  If the dbm does
not exist and the create or new flag ('c' or 'n') was specified, the
dbm type will be determined by the availability of the modules (tested
in the above order).

It has the following interface (key and data are strings):

        d[key] = data   # store data at key (may override data at
                        # existing key)
        data = d[key]   # retrieve data at key (raise KeyError if no
                        # such key)
        del d[key]      # delete data stored at key (raises KeyError
                        # if no such key)
        flag = key in d # true if the key exists
        list = d.keys() # return a list of all existing keys (slow!)

Future versions may change the order in which implementations are
tested for existence, add interfaces to other dbm-like
implementations.

The open function has an optional second argument.  This can be 'r',
for read-only access, 'w', for read-write access of an existing
database, 'c' for read-write access to a new or existing database, and
'n' for read-write access to a new database.  The default is 'r'.

Note: 'r' and 'w' fail if the database doesn't exist; 'c' creates it
only if it doesn't exist; and 'n' always creates a new database.
u   openu   whichdbu   erroru   errorsi    Nc             B   s   |  Ee  Z d  S(   N(   u   __name__u
   __module__(   u
   __locals__(    (    u)   /mit/python/lib/python3.0/dbm/__init__.pyu   error/   s   
u   dbm.bsdu   dbm.gnuu   dbm.ndbmu   dbm.dumbu   ri¶  c             C   sD  t  d  k o~ x\ t D]T } y t | d d g ƒ} Wn t k
 o w Yn Xt  p
 | a  n | t | <q Wt  p t d t ƒ ‚ q‹ n t |  ƒ } | d  k o8 d | k p d | k o
 t  } q1t d d ƒ ‚ nV | d k o t d d	 ƒ ‚ n5 | t k o t d d
 j | ƒ ƒ ‚ n t | } | j	 |  | | ƒ S(   Nu   fromlistu   openu   no dbm clone found; tried %su   cu   ni    u#   need 'c' or 'n' flag to open new dbu    u   db type could not be determinedu/   db type is {0}, but the module is not available(
   u   _defaultmodu   Noneu   _namesu
   __import__u   ImportErroru   _modulesu   whichdbu   erroru   formatu   open(   u   fileu   flagu   modeu   nameu   modu   result(    (    u)   /mit/python/lib/python3.0/dbm/__init__.pyu   open9   s0     	


c          ,   C   s˜  yl t  j |  d d ƒ } | j ƒ  t j d k o t j d k p$ t  j |  d d ƒ } | j ƒ  n d SWnz t k
 on yO t  j |  d d ƒ } | j ƒ  t d k	 o t j |  ƒ } | j ƒ  d SWn t k
 o Yn XYn Xy€ t	 j
 |  d ƒ t	 j
 |  d ƒ j } | d	 k o d
 St  j |  d d ƒ } z | j d ƒ d k o d
 SWd | j ƒ  XWn t t f k
 o Yn Xy t  j |  d ƒ } Wn t k
 o d SYn X| j d ƒ } | j ƒ  | d	 d … } t | ƒ d k o d Sy t j d | ƒ \ } Wn t j k
 o d SYn X| d k o d Sy# t j d | d d … ƒ \ } Wn t j k
 o d SYn X| d k o d Sd S(   uu  Guess 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 name of the dbm submodule (e.g. "ndbm" or "gnu") if recognized.

    Importing the given module may still fail, and opening the
    database using that module may still fail.
    u   .pagu   rbu   GNU gdbmu   os2emxu   .diru   dbm.ndbmu   .dbu   .dati    u   dbm.dumbi   s   's   "Ni   i   u    u   =liÎšWu   dbm.gnuiüÿÿÿia i au   dbm.bsd(   s   's   "(   ia i a(   u   iou   openu   closeu   ndbmu   libraryu   sysu   platformu   IOErroru   Noneu   osu   statu   st_sizeu   readu   OSErroru   lenu   structu   unpacku   error(   u   filenameu   fu   du   sizeu   s16u   su   magic(    (    u)   /mit/python/lib/python3.0/dbm/__init__.pyu   whichdb[   sf    
 

		


#
u   __main__i   u   UNKNOWN(   u   __doc__u   __all__u   iou   osu   structu   sysu	   Exceptionu   erroru   _namesu   Noneu   _defaultmodu   _modulesu   IOErroru   openu   whichdbu   __name__u   argvu   filenameu   print(    (    (    u)   /mit/python/lib/python3.0/dbm/__init__.pyu   <module>%   s    "	c 