File: //lib/python3/dist-packages/boto/dynamodb2/__pycache__/results.cpython-312.pyc
�
ckF[� � �0 � G d � de � Z G d� de� Zy)c �V � � e Zd ZdZd � fd� Zed� � Zd� Zd� Zd� Z e Z
d� Zd� Z� xZ
S )
� ResultSeta�
A class used to lazily handle page-to-page navigation through a set of
results.
It presents a transparent iterator interface, so that all the user has
to do is use it in a typical ``for`` loop (or list comprehension, etc.)
to fetch results, even if they weren't present in the current page of
results.
This is used by the ``Table.query`` & ``Table.scan`` methods.
Example::
>>> users = Table('users')
>>> results = ResultSet()
>>> results.to_call(users.query, username__gte='johndoe')
# Now iterate. When it runs out of results, it'll fetch the next page.
>>> for res in results:
... print res['username']
c � �� t t | � � d | _ g | _ i | _ g | _ d| _ d| _ d | _ d| _
|| _ d | _ y )N���T� )
�superr �__init__�the_callable� call_args�call_kwargs�_results�_offset�
_results_left�_last_key_seen�_fetches�_max_page_size�_limit)�self�
max_page_size� __class__s ��8/usr/lib/python3/dist-packages/boto/dynamodb2/results.pyr zResultSet.__init__ s[ �� �
�i��'�)� �����������
����!���"�����
�+������ c � � y)N�exclusive_start_key� �r s r � first_keyzResultSet.first_key$ s � �$r c � � g | _ d| _ y)z�
Resets the internal state of the ``ResultSet``.
This prevents results from being cached long-term & consuming
excess memory.
Largely internal.
r N)r r
r s r �_resetzResultSet._reset( s � � ��
���r c � � | S �Nr r s r �__iter__zResultSet.__iter__4 s � ��r c �d � | xj dz
c_ | j t | j � k\ r{| j du r
t � �| j � t | j � s>| j r2| j � t | j � s
| j r�2| j t | j � k rS| j �.| xj dz c_ | j dk r
t � �| j | j S t � �)N� Fr )r
�lenr r �
StopIteration�
fetch_morer r s r �__next__zResultSet.__next__7 s� � ��������<�<�3�t�}�}�-�-��!�!�U�*�#�o�%��O�O��
�$�-�-�(�T�-?�-?����!� �$�-�-�(�T�-?�-?� �<�<�#�d�m�m�,�,��{�{�&����q� ���;�;��?�'�/�)��=�=����.�.��/�!r c �� � t |� st d� �|j dd� | _ | j �| j dk rd| _ || _ || _ || _ y)a�
Sets up the callable & any arguments to run it with.
This is stored for subsequent calls so that those queries can be
run without requiring user intervention.
Example::
# Just an example callable.
>>> def squares_to(y):
... for x in range(1, y):
... yield x**2
>>> rs = ResultSet()
# Set up what to call & arguments.
>>> rs.to_call(squares_to, y=3)
z3You must supply an object or function to be called.�limitNr )�callable�
ValueError�popr r r
r )r r �args�kwargss r �to_callzResultSet.to_callS sb � �$ ��%��E��
� �j�j��$�/����;�;�"�t�{�{�Q���D�K�(������!��r c �T � | j � | j dd }| j j � }| j �| j || j
<