-
Notifications
You must be signed in to change notification settings - Fork 206
Ensure all files are py2/py3 syntactically compatible #238
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -568,14 +568,14 @@ def _default_mime_types(): | |
| """ | ||
|
|
||
| def usage(code, msg=''): | ||
| print USAGE | ||
| if msg: print msg | ||
| print(USAGE) | ||
| if msg: print(msg) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. multiple statements on one line (colon)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Totally agree with hound bot, I left it as close to original as possible in this iteration however on purpose. |
||
| sys.exit(code) | ||
|
|
||
| try: | ||
| opts, args = getopt.getopt(sys.argv[1:], 'hle', | ||
| ['help', 'lenient', 'extension']) | ||
| except getopt.error, msg: | ||
| except getopt.error as msg: | ||
| usage(1, msg) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| strict = 1 | ||
|
|
@@ -590,9 +590,9 @@ def usage(code, msg=''): | |
| for gtype in args: | ||
| if extension: | ||
| guess = guess_extension(gtype, strict) | ||
| if not guess: print "I don't know anything about type", gtype | ||
| else: print guess | ||
| if not guess: print("I don't know anything about type %s" % gtype) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. multiple statements on one line (colon)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using a simple The Printing a tuple behaves differently in py2/py3, so a simple string format was used here to make it py2/py3 equivalent |
||
| else: print(guess) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. multiple statements on one line (colon) |
||
| else: | ||
| guess, encoding = guess_type(gtype, strict) | ||
| if not guess: print "I don't know anything about type", gtype | ||
| else: print 'type:', guess, 'encoding:', encoding | ||
| if not guess: print("I don't know anything about type %s" % gtype) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. multiple statements on one line (colon) |
||
| else: print('type: %s encoding: %s' % (guess, encoding)) | ||
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.
Similar change can be done in
../python2/socks.py, intentionally left that one as-is (as it's still syntactically OK, and presumably this one is the one selected at runtime for py3)