Skip to content

Commit

Permalink
some more six'ing
Browse files Browse the repository at this point in the history
  • Loading branch information
altendky committed Sep 7, 2020
1 parent 68974b5 commit 934e127
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions src/treq/client.py
Expand Up @@ -5,7 +5,10 @@

from io import BytesIO

from six import PY3
from six import ensure_binary
from six.moves.collections_abc import Mapping

This comment has been minimized.

Copy link
@karlb

karlb Sep 28, 2020

This requires six>=1.13.0. Please declare that in the dependencies or import form the standard library locations. Thanks!

Examples of breakage caused by this:
ludwig-ai/ludwig#632
raiden-network/raiden: https://app.circleci.com/pipelines/github/raiden-network/scenario-player/1589/workflows/e6dc2603-76fa-4905-8452-62ba6922dbfd/jobs/4095

This comment has been minimized.

Copy link
@twm

twm Sep 28, 2020

Contributor

@karlb Hi Karl, could you create a PR or at least an issue for this? I'd be happy to do a 20.9.1 with a higher six dep.

This comment has been minimized.

Copy link
@karlb

karlb Sep 29, 2020

I've created the issue #295.

from six.moves.http_cookiejar import CookieJar
from six.moves.urllib import urlencode as _urlencode

from twisted.internet.interfaces import IProtocol
from twisted.internet.defer import Deferred
Expand Down Expand Up @@ -35,25 +38,8 @@
from treq.response import _Response
from requests.cookies import cookiejar_from_dict, merge_cookies

if PY3:
from urllib.parse import urlencode as _urlencode

def urlencode(query, doseq):
return _urlencode(query, doseq).encode('ascii')
from http.cookiejar import CookieJar
else:
from cookielib import CookieJar
from urllib import urlencode

try:
# The old location was quixotically deprecated and might actually be
# removed in 3.10, maybe.
#
# See https://github.com/html5lib/html5lib-python/issues/419 for more of
# this tale of woe.
from collections.abc import Mapping
except ImportError:
from collections import Mapping
def urlencode(query, doseq):
return six.ensure_binary(_urlencode(query, doseq))


class _BodyBufferingProtocol(proxyForInterface(IProtocol)):
Expand Down

0 comments on commit 934e127

Please sign in to comment.