Skip to content

Commit

Permalink
Replace all uses of six.move by the Python 3-only equivalent
Browse files Browse the repository at this point in the history
To improve confidence that this will work in Python 3.6, all of the
unique import statements were tested in Python 3.5.5 and 3.6.8:
```py
from http.client import HTTPConnection
from urllib.parse import parse_qs
from urllib.parse import parse_qs, quote
from urllib.parse import parse_qsl, SplitResult, urlencode, urlsplit, urlunsplit
from urllib.parse import unquote
from urllib.parse import urlencode
from urllib.parse import urlencode, urlparse
from urllib.parse import urlparse
from urllib.parse import urlunsplit
import urllib
```
  • Loading branch information
foolip committed Apr 29, 2021
1 parent d9b4bc8 commit de4991c
Show file tree
Hide file tree
Showing 24 changed files with 24 additions and 28 deletions.
2 changes: 1 addition & 1 deletion common/security-features/subresource/static-import.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os, sys
from six.moves.urllib.parse import unquote
from urllib.parse import unquote

from wptserve.utils import isomorphic_decode
import importlib
Expand Down
2 changes: 1 addition & 1 deletion common/security-features/subresource/subresource.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os, json
from six.moves.urllib.parse import parse_qsl, SplitResult, urlencode, urlsplit, urlunsplit
from urllib.parse import parse_qsl, SplitResult, urlencode, urlsplit, urlunsplit

from wptserve.utils import isomorphic_decode, isomorphic_encode

Expand Down
2 changes: 1 addition & 1 deletion cookie-store/resources/cookie_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from six import PY3

from six.moves.urllib.parse import parse_qs, quote
from urllib.parse import parse_qs, quote

from wptserve.utils import isomorphic_decode, isomorphic_encode

Expand Down
2 changes: 1 addition & 1 deletion cookies/resources/helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from six import integer_types

from six.moves.urllib.parse import parse_qs
from urllib.parse import parse_qs

from wptserve.utils import isomorphic_encode

Expand Down
2 changes: 1 addition & 1 deletion cookies/resources/set.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from cookies.resources import helpers
from six.moves.urllib.parse import unquote
from urllib.parse import unquote

from wptserve.utils import isomorphic_encode

Expand Down
2 changes: 1 addition & 1 deletion fetch/api/resources/redirect.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import time

from six.moves.urllib.parse import urlencode, urlparse
from urllib.parse import urlencode, urlparse

from wptserve.utils import isomorphic_decode, isomorphic_encode

Expand Down
4 changes: 1 addition & 3 deletions fetch/api/resources/trickle.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import time

from six.moves import xrange

def main(request, response):
delay = float(request.GET.first(b"ms", 500)) / 1E3
count = int(request.GET.first(b"count", 50))
Expand All @@ -11,6 +9,6 @@ def main(request, response):
response.headers.set(b"Content-type", b"text/plain")
response.write_status_headers()
time.sleep(delay)
for i in xrange(count):
for i in range(count):
response.writer.write_content(b"TEST_TRICKLE\n")
time.sleep(delay)
2 changes: 1 addition & 1 deletion resource-timing/SyntheticResponse.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from six.moves.urllib.parse import unquote
from urllib.parse import unquote

from wptserve.utils import isomorphic_decode, isomorphic_encode

Expand Down
2 changes: 1 addition & 1 deletion resources/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import ssl
import sys
import subprocess
import urllib

import html5lib
import py
import pytest
from six import text_type
from six.moves import urllib

from wptserver import WPTServer

Expand Down
2 changes: 1 addition & 1 deletion resources/test/wptserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import subprocess
import time
import sys
from six.moves import urllib
import urllib


class WPTServer(object):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from six.moves.urllib.parse import parse_qs
from urllib.parse import parse_qs

from wptserve.utils import isomorphic_encode

Expand Down
2 changes: 1 addition & 1 deletion service-workers/service-worker/resources/update-worker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from six.moves.urllib.parse import unquote
from urllib.parse import unquote

from wptserve.utils import isomorphic_decode, isomorphic_encode

Expand Down
2 changes: 1 addition & 1 deletion webdriver/tests/support/authentication.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from six.moves.urllib.parse import urlencode
from urllib.parse import urlencode


def basic_authentication(url, username=None, password=None, protocol="http"):
Expand Down
2 changes: 1 addition & 1 deletion webdriver/tests/support/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from six import string_types

from six.moves.urllib.parse import urlunsplit
from urllib.parse import urlunsplit

from tests.support import defaults
from tests.support.helpers import cleanup_session, deep_update
Expand Down
2 changes: 1 addition & 1 deletion webdriver/tests/support/http_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from six import text_type

from six.moves.http_client import HTTPConnection
from http.client import HTTPConnection


class HTTPRequest(object):
Expand Down
2 changes: 1 addition & 1 deletion webdriver/tests/support/inline.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Helpers for inlining extracts of documents in tests."""

from six.moves.urllib.parse import urlencode
from urllib.parse import urlencode


BOILERPLATES = {
Expand Down
2 changes: 1 addition & 1 deletion webdriver/tests/switch_to_frame/cross_origin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from six.moves.urllib.parse import urlparse
from urllib.parse import urlparse

import webdriver.protocol as protocol

Expand Down
4 changes: 2 additions & 2 deletions websockets/cookies/support/set-cookie.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from six.moves.urllib import parse
from urllib.parse import unquote

from wptserve.utils import isomorphic_encode

def main(request, response):
response.headers.set(b'Set-Cookie', isomorphic_encode(parse.unquote(request.url_parts.query)))
response.headers.set(b'Set-Cookie', isomorphic_encode(unquote(request.url_parts.query)))
return [(b"Content-Type", b"text/plain")], b""
2 changes: 1 addition & 1 deletion websockets/handlers/set-cookie-secure_wsh.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/python
from six.moves import urllib
import urllib


def web_socket_do_extra_handshake(request):
Expand Down
2 changes: 1 addition & 1 deletion websockets/handlers/set-cookie_http_wsh.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python

from six.moves import urllib
import urllib

def web_socket_do_extra_handshake(request):
url_parts = urllib.parse.urlsplit(request.uri)
Expand Down
2 changes: 1 addition & 1 deletion websockets/handlers/set-cookie_wsh.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/python
from six.moves import urllib
import urllib


def web_socket_do_extra_handshake(request):
Expand Down
2 changes: 1 addition & 1 deletion websockets/handlers/set-cookies-samesite_wsh.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from six.moves import urllib
import urllib


def web_socket_do_extra_handshake(request):
Expand Down
2 changes: 1 addition & 1 deletion websockets/handlers/stash_responder_wsh.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
from six.moves import urllib
import json
import urllib
from mod_pywebsocket import common, msgutil, util
from mod_pywebsocket.handshake import hybi
from wptserve import stash
Expand Down
2 changes: 0 additions & 2 deletions xhr/resources/trickle.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import time

from six.moves import range

def main(request, response):
chunk = b"TEST_TRICKLE\n"
delay = float(request.GET.first(b"ms", 500)) / 1E3
Expand Down

0 comments on commit de4991c

Please sign in to comment.