PY3: use six.iterkeys, six.iteritems, and tempfile #799
Conversation
@@ -77,7 +78,7 @@ def _format_cookie(self, cookie): | |||
def _get_request_cookies(self, jar, request): | |||
if isinstance(request.cookies, dict): | |||
cookie_list = [{'name': k, 'value': v} for k, v in \ | |||
request.cookies.iteritems()] | |||
six.iteritems(request.cookies)] |
kmike
Jul 14, 2014
Member
IMHO there is no harm in using items() here. But iteritems is also fine :)
IMHO there is no harm in using items() here. But iteritems is also fine :)
else: | ||
field_iter = item.iterkeys() | ||
field_iter = six.iterkeys(item) |
kmike
Jul 14, 2014
Member
i guess it could be field_iter = item
as well, but with iterkeys the intention is more clear - let's keep it
i guess it could be field_iter = item
as well, but with iterkeys the intention is more clear - let's keep it
@@ -25,7 +26,7 @@ def tearDown(self): | |||
rmtree(self.temp_path) | |||
|
|||
def call(self, *new_args, **kwargs): | |||
out = os.tmpfile() | |||
out = tempfile.TemporaryFile() |
kmike
Jul 14, 2014
Member
I think it is better to either use context manager to close this file explicitly, or to use os.devnull
.
I think it is better to either use context manager to close this file explicitly, or to use os.devnull
.
kmike
Jul 14, 2014
Member
I'll take care of it.
I'll take care of it.
felixonmars
Jul 14, 2014
Author
Contributor
Thanks :)
Thanks :)
This PR looks good. Usually I try to avoid |
kmike
added a commit
that referenced
this pull request
Jul 14, 2014
PY3: use six.iterkeys, six.iteritems, and tempfile
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This one is less trivial.
I was looking to change Headers.iteritems too, but that one seems different in behavior, so I left alone everything related to that.