Skip to content

Commit ffd9987

Browse files
committed
Revert "Lazy import urllib"
This reverts commit a20f297.
1 parent a20f297 commit ffd9987

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

fastjsonschema/ref_resolver.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
"""
88

99
import contextlib
10+
import json
1011
import re
1112
from urllib import parse as urlparse
13+
from urllib.parse import unquote
14+
from urllib.request import urlopen
1215

1316
from .exceptions import JsonSchemaDefinitionException
1417

@@ -26,8 +29,6 @@ def resolve_path(schema, fragment):
2629
2730
Path is unescaped according https://tools.ietf.org/html/rfc6901
2831
"""
29-
from urllib.parse import unquote
30-
3132
fragment = fragment.lstrip('/')
3233
parts = unquote(fragment).split('/') if fragment else []
3334
for part in parts:
@@ -54,9 +55,6 @@ def resolve_remote(uri, handlers):
5455
urllib library is used to fetch requests from the remote ``uri``
5556
if handlers does notdefine otherwise.
5657
"""
57-
import json
58-
from urllib.request import urlopen
59-
6058
scheme = urlparse.urlsplit(uri).scheme
6159
if scheme in handlers:
6260
result = handlers[scheme](uri)
@@ -151,8 +149,6 @@ def get_scope_name(self):
151149
"""
152150
Get current scope and return it as a valid function name.
153151
"""
154-
from urllib.parse import unquote
155-
156152
name = 'validate_' + unquote(self.resolution_scope).replace('~1', '_').replace('~0', '_').replace('"', '')
157153
name = re.sub(r'($[^a-zA-Z]|[^a-zA-Z0-9])', '_', name)
158154
name = name.lower().rstrip('_')

0 commit comments

Comments
 (0)