usr/lib64/python2.7/dumbdbm.pyc000064400000014640147207516220012207 0ustar00ó m”þfc@skdZddlZddlZddlZejZdZeZ dej fd„ƒYZ ddd„ZdS(s­A dumb and slow but simple dbm clone. For database spam, spam.dir contains the index (a text file), spam.bak *may* contain a backup of the index (also a text file), while spam.dat contains the data (a binary file). XXX TO DO: - seems to contain a bug when updating... - reclaim free space (currently, space once occupied by deleted or expanded items is never reused) - support concurrent access (currently, if two processes take turns making updates, they can mess up the index) - support efficient access to large databases (currently, the whole index is read when the database is opened, and some updates rewrite the whole index) - support opening for read-only (flag = 'm') iÿÿÿÿNit _DatabasecBs¶eZeZeZd„Zd„Zd„ZeZd„Zd„Z d„Z d„Z d„Z d„Z d „Zd „Zd „Zd „ZeZd „Zd„ZeZd„ZRS(cCs²||_|tjd|_|tjd|_|tjd|_d|_yt|jdƒ}Wn3t k r™t|jdƒ}|j |jƒnX|j ƒ|j ƒdS(Ntdirtdattbaktrtw( t_modet_ostextsept_dirfilet_datfilet_bakfiletNonet_indext_opentIOErrort_chmodtcloset_update(tselft filebasenametmodetf((s/usr/lib64/python2.7/dumbdbm.pyt__init__/s    cCszi|_yt|jƒ}Wntk r/nGXx9|D]1}|jƒ}t|ƒ\}}||j|ÏscCs t|jƒS(N(R-R (R((s/usr/lib64/python2.7/dumbdbm.pyt__len__ÓscCs,|jƒd|_|_|_|_dS(N(R"R R R R R (R((s/usr/lib64/python2.7/dumbdbm.pyRÖs cCs/t|jdƒr+|jj||jƒndS(Ntchmod(thasattrRR@R(Rtfile((s/usr/lib64/python2.7/dumbdbm.pyRÜs(t__name__t __module__RRRRR"tsyncR(R0R1R3R9R:R;R<R=R>t__iter__R?Rt__del__R(((s/usr/lib64/python2.7/dumbdbm.pyR"s*             i¶cCsLy tjdƒ}tj|ƒWntk r3n X||@}t||ƒS(sôOpen the database file, filename, and return corresponding object. The flag argument, used to control how the database is opened in the other DBM implementations, is ignored in the dumbdbm module; the database is always opened for update, and will be created if it does not exist. The optional mode argument is the UNIX mode of the file, used only when the database has to be created. It defaults to octal code 0666 (and will be modified by the prevailing umask). i(RtumasktAttributeErrorR(RBtflagRtum((s/usr/lib64/python2.7/dumbdbm.pytopenás  ( t__doc__tosRt __builtin__tUserDictRLRR,RRt DictMixinRR (((s/usr/lib64/python2.7/dumbdbm.pyts    ¿