-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Update samples to support latest Google Cloud Python #656
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
Conversation
Change-Id: I11180caa0f97743fc3475e05fc44d5686702aabd
Change-Id: I78ceda896df08c433620b3a40e21fef7bb72f4a2
Change-Id: I07d16616e373d925f6ce5e9e47ab2fb7d073eb59
Change-Id: I6cbcca11be84baa7c40eed14b342cc916b9116d9
Change-Id: Ibd8cc3b651e666c5c5e7d9537a690cf4e9acc03a
Change-Id: I3ea731e4022610802b262a93197dee17b2e09838
Change-Id: Iac57ac0708fadc11f358c1599f4d1ce94b0dac8b
Change-Id: Ic9731e804792aeaeee51ca87ab7dc5971fe7ef5b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool beans - I like that the iterators page for you now :D (wow github just auto-completed my smiley into a dagger... sheesh. calm down, github.)
Just a couple minor suggestions.
|
||
return tasks, cursor | ||
tasks = list(page) | ||
next_cusor = query_iter.next_page_token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next_cusor
? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
requirements = [ | ||
requirement for requirement in requirements if not | ||
is_ignored(requirement)] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could put this conditional in the previous comprehension, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not.
"""Ignores certain libraries.""" | ||
for library in IGNORED_LIBRARIES: | ||
if requirement.startswith(library): | ||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could do this more succinctly:
return any(requirement.startswith(l) for l in IGNORED_LIBRARIES)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it, but it's almost too clever. I'm going to leave as-is for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't care either way but don't think it's too clever, a bit more English-esque if anything.
LGTM, shoutout to @dhermes for a lot of nice refactors that make these samples look a lot nicer. |
@dpebot merge when travis passes, please. |
Okay! I'll merge when all statuses are green. |
Change-Id: Iab5bd07b405cf57fa7407efcfa188d1320e5f867
# Load at most 25 results. You can change the max_results argument to load | ||
# more rows from BigQuery, but note that this can take some time. It's | ||
# preferred to use a query. | ||
rows = table.fetch_data(max_results=25) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may prefer to just consume the iterator right here:
rows = list(table.fetch_data(max_results=25))
There is too much suspense between this and the for row in rows
(when the request(s) actually get made)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, done.
Change-Id: I33997d42c6202c7f916bcebd4c5a9499392ac4db
Change-Id: I9609daebbd2bfd62706193e80fde245bd1ae2566
(I recommend reviewing commit by commit)