https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/boto/sdb/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/boto/sdb/__pycache__/domain.cpython-310.pyc
o

ckF[8�@s�ddlmZ	ddlmZddlmZGdd�de�ZGdd�de�Zddl	Z	dd	l
mZGd
d�de�Zddl
mZGd
d�de�ZdS)�)�print_function��SelectResultSet)�sixc@s�eZdZd)dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	d*dd�Z	d+dd�Z
		d,dd�Z		d)dd�Zdd�Z
d-dd�Zd.dd�Zdd �Zd!d"�Zd/d#d$�Zd%d&�Zd'd(�ZdS)0�DomainNcCs||_||_d|_dS�N)�
connection�name�	_metadata)�selfrr	�r�1/usr/lib/python3/dist-packages/boto/sdb/domain.py�__init__ s
zDomain.__init__cCs
d|jS)Nz	Domain:%s)r	�rrrr
�__repr__%s
zDomain.__repr__cCst|�d|j��S)NzSELECT * FROM `%s`)�iter�selectr	rrrr
�__iter__(szDomain.__iter__cC�dSrr�rr	�attrsrrrr
�startElement+�zDomain.startElementcCs"|dkr	||_dSt|||�dS)N�
DomainName)r	�setattr�rr	�valuerrrr
�
endElement.s
zDomain.endElementcCs|js
|j�|�|_|jSr)r
r�domain_metadatarrrr
�get_metadata4szDomain.get_metadataTcC�|j�|||||�S)a�
        Store attributes for a given item.

        :type item_name: string
        :param item_name: The name of the item whose attributes are being stored.

        :type attribute_names: dict or dict-like object
        :param attribute_names: The name/value pairs to store as attributes

        :type expected_value: list
        :param expected_value: If supplied, this is a list or tuple consisting
            of a single attribute name and expected value. The list can be
            of the form:

             * ['name', 'value']

            In which case the call will first verify that the attribute
            "name" of this item has a value of "value".  If it does, the delete
            will proceed, otherwise a ConditionalCheckFailed error will be
            returned. The list can also be of the form:

             * ['name', True|False]

            which will simply check for the existence (True) or non-existence
            (False) of the attribute.

        :type replace: bool
        :param replace: Whether the attribute values passed in will replace
                        existing values or will be added as addition values.
                        Defaults to True.

        :rtype: bool
        :return: True if successful
        )r�put_attributes)r�	item_name�
attributes�replace�expected_valuerrr
r!9s$�zDomain.put_attributescCs|j�|||�S)a�
        Store attributes for multiple items.

        :type items: dict or dict-like object
        :param items: A dictionary-like object.  The keys of the dictionary are
                      the item names and the values are themselves dictionaries
                      of attribute names/values, exactly the same as the
                      attribute_names parameter of the scalar put_attributes
                      call.

        :type replace: bool
        :param replace: Whether the attribute values passed in will replace
                        existing values or will be added as addition values.
                        Defaults to True.

        :rtype: bool
        :return: True if successful
        )r�batch_put_attributes)r�itemsr$rrr
r&`szDomain.batch_put_attributesFcCr )aU
        Retrieve attributes for a given item.

        :type item_name: string
        :param item_name: The name of the item whose attributes are being retrieved.

        :type attribute_names: string or list of strings
        :param attribute_names: An attribute name or list of attribute names.  This
                                parameter is optional.  If not supplied, all attributes
                                will be retrieved for the item.

        :rtype: :class:`boto.sdb.item.Item`
        :return: An Item mapping type containing the requested attribute name/values
        )r�get_attributes)rr"�attribute_name�consistent_read�itemrrr
r(us�zDomain.get_attributescCs|j�||||�S)a�
        Delete attributes from a given item.

        :type item_name: string
        :param item_name: The name of the item whose attributes are being deleted.

        :type attributes: dict, list or :class:`boto.sdb.item.Item`
        :param attributes: Either a list containing attribute names which will cause
                           all values associated with that attribute name to be deleted or
                           a dict or Item containing the attribute names and keys and list
                           of values to delete as the value.  If no value is supplied,
                           all attribute name/values for the item will be deleted.

        :type expected_value: list
        :param expected_value: If supplied, this is a list or tuple consisting
            of a single attribute name and expected value. The list can be of
            the form:

             * ['name', 'value']

            In which case the call will first verify that the attribute "name"
            of this item has a value of "value".  If it does, the delete
            will proceed, otherwise a ConditionalCheckFailed error will be
            returned. The list can also be of the form:

             * ['name', True|False]

            which will simply check for the existence (True) or
            non-existence (False) of the attribute.

        :rtype: bool
        :return: True if successful
        )r�delete_attributes)rr"r#�expected_valuesrrr
r,�s#�zDomain.delete_attributescC�|j�||�S)a�
        Delete multiple items in this domain.

        :type items: dict or dict-like object
        :param items: A dictionary-like object.  The keys of the dictionary are
            the item names and the values are either:

                * dictionaries of attribute names/values, exactly the
                  same as the attribute_names parameter of the scalar
                  put_attributes call.  The attribute name/value pairs
                  will only be deleted if they match the name/value
                  pairs passed in.
                * None which means that all attributes associated
                  with the item should be deleted.

        :rtype: bool
        :return: True if successful
        )r�batch_delete_attributes)rr'rrr
r/�szDomain.batch_delete_attributes�cCst|||||d�S)a
        Returns a set of Attributes for item names within domain_name that match the query.
        The query must be expressed in using the SELECT style syntax rather than the
        original SimpleDB query language.

        :type query: string
        :param query: The SimpleDB query to be performed.

        :rtype: iter
        :return: An iterator containing the results.  This is actually a generator
                 function that will iterate across all search results, not just the
                 first page.
        )�	max_items�
next_tokenr*r)r�queryr2r*r1rrr
r�s
�z
Domain.selectcCs |j||d�}|r||_|SdS)a�
        Retrieves an item from the domain, along with all of its attributes.

        :param string item_name: The name of the item to retrieve.
        :rtype: :class:`boto.sdb.item.Item` or ``None``
        :keyword bool consistent_read: When set to true, ensures that the most
                                       recent data is returned.
        :return: The requested item, or ``None`` if there was no match found
        )r*N)r(�domain)rr"r*r+rrr
�get_item�s

zDomain.get_itemcCr.r)r�item_cls�rr"rrr
�new_item�szDomain.new_itemcCs|�|j�dSr)r,r	)rr+rrr
�delete_item�szDomain.delete_itemcCs|sddlm}|�}td|d�td|j|d�|D]_}td|j|d�|D]K}td||d�||}t|t�s?|g}|D],}tdd	|d
�t|tj�rW|�dd�}ntj|dd
��dd�}|�	|�td|d�qAtd|d�q)td|d�qtd|d�|�
�|�d�|S)z�Get this domain as an XML DOM Document
        :param f: Optional File to dump directly to
        :type f: File or Stream

        :return: File object where the XML has been dumped to
        :rtype: file
        r)�
TemporaryFilez&<?xml version="1.0" encoding="UTF-8"?>)�filez<Domain id="%s">z	<Item id="%s">z		<attribute id="%s">z			<value><![CDATA[� )�endr;zutf-8r$)�errorsz]]></value>z		</attribute>z	</Item>z	</Domain>)�tempfiler:�printr	�
isinstance�listr�	text_type�encode�write�flush�seek)r�fr:r+�k�valuesrrrr
�to_xml�s2


z
Domain.to_xmlcCs"ddl}t|�}|j�||�|S)z)Load this domain based on an XML documentrN)�xml.sax�DomainDumpParser�sax�parse)r�doc�xml�handlerrrr
�from_xmlszDomain.from_xmlcCs|j�|�S)z<
        Delete this domain, and all items under it
        )r�
delete_domainrrrr
�deletesz
Domain.delete)NN)TN)T)NFN)r0NFN)Fr)�__name__�
__module__�__qualname__rrrrrrr!r&r(r,r/rr5r8r9rKrSrUrrrr
rs0

�
'
�
�&


$rc@s&eZdZddd�Zdd�Zdd�ZdS)	�DomainMetaDataNcCs.||_d|_d|_d|_d|_d|_d|_dSr)r4�
item_count�item_names_size�attr_name_count�attr_names_size�attr_value_count�attr_values_size�rr4rrr
rs
zDomainMetaData.__init__cCrrrrrrr
r(rzDomainMetaData.startElementcCs�|dkrt|�|_dS|dkrt|�|_dS|dkr!t|�|_dS|dkr,t|�|_dS|dkr7t|�|_dS|dkrBt|�|_dS|dkrK||_dSt|||�dS)N�	ItemCount�ItemNamesSizeBytes�AttributeNameCount�AttributeNamesSizeBytes�AttributeValueCount�AttributeValuesSizeBytes�	Timestamp)	�intrZr[r\r]r^r_�	timestamprrrrr
r+s
zDomainMetaData.endElementr)rVrWrXrrrrrrr
rYs
	rYN)�ContentHandlerc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)rMz6
    SAX parser for a domain that has been dumped
    cCs,t|�|_d|_i|_d|_d|_||_dS)Nr0)�UploaderThread�uploader�item_idr�	attributerr4r`rrr
rDs

zDomainDumpParser.__init__cCsH|dkr|d|_i|_dS|dkr|d|_dS|dkr"d|_dSdS)N�Item�idrnrr0)rmrrnr)rr	rrrr
rLs


�zDomainDumpParser.startElementcCs|j|7_dSr)r)r�chrrr
�
charactersUszDomainDumpParser.characterscCs�|dkr/|jr+|jr-|j��}|j��}||jvr#|j|�|�dS|g|j|<dSdSdS|dkrR|j|jj|j<t|jj�dkrP|j�	�t
|j�|_dSdS|dkr]|j�	�dSdS)Nrro�r)rrn�stripr�appendrlr'rm�len�startrkr4)rr	r�	attr_namerrr
rXs"


�
��zDomainDumpParser.endElementN)rVrWrX�__doc__rrrrrrrrr
rM?s	rM)�Threadcs(eZdZdZ�fdd�Zdd�Z�ZS)rkzUploader Threadcs||_i|_tt|���dSr)�dbr'�superrkrr`��	__class__rr
roszUploaderThread.__init__c	Cs^z	|j�|j�Wntd�|jD]}|j�||j|�qYtddd�tj��dS)Nz5Exception using batch put, trying regular put instead�.r<)r=)r{r&r'r@r!�sys�stdoutrFr7rrr
�runts
�zUploaderThread.run)rVrWrXryrr��
__classcell__rrr}r
rklsrk)�
__future__r�boto.sdb.queryresultsetr�boto.compatr�objectrrYr��xml.sax.handlerrjrM�	threadingrzrkrrrr
�<module>s ,

https://t.me/RX1948 - 2025