Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions shotgun_api3/lib/httplib2/python3/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# -*- coding: utf-8 -*-
"""Small, fast HTTP client library for Python."""

# TODO: remove __future__ import when support for py2 is completely dropped
# Needed until then to avoid py2 packaging barking on things of the form: print(..., end=...)
from __future__ import print_function

__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "Copyright 2006, Joe Gregorio"
__contributors__ = [
Expand Down
2 changes: 1 addition & 1 deletion shotgun_api3/lib/httplib2/python3/socks.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def __negotiatehttp(self, destaddr, destport):
wrote_host_header = False
wrote_auth_header = False
if self.__proxy[6] != None:
for key, val in self.__proxy[6].iteritems():
for key, val in self.__proxy[6].items():
Copy link
Author

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)

headers += [key, ": ", val, "\r\n"]
wrote_host_header = key.lower() == "host"
wrote_auth_header = key.lower() == "proxy-authorization"
Expand Down
14 changes: 7 additions & 7 deletions shotgun_api3/lib/mimetypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,14 +568,14 @@ def _default_mime_types():
"""

def usage(code, msg=''):
print USAGE
if msg: print msg
print(USAGE)
if msg: print(msg)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multiple statements on one line (colon)

Copy link
Author

Choose a reason for hiding this comment

The 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.
I'll gladly straighten this out though

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)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


strict = 1
Expand All @@ -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)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multiple statements on one line (colon)

Copy link
Author

@zsimic zsimic Nov 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a simple print() is compatible with py2/py3 (without the need for from __future__ import print_function).

The __future__ import is needed if/when a more advanced usage of print function is done, like for example print("foo", end=" ")

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)
Copy link

Choose a reason for hiding this comment

The 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)
Copy link

Choose a reason for hiding this comment

The 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))