Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8372fe2

Browse files
authoredJun 24, 2017
Merge branch 'master' into master
2 parents 6a582c3 + d370602 commit 8372fe2

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed
 

‎schema_salad/ref_resolver.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ def merge_properties(a, b): # type: (List[Any], List[Any]) -> Dict[Any, Any]
9696
def SubLoader(loader): # type: (Loader) -> Loader
9797
return Loader(loader.ctx, schemagraph=loader.graph,
9898
foreign_properties=loader.foreign_properties, idx=loader.idx,
99-
cache=loader.cache, fetcher_constructor=loader.fetcher_constructor)
99+
cache=loader.cache, fetcher_constructor=loader.fetcher_constructor,
100+
skip_schemas=loader.skip_schemas)
100101

101102
class Fetcher(object):
102103
def fetch_text(self, url): # type: (unicode) -> unicode
@@ -178,7 +179,8 @@ def __init__(self,
178179
idx=None, # type: Dict[unicode, Union[CommentedMap, CommentedSeq, unicode, None]]
179180
cache=None, # type: Dict[unicode, Any]
180181
session=None, # type: requests.sessions.Session
181-
fetcher_constructor=None # type: Callable[[Dict[unicode, unicode], requests.sessions.Session], Fetcher]
182+
fetcher_constructor=None, # type: Callable[[Dict[unicode, unicode], requests.sessions.Session], Fetcher]
183+
skip_schemas=None # type: bool
182184
):
183185
# type: (...) -> None
184186

@@ -204,6 +206,11 @@ def __init__(self,
204206
else:
205207
self.cache = {}
206208

209+
if skip_schemas is not None:
210+
self.skip_schemas = skip_schemas
211+
else:
212+
self.skip_schemas = False
213+
207214
if session is None:
208215
if "HOME" in os.environ:
209216
self.session = CacheControl(
@@ -304,6 +311,8 @@ def add_namespaces(self, ns): # type: (Dict[unicode, unicode]) -> None
304311

305312
def add_schemas(self, ns, base_url):
306313
# type: (Union[List[unicode], unicode], unicode) -> None
314+
if self.skip_schemas:
315+
return
307316
for sch in aslist(ns):
308317
fetchurl = self.fetcher.urljoin(base_url, sch)
309318
if fetchurl not in self.cache:

0 commit comments

Comments
 (0)
Please sign in to comment.