AlkantarClanX12

Your IP : 18.219.207.115


Current Path : /proc/self/root/opt/alt/python311/lib64/python3.11/dbm/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python311/lib64/python3.11/dbm/__pycache__/__init__.cpython-311.pyc

�

c��f����dZgd�ZddlZddlZddlZddlZGd�de��Zgd�Zda	iZ
eefZ	ddlm
Z
n
#e$rdZ
YnwxYwdd
�Zd�Zedkr)ejd
d�D]Zeee��pde���dSdS)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��eZdZdS)rN)�__name__�
__module__�__qualname__���3/opt/alt/python311/lib64/python3.11/dbm/__init__.pyrr&s�������Drr)�dbm.gnu�dbm.ndbm�dbm.dumb)�ndbm�r�c�&�t�_tD]9}	t|dg���}n#t$rY�"wxYwts|a|t|<�:tstdtz���d|vrt|��nd}|�%d|vsd|vrt}nnt
dd���|d	krt
dd
���|tvr(t
dd�|�����t|}|�|||��S)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      rrr5sM�����	!�	!�D�
� ����9�9�9�����
�
�
���
�����
"�!�� �H�T�N�N��	G��<�v�E�F�F�F�"��o�o�W�T�]�]�]�4�F�
�~��$�;�;�#��+�+��C�C���(�D�E�E�
E�	�2����A�h�8�9�9�9�	�x�	�	��A�h�#�#)�6�&�>�>�3�3�	3��v����8�8�D�$��%�%�%s�%�
2�2c�.�tj|��}	tj|dzd��}|���tj|dzd��}|���dS#t
$rs	tj|dzd��}|���t�+t
j|��}|���YdSn#t
$rYnwxYwYnwxYw	tj|dz��tj|dz��j}|dkrd	Stj|dzd��}	|�	d
��dvr	|���d	S	|���n#|���wxYwn#t
$rYnwxYw	tj|d��}n#t
$rYdSwxYw|5|�	d��}ddd��n#1swxYwY|dd
�}t|��d
krdS	tjd|��\}n#tj
$rYdSwxYw|dvrdS	tjd|dd���\}n#tj
$rYdSwxYwdS)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       rrrbs0���{�8�$�$�H���G�H�w�&��-�-��	���	�	�	��G�H�w�&��-�-��	���	�	�	��z������	����6�)�4�0�0�A�
�G�G�I�I�I����I�h�'�'�����	�	�	�!�z�z� ���	�	�	��D�	����������"
�
���7�"�#�#�#��w�x�'�)�*�*�2���1�9�9��:��G�H�w�&��-�-��	��v�v�a�y�y�L�(�(�!�
�G�G�I�I�I�I�I�)�
�G�G�I�I�I�I��A�G�G�I�I�I�I����I���
�
�
���
������G�H�d�#�#���������t�t�����
����f�f�R�j�j��������������������	�A�a�C��A��1�v�v��{�{��r���=��q�)�)������<�����r�r�����
�4�4�4��y���=��s�2�3�3�x�0�0������<�����r�r������2s��AA0�0
C-�;AC�C-�
C'�$C-�&C'�'C-�,C-�19F#�,F#�F	�F#�4F#�	F�F#�#
F0�/F0�4G
�

G�G�G?�?H�H�*I�I�I�I?�?J�J�__main__r&�UNKNOWN)rr)�__doc__�__all__r.r,r5�sys�	Exceptionrrrrr0�dbmrrrrr�argvr7�printr
rr�<module>rGsM����:'�
&�
&��	�	�	�	�	�	�	�	�
�
�
�
�
�
�
�
�	�	�	�	�	�I�	�	�	�
-�	,�	,����
��	������������������D�D�D�����*&�*&�*&�*&�ZW�W�W�t�z����H�Q�R�R�L�8�8��
��g�g�h���,�9�h�7�7�7�7���8�8s�9�A�A