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

Streaming: strip unused features #1209

Merged
merged 17 commits into from
Nov 19, 2015
Merged

Streaming: strip unused features #1209

merged 17 commits into from
Nov 19, 2015

Conversation

tseaver
Copy link
Contributor

@tseaver tseaver commented Oct 29, 2015

Uses #1208 as a base.

  • Trim / normailze / document imports.
  • Rename functions / methods to match PEP 8.
  • Make constants / methods used outside their modules public.
  • Make functions / methods not imported outside their modules explicitly private.
  • Drop unused exceptions.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 29, 2015
@dhermes
Copy link
Contributor

dhermes commented Oct 29, 2015

Ping me when this is rebased after the other commits get merged.

@tseaver
Copy link
Contributor Author

tseaver commented Nov 16, 2015

@dhermes rebased after #1208 merged.

@dhermes
Copy link
Contributor

dhermes commented Nov 16, 2015

Just want to double check that 11 commits is intended after the rebase and we didn't confuse git?

@tseaver
Copy link
Contributor Author

tseaver commented Nov 16, 2015

This is the correct set of commits: I can squash some down, if you think it will help review better.

@dhermes
Copy link
Contributor

dhermes commented Nov 16, 2015

No more commits is almost certainly a good thing (easier to review).

@@ -2,6 +2,10 @@
"""Small helper class to provide a small slice of a stream.

This class reads ahead to detect if we are at the end of the stream.

:mod:`gcloud._apidools.transfer` uses:

This comment was marked as spam.

This comment was marked as spam.

@dhermes
Copy link
Contributor

dhermes commented Nov 16, 2015

Unfortunately GitHub thinks there are too many changes to gcloud/streaming/test_transfer.py to display.

There are a couple places where you dropped with _Monkey(MUT, http_wrapper=_Dummy()):. Why?

@dhermes
Copy link
Contributor

dhermes commented Nov 16, 2015

Also

_Monkey(
    Request=lambda url, http_method, body: _Request(url, http_method, body)
)

seems like it could be done with

_Monkey(Request=_Request)

What am I missing?

- :class:`Upload`
- :const:`RESUMABLE_UPLOAD`

:mod:`gcloud.storage.test_blob` patches:

This comment was marked as spam.

This comment was marked as spam.

@dhermes
Copy link
Contributor

dhermes commented Nov 16, 2015

Yay for "Give 'streaming.util' functions PEP8 names."!



def Typecheck(arg, arg_type, msg=None):
def type_check(arg, arg_type, msg=None):

This comment was marked as spam.

This comment was marked as spam.

@dhermes
Copy link
Contributor

dhermes commented Nov 16, 2015

Rut-roh, test_transfer.py is also not visible in https://github.com/tseaver/gcloud-python/commit/2414bfbbe449db06a7a1aaae314dc1d144a24a4b

use_chunks: (bool, default: True) If False, ignore self.chunksize
and stream this download in a single request.

Returns:
None. Streams bytes into self.stream.
"""
self.EnsureInitialized()
self._ensure_initialized()
while True:

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@dhermes
Copy link
Contributor

dhermes commented Nov 16, 2015

Other than getting at the code GitHub won't show me, I've reviewed them all and made my comments.

@tseaver
Copy link
Contributor Author

tseaver commented Nov 17, 2015

There are a couple places where you dropped with _Monkey(MUT, http_wrapper=_Dummy()):. Why?

In that same commit, transfer begins importing names directly, rather than via http_wrapper.<name>.

@tseaver
Copy link
Contributor Author

tseaver commented Nov 17, 2015

But http_wrapper=_Dummy() wasn't actually replacing anything. So why was it there and why was it safe to remove the monkey patch?

Originally, the _Dummy() had the names which transfer expected to find on http_wrapper: over the course (and after I started importing them directly), it "withered away" like the Communist state.

@dhermes
Copy link
Contributor

dhermes commented Nov 17, 2015

Ha. OK

@dhermes
Copy link
Contributor

dhermes commented Nov 18, 2015

Seems like adding __doc__ to the named tuple and then me reviewing test_transfer.py is what remains. Am I missing anything else?

@tseaver
Copy link
Contributor Author

tseaver commented Nov 18, 2015

(I think) to review the bigger diff:

$ git remote add tseaver https://github.com/tseaver/gcloud-python
$ git fetch --all tseaver
$ git diff master..tseaver/streaming-strip_unused_features gcloud/streaming/test_transfer.py

@tseaver
Copy link
Contributor Author

tseaver commented Nov 18, 2015

Rebased to fix conflict on gcloud/storage/test_blob.py (from #1222).

@dhermes
Copy link
Contributor

dhermes commented Nov 18, 2015

OK the test_transfer.py diff looks fine (I don't know why GitHub wouldn't show it, it was mostly renames)

@dhermes
Copy link
Contributor

dhermes commented Nov 18, 2015

Do we have everything else squared away?

@tseaver
Copy link
Contributor Author

tseaver commented Nov 19, 2015

Do we have everything else squared away?

I think so.

@dhermes
Copy link
Contributor

dhermes commented Nov 19, 2015

OK. LGTM

tseaver added a commit that referenced this pull request Nov 19, 2015
@tseaver tseaver merged commit 509564d into googleapis:master Nov 19, 2015
@tseaver tseaver deleted the streaming-strip_unused_features branch November 19, 2015 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: core cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants