@@ -96,7 +96,8 @@ def merge_properties(a, b): # type: (List[Any], List[Any]) -> Dict[Any, Any]
96
96
def SubLoader (loader ): # type: (Loader) -> Loader
97
97
return Loader (loader .ctx , schemagraph = loader .graph ,
98
98
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 )
100
101
101
102
class Fetcher (object ):
102
103
def fetch_text (self , url ): # type: (unicode) -> unicode
@@ -178,7 +179,8 @@ def __init__(self,
178
179
idx = None , # type: Dict[unicode, Union[CommentedMap, CommentedSeq, unicode, None]]
179
180
cache = None , # type: Dict[unicode, Any]
180
181
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
182
184
):
183
185
# type: (...) -> None
184
186
@@ -204,6 +206,11 @@ def __init__(self,
204
206
else :
205
207
self .cache = {}
206
208
209
+ if skip_schemas is not None :
210
+ self .skip_schemas = skip_schemas
211
+ else :
212
+ self .skip_schemas = False
213
+
207
214
if session is None :
208
215
if "HOME" in os .environ :
209
216
self .session = CacheControl (
@@ -304,6 +311,8 @@ def add_namespaces(self, ns): # type: (Dict[unicode, unicode]) -> None
304
311
305
312
def add_schemas (self , ns , base_url ):
306
313
# type: (Union[List[unicode], unicode], unicode) -> None
314
+ if self .skip_schemas :
315
+ return
307
316
for sch in aslist (ns ):
308
317
fetchurl = self .fetcher .urljoin (base_url , sch )
309
318
if fetchurl not in self .cache :
0 commit comments