File: //usr/lib/python3/dist-packages/boto/dynamodb2/__pycache__/items.cpython-310.pyc
o
ckF[@9 � @ s0 d dl mZ G dd� de�ZG dd� de�ZdS )� )�deepcopyc @ s e Zd ZdS )�NEWVALUEN)�__name__�
__module__�__qualname__� r r �6/usr/lib/python3/dist-packages/boto/dynamodb2/items.pyr s r c @ s� e Zd ZdZd6dd�Zdd� Zdd � Zd
d� Zdd
� Zdd� Z dd� Z
d7dd�Zdd� Zdd� Z
dd� ZeZdd� Zd7dd�Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd7d(d)�Zd*d+� Zd,d-� Zd.d/� Zd0d1� Zd8d2d3�Zd4d5� ZdS )9�Itema
An object representing the item data within a DynamoDB table.
An item is largely schema-free, meaning it can contain any data. The only
limitation is that it must have data for the fields in the ``Table``'s
schema.
This object presents a dictionary-like interface for accessing/storing
data. It also tries to intelligently track how data has changed throughout
the life of the instance, to be as efficient as possible about updates.
Empty items, or items that have no data, are considered falsey.
NFc C s` || _ || _i | _|| _|j| _t| jt�r| jj| _| jdu r#i | _| jr.t| j�| _dS dS )a
Constructs an (unsaved) ``Item`` instance.
To persist the data in DynamoDB, you'll need to call the ``Item.save``
(or ``Item.partial_save``) on the instance.
Requires a ``table`` parameter, which should be a ``Table`` instance.
This is required, as DynamoDB's API is focus around all operations
being table-level. It's also for persisting schema around many objects.
Optionally accepts a ``data`` parameter, which should be a dictionary
of the fields & values of the item. Alternatively, an ``Item`` instance
may be provided from which to extract the data.
Optionally accepts a ``loaded`` parameter, which should be a boolean.
``True`` if it was preexisting data loaded from DynamoDB, ``False`` if
it's new data from the user. Default is ``False``.
Example::
>>> users = Table('users')
>>> user = Item(users, data={
... 'username': 'johndoe',
... 'first_name': 'John',
... 'date_joined': 1248o61592,
... })
# Change existing data.
>>> user['first_name'] = 'Johann'
# Add more data.
>>> user['last_name'] = 'Doe'
# Delete data.
>>> del user['date_joined']
# Iterate over all the data.
>>> for field, val in user.items():
... print "%s: %s" % (field, val)
username: johndoe
first_name: John
date_joined: 1248o61592
N)�table�_loaded�
_orig_data�_data�
_dynamizer�
isinstancer r )�selfr
�data�loadedr r r �__init__ s +
�z
Item.__init__c C s | j �|d �S �N�r
�get�r �keyr r r �__getitem__Q � zItem.__getitem__c C s || j |<