Skip to content

Commit

Permalink
Move another compat import into compat.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian committed Nov 25, 2018
1 parent 5b21e46 commit 3ececbd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
4 changes: 2 additions & 2 deletions jsonschema/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from urllib.parse import (
unquote, urljoin, urlunsplit, SplitResult, urlsplit as _urlsplit
)
from urllib.request import urlopen
from urllib.request import pathname2url, urlopen
str_types = str,
int_types = int,
iteritems = operator.methodcaller("items")
Expand All @@ -32,7 +32,7 @@
from urlparse import (
urljoin, urlunsplit, SplitResult, urlsplit as _urlsplit # noqa
)
from urllib import unquote # noqa
from urllib import pathname2url, unquote # noqa
import urllib2 # noqa
def urlopen(*args, **kwargs):
return contextlib.closing(urllib2.urlopen(*args, **kwargs))
Expand Down
8 changes: 1 addition & 7 deletions jsonschema/tests/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,10 @@
_types,
validators,
)
from jsonschema.compat import PY3
from jsonschema.compat import PY3, pathname2url
from jsonschema.tests.compat import mock


if PY3:
from urllib.request import pathname2url
else:
from urllib import pathname2url


def startswith(validator, startswith, instance, schema):
if not instance.startswith(startswith):
yield ValidationError(u"Whoops!")
Expand Down

0 comments on commit 3ececbd

Please sign in to comment.