File: //usr/lib/python3/dist-packages/boto/dynamodb2/__pycache__/results.cpython-310.pyc
o
ckF[� � @ s$ G d d� de �ZG dd� de�ZdS )c sZ e Zd ZdZd� fdd� Zedd� �Zdd� Zd d
� Zdd� Z e Z
d
d� Zdd� Z� Z
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']
Nc sN t t| ��� d | _g | _i | _g | _d| _d| _d | _ d| _
|| _d | _d S )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__� �8/usr/lib/python3/dist-packages/boto/dynamodb2/results.pyr s
zResultSet.__init__c C s dS )N�exclusive_start_keyr �r r r r � first_key$ s zResultSet.first_keyc C s g | _ d| _dS )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 r r r �_reset( s
zResultSet._resetc C s | S �Nr r r r r �__iter__4 s zResultSet.__iter__c C s� | j d7 _ | j t| j�kr/| jdu rt� �| �� t| j�s/| jr/| �� t| j�s/| js#| j t| j�k rQ| jd urK| jd8 _| jdk rKt� �| j| j S t� �)N� Fr )r
�lenr r �
StopIteration�
fetch_morer r r r r �__next__7 s
�
zResultSet.__next__c O sN t |�std��|�dd�| _| jdur| jdk rd| _|| _|| _|| _dS )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�kwargsr r r �to_callS s �
zResultSet.to_callc C s | � � | jdd� }| j�� }| jdur| j|| j<