Skip to content

Commit

Permalink
Revert "Lazy import urllib"
Browse files Browse the repository at this point in the history
This reverts commit a20f297.
  • Loading branch information
danielhollas committed Sep 4, 2023
1 parent a20f297 commit ffd9987
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions fastjsonschema/ref_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
"""

import contextlib
import json
import re
from urllib import parse as urlparse
from urllib.parse import unquote
from urllib.request import urlopen

from .exceptions import JsonSchemaDefinitionException

Expand All @@ -26,8 +29,6 @@ def resolve_path(schema, fragment):
Path is unescaped according https://tools.ietf.org/html/rfc6901
"""
from urllib.parse import unquote

fragment = fragment.lstrip('/')
parts = unquote(fragment).split('/') if fragment else []
for part in parts:
Expand All @@ -54,9 +55,6 @@ def resolve_remote(uri, handlers):
urllib library is used to fetch requests from the remote ``uri``
if handlers does notdefine otherwise.
"""
import json
from urllib.request import urlopen

scheme = urlparse.urlsplit(uri).scheme
if scheme in handlers:
result = handlers[scheme](uri)
Expand Down Expand Up @@ -151,8 +149,6 @@ def get_scope_name(self):
"""
Get current scope and return it as a valid function name.
"""
from urllib.parse import unquote

name = 'validate_' + unquote(self.resolution_scope).replace('~1', '_').replace('~0', '_').replace('"', '')
name = re.sub(r'($[^a-zA-Z]|[^a-zA-Z0-9])', '_', name)
name = name.lower().rstrip('_')
Expand Down

0 comments on commit ffd9987

Please sign in to comment.