-
Notifications
You must be signed in to change notification settings - Fork 430
Unifying all conversions to bytes. #250
Unifying all conversions to bytes. #250
Conversation
Raises: | ||
ValueError if the value could not be converted to bytes. | ||
""" | ||
result = value |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
As they are used throughout this commit what's the difference between "isinstance(value, bytes)" and "isinstance(value, six.binary_type)"? I imagine the distinction is subtle and tricky? |
AFAIK the only difference is that if PY3:
binary_type = bytes
else:
binary_type = str |
737825a
to
e6ff48f
Compare
@nathanielmanistaatgoogle I rebased after some of the changes made it un-mergeable Things that remain:
|
|
Also making sure the _urlsafe_b64encode returns bytes and updating dependent code with the change in return type.
e6ff48f
to
5c570a8
Compare
@nathanielmanistaatgoogle I folded the ternary change into the original It's more common in Python to import the objects you need rather than the namespaces you need. That's just a Google rule. When unit testing, it's easier (maybe only marginally so, maybe a lot?) to monkey patch the objects in the module under test rather than tracking down the namespace which has that object and then monkey patching that other module. |
Unifying all conversions to bytes.
I learned a little For #136: $ # Visit: https://api.github.com/repos/google/oauth2client/pulls/136/commits
$ # parent in MASTER: 3c02a812165004aeb18cc89e10639694bf2d3b0f
$ git branch pr-136 3c02a812165004aeb18cc89e10639694bf2d3b0f
$ git checkout pr-136
$ wget https://patch-diff.githubusercontent.com/raw/google/oauth2client/pull/136.patch
$ git am 136.patch For #157 : $ # Visit: https://api.github.com/repos/google/oauth2client/pulls/157/commits
$ # parent in MASTER: 0a6241c792f0c833f2f176292b0c7ea5623eabfd
$ git branch pr-157 0a6241c792f0c833f2f176292b0c7ea5623eabfd
$ git checkout pr-157
$ wget https://patch-diff.githubusercontent.com/raw/google/oauth2client/pull/157.patch
$ git am 157.patch Now I will try to rebase them onto |
Also making sure the _urlsafe_b64encode returns bytes and updating dependent code with the change in return type.
NOTE: This doesn't address the opposite direction, i.e.
a.decode('utf-8')
where is abytes
(orstr
) object.