Update samples to support latest Google Cloud Python#656
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
|
|
||
| return tasks, cursor | ||
| tasks = list(page) | ||
| next_cusor = query_iter.next_page_token |
| requirements = [ | ||
| requirement for requirement in requirements if not | ||
| is_ignored(requirement)] | ||
|
|
There was a problem hiding this comment.
Could put this conditional in the previous comprehension, no?
| """Ignores certain libraries.""" | ||
| for library in IGNORED_LIBRARIES: | ||
| if requirement.startswith(library): | ||
| return True |
There was a problem hiding this comment.
Could do this more succinctly:
return any(requirement.startswith(l) for l in IGNORED_LIBRARIES)
There was a problem hiding this comment.
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.
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.
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.
Fair enough, done.
Change-Id: I33997d42c6202c7f916bcebd4c5a9499392ac4db
Change-Id: I9609daebbd2bfd62706193e80fde245bd1ae2566
(I recommend reviewing commit by commit)