-
Notifications
You must be signed in to change notification settings - Fork 7
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
python3 migration #20
base: master
Are you sure you want to change the base?
Conversation
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.
thanks for the PR!
some stuff that 2to3 has done seems a bit superfluous though, see my comments.
some other stuff seems even wrong.
the .decode() stuff might be valid, but needs checking for py2 compat.
from __future__ import print_function | ||
|
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.
does it still work on py2 with that?
try: | ||
from ConfigParser import SafeConfigParser as ConfigParser, Error as ConfigParserError | ||
from configparser import SafeConfigParser as ConfigParser, Error as ConfigParserError | ||
except ImportError: | ||
# Python 3 | ||
from configparser import ConfigParser, Error as ConfigParserError |
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.
that doesn't look correct.
the upper block is meant for python 2, so it should be ConfigParser
.
if that import fails (e.g. because we are on py3), it is retried in the lower except block.
LIFETIME_MAPPING = dict(zip(LIFETIME_CHOICES, LIFETIME_NAMES)) | ||
LIFETIME_MAPPING = dict(list(zip(LIFETIME_CHOICES, LIFETIME_NAMES))) |
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.
can you explain why this is needed?
for k, v in CONFIG_DEFAULTS.items(): | ||
for k, v in list(CONFIG_DEFAULTS.items()): |
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.
why?
for option in CONFIG_DEFAULTS.keys(): | ||
for option in list(CONFIG_DEFAULTS.keys()): |
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.
why?
for k, v in response.json().items(): | ||
for k, v in list(response.json().items()): |
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.
why?
ftype = mime.from_buffer(first_chunk).decode() | ||
ftype = mime.from_buffer(first_chunk) |
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.
does it still work on py2 with that?
@Marwe did you see my feedback? |
Applied 2to3 and found a decode to remove, now it works here with python3
hopefully closes: #19
please review and look for other potential migration issues