Your IP : 18.216.103.219
�
(��g�����dZgd�ZddlZddlZddlZddlZGd�de�Zgd�Zda iZ
eefZ ddlm
Z
d
d�Zd �Zed
k(r(ej$ddD]Zeee�xsde��yy#e$rdZ
Y�>wxYw)aNGeneric interface to all dbm clones.
Use
import dbm
d = dbm.open(file, 'w', 0o666)
The returned object is a 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, and add interfaces to other dbm-like
implementations.
)�open�whichdb�error�Nc��eZdZy)rN)�__name__�
__module__�__qualname__���3/opt/alt/python312/lib64/python3.12/dbm/__init__.pyrr&s��rr)�dbm.gnu�dbm.ndbm�dbm.dumb)�ndbmc��t�CtD]"} t|dg��}ts|a|t|<�$tstdtz��d|vrt|�nd}|�d|vsd|vrt}nOt
dd��|d k(rt
dd
��|tvrt
ddj|���t|}|j|||�S#t$rY��wxYw)a�Open or create database at path given by *file*.
Optional argument *flag* can be 'r' (default) 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.
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.
Nr)�fromlistzno dbm clone found; tried %s�n�crz=db file doesn't exist; use 'c' or 'n' flag to create a new db�zdb type could not be determinedz/db type is {0}, but the module is not available) �_defaultmod�_names�
__import__�ImportError�_modulesrr�formatr)�file�flag�mode�name�mod�results rrr5s�����D�
� ����9���!�� �H�T�N����<�v�E�F�F�"��o�W�T�]�4�F�
�~��$�;�#��+��C���(�D�E�
E� �2���A�h�8�9�9� �x� ��A�h�#�#)�6�&�>�3� 3��v����8�8�D�$��%�%��5�
��
�s�C� C�Cc���tj|�} tj|dzd�}|j �tj|dzd�}|j �y#t
$rj tj|dzd�}|j �t�'t
j|�}|j �Yyn#t
$rYnwxYwYnwxYw tj|dz�tj|dz�j}|dk(ry tj|dzd�} |jd
�dvr |j �y |j �n#|j �wxYwn#t
$rYnwxYw tj|d�}n#t
$rYywxYw|5|jd�}ddd�n#1swYnxYwdd
}t|�d
k7ry tjd|�\}n#tj$rYywxYw|dvry tjd|dd�\}y#tj$rYywxYw)auGuess 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.
s.pag�rbs.dirrs.dbNs.datrr�)�'�"��rz=l)iΚWi͚WiϚWr
���)�os�fsencode�ior�close�OSErrorr�stat�st_size�read�len�struct�unpackr)�filename�f�d�size�s16�s�magics rrrbs5���{�{�8�$�H���G�G�H�w�&��-�� ��� ��G�G�H�w�&��-�� ��� ����� �����6�)�4�0�A�
�G�G�I����I�I�h�'����� �!� ��� �� ����"
�
����7�"�#��w�w�x�'�)�*�2�2���1�9���G�G�H�w�&��-�� ��v�v�a�y�L�(�!�
�G�G�I�)�
�G�G�I��A�G�G�I��I���
��
����G�G�H�d�#��������
��f�f�R�j��
���� �A�a��A��1�v��{����=�=��q�)�����<�<�����
�4�4����=�=��s�2�3�x�0���
�� �<�<����s��AA*�* C�4AC�
C� C�C�C�C�C�!?F�!F�;E2�F�!F�2F�F� F�F�F/�/ F;�:F;�G�G$�<H�H+�*H+�4I�I&�%I&�__main__r$�UNKNOWN)�ri�)�__doc__�__all__r,r*r3�sys� Exceptionrrrrr.�dbmrrrrr�argvr5�printr
rr�<module>rFs����:'�� � �
�
� �I� �
-����
�� ������
*&�ZW�t�z���H�H�Q�R�L��
�g�h��,�9�h�7�!���W���D��s�A*�*A4�3A4
?>