-
Notifications
You must be signed in to change notification settings - Fork 203
SG-13264 Update sgsix, fix httplib2 import #220
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f27388e
Add platform to sgsix to unify platform value on linux across Python 2/3
willis102 75f65e5
Move platform normalization logic to separate function.
willis102 40e97cc
Default platform normalization to mimic Python 2 behavior.
willis102 e89e090
Add RE_ASCII constant to allow use of re.ASCII flag across Python 2/3
willis102 7f1e9ad
RE_ASCII change no longer needed.
willis102 1c2a002
Change httplib import procedure to emulate direct import of the module
willis102 72f0d61
woof
willis102 9ac07f6
Remove TODOs
willis102 75b8633
' -> "
willis102 81974e7
Add tests for httplib2 import behavior
willis102 4c90961
Make tests Python 2.6 compatible
willis102 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,39 @@ | ||
| from .. import six | ||
|
|
||
| # import the proper implementation into the module namespace depending on the | ||
| # Define all here to keep linters happy. It should be overwritten by the code | ||
| # below, but if in the future __all__ is not defined in httplib2 this will keep | ||
| # things from breaking. | ||
| __all__ = [] | ||
|
|
||
| # Import the proper implementation into the module namespace depending on the | ||
| # current python version. httplib2 supports python 2/3 by forking the code rather | ||
| # than with a single cross-compatible module. Rather than modify third party code, | ||
| # we'll just import the appropriate branch here. | ||
| if six.PY3: | ||
| from .python3 import * | ||
| from .python3 import socks # ensure include in namespace | ||
| import ssl | ||
| ssl_error_classes = (ssl.SSLError, ssl.CertificateError) | ||
| # Generate ssl_error_classes | ||
| import ssl as __ssl | ||
| ssl_error_classes = (__ssl.SSLError, __ssl.CertificateError) | ||
| del __ssl | ||
|
|
||
| # get the python3 fork of httplib2 | ||
| from . import python3 as __httplib2_compat | ||
|
|
||
|
|
||
| else: | ||
| from .python2 import * | ||
| from .python2 import socks # ensure include in namespace | ||
| from .python2 import SSLHandshakeError # TODO: shouldn't rely on this. not public | ||
| ssl_error_classes = (SSLHandshakeError,) | ||
| # Generate ssl_error_classes | ||
| from .python2 import SSLHandshakeError as __SSLHandshakeError # TODO: shouldn't rely on this. not public | ||
| ssl_error_classes = (__SSLHandshakeError,) | ||
| del __SSLHandshakeError | ||
|
|
||
| # get the python2 fork of httplib2 | ||
| from . import python2 as __httplib2_compat | ||
|
|
||
| # Import all of the httplib2 module. Note that we can't use a star import because | ||
| # we need to import *everything*, not just what exists in __all__. | ||
| for __name in dir(__httplib2_compat): | ||
| globals()[__name] = getattr(__httplib2_compat, __name) | ||
| del __httplib2_compat | ||
| del __name | ||
|
|
||
| # Add ssl_error_classes to __all__ | ||
| __all__.append("ssl_error_classes") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 you add a test demonstrating that nothing is missing?
Uh oh!
There was an error while loading. Please reload this page.
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.
Added a test. Let me know if you'd like to see anything else covered, or if you think I should move it to a different location (I added it in test_api, since I didn't want to add a whole new file for just one test.)