Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving backend specific behavior from Page to Iterator. #2545

Merged
merged 4 commits into from
Oct 17, 2016

Commits on Oct 14, 2016

  1. Moving backend specific behavior from Page to Iterator.

    This is to lower the burden on implementers. The previous
    approach (requiring a Page and Iterator subclass) ended
    up causing lots of copy-pasta docstrings that were just
    a distraction.
    
    Follow up to googleapis#2531.
    dhermes committed Oct 14, 2016
    Configuration menu
    Copy the full SHA
    49532f4 View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2016

  1. Adding public next_page() to Iterator.

    The previous implementation may catch users off guard since
    the iterator.page access may also update the value before
    access.
    
    In addition, this PR removed the _update_page() / next_page()
    subclass behavior in _BlobIterator. Over-riding that method
    was never intended. Instead makes a non-public class attribute
    _PAGE_CLASS that can be replaced with Page subclasses. This
    can be revisited if more implementations require custom
    behavior on Page creation / Page.__init__.
    dhermes committed Oct 15, 2016
    Configuration menu
    Copy the full SHA
    d24e630 View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2016

  1. Removing NO_MORE_PAGES sentinel and just making None mean no more pages.

    Also renaming next_page() to update_page() on Iterator and dropping
    any return value from that method. Also throwing an AttributeError
    if the page is unset on @Property access.
    dhermes committed Oct 16, 2016
    Configuration menu
    Copy the full SHA
    6d0f907 View commit details
    Browse the repository at this point in the history
  2. Making Iterator.has_next_page() non-public.

    This is because Iterator.page combined with Iterator.update_page()
    can provide the same thing and has_next_page() is really an
    implementation detail.
    
    Done via:
    
    $ git grep -l has_next_page |
    > xargs sed -i s/has_next_page/_has_next_page/g
    dhermes committed Oct 16, 2016
    Configuration menu
    Copy the full SHA
    8226323 View commit details
    Browse the repository at this point in the history