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