Skip to content

Commit 3ececbd

Browse files
committed
Move another compat import into compat.py
1 parent 5b21e46 commit 3ececbd

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

jsonschema/compat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from urllib.parse import (
2323
unquote, urljoin, urlunsplit, SplitResult, urlsplit as _urlsplit
2424
)
25-
from urllib.request import urlopen
25+
from urllib.request import pathname2url, urlopen
2626
str_types = str,
2727
int_types = int,
2828
iteritems = operator.methodcaller("items")
@@ -32,7 +32,7 @@
3232
from urlparse import (
3333
urljoin, urlunsplit, SplitResult, urlsplit as _urlsplit # noqa
3434
)
35-
from urllib import unquote # noqa
35+
from urllib import pathname2url, unquote # noqa
3636
import urllib2 # noqa
3737
def urlopen(*args, **kwargs):
3838
return contextlib.closing(urllib2.urlopen(*args, **kwargs))

jsonschema/tests/test_validators.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,10 @@
2020
_types,
2121
validators,
2222
)
23-
from jsonschema.compat import PY3
23+
from jsonschema.compat import PY3, pathname2url
2424
from jsonschema.tests.compat import mock
2525

2626

27-
if PY3:
28-
from urllib.request import pathname2url
29-
else:
30-
from urllib import pathname2url
31-
32-
3327
def startswith(validator, startswith, instance, schema):
3428
if not instance.startswith(startswith):
3529
yield ValidationError(u"Whoops!")

0 commit comments

Comments
 (0)