aboutsummaryrefslogtreecommitdiff
path: root/google
diff options
context:
space:
mode:
authorJon Wayne Parrott <jonwayne@google.com>2018-01-10 16:54:48 -0800
committerGitHub <noreply@github.com>2018-01-10 16:54:48 -0800
commit555d8cec5b28c75238121e731c3f587849fc7a67 (patch)
tree2bf1d66344885e00c23f85abf2c684e912d5dd6c /google
parent37658c159b94596a464ef7403abfa2a88017e414 (diff)
downloadpython-api-core-555d8cec5b28c75238121e731c3f587849fc7a67.tar.gz
Revert "api_core: Make PageIterator.item_to_value public. (#4702)" (#4731)
Diffstat (limited to 'google')
-rw-r--r--google/api_core/page_iterator.py21
1 files changed, 4 insertions, 17 deletions
diff --git a/google/api_core/page_iterator.py b/google/api_core/page_iterator.py
index 0cf03a6..3d2a55b 100644
--- a/google/api_core/page_iterator.py
+++ b/google/api_core/page_iterator.py
@@ -158,25 +158,12 @@ class Iterator(object):
page_token=None, max_results=None):
self._started = False
self.client = client
- """Optional[Any]: The client that created this iterator."""
- self.item_to_value = item_to_value
- """Callable[Iterator, Any]: Callable to convert an item from the type
- in the raw API response into the native object. Will be called with
- the iterator and a
- single item.
- """
+ self._item_to_value = item_to_value
self.max_results = max_results
- """int: The maximum number of results to fetch."""
-
# The attributes below will change over the life of the iterator.
self.page_number = 0
- """int: The current page of results."""
self.next_page_token = page_token
- """str: The token for the next page of results. If this is set before
- the iterator starts, it effectively offsets the iterator to a
- specific starting point."""
self.num_results = 0
- """int: The total number of results fetched so far."""
@property
def pages(self):
@@ -348,7 +335,7 @@ class HTTPIterator(Iterator):
if self._has_next_page():
response = self._get_next_page_response()
items = response.get(self._items_key, ())
- page = Page(self, items, self.item_to_value)
+ page = Page(self, items, self._item_to_value)
self._page_start(self, page, response)
self.next_page_token = response.get(self._next_token)
return page
@@ -441,7 +428,7 @@ class _GAXIterator(Iterator):
"""
try:
items = six.next(self._gax_page_iter)
- page = Page(self, items, self.item_to_value)
+ page = Page(self, items, self._item_to_value)
self.next_page_token = self._gax_page_iter.page_token or None
return page
except StopIteration:
@@ -513,7 +500,7 @@ class GRPCIterator(Iterator):
self.next_page_token = getattr(response, self._response_token_field)
items = getattr(response, self._items_field)
- page = Page(self, items, self.item_to_value)
+ page = Page(self, items, self._item_to_value)
return page