@@ -111,7 +111,7 @@ def __init__(self, ctx, schemagraph=None, foreign_properties=None,
111
111
self .add_context (ctx )
112
112
113
113
def expand_url (self , url , base_url , scoped_id = False , vocab_term = False , scoped_ref = None ):
114
- # type: (Union[str, unicode], Union[str, unicode], bool, bool, bool ) -> Union[str, unicode]
114
+ # type: (Union[str, unicode], Union[str, unicode], bool, bool, int ) -> Union[str, unicode]
115
115
if url in ("@id" , "@type" ):
116
116
return url
117
117
@@ -362,6 +362,7 @@ def _resolve_idmap(self, document, loader):
362
362
typeDSLregex = re .compile (r"^([^[?]+)(\[\])?(\?)?$" )
363
363
364
364
def _type_dsl (self , t ):
365
+ # type: (Any) -> Any
365
366
r = t
366
367
if not isinstance (t , (str , unicode )):
367
368
return t
@@ -378,6 +379,7 @@ def _type_dsl(self, t):
378
379
return r
379
380
380
381
def _resolve_type_dsl (self , document , loader ):
382
+ # type: (Dict[unicode, Union[unicode, List[unicode]]], Loader) -> None
381
383
for d in loader .type_dsl_fields :
382
384
if d in document :
383
385
if isinstance (document [d ], (str , unicode )):
@@ -387,7 +389,7 @@ def _resolve_type_dsl(self, document, loader):
387
389
388
390
if isinstance (document [d ], list ):
389
391
document [d ] = flatten (document [d ])
390
- seen = []
392
+ seen = [] # type: List[unicode]
391
393
uniq = []
392
394
for item in document [d ]:
393
395
if item not in seen :
@@ -402,7 +404,7 @@ def _resolve_identifier(self, document, loader, base_url):
402
404
if identifer in document :
403
405
if isinstance (document [identifer ], basestring ):
404
406
document [identifer ] = loader .expand_url (
405
- document [identifer ], base_url , scoped = True )
407
+ document [identifer ], base_url , scoped_id = True )
406
408
if (document [identifer ] not in loader .idx
407
409
or isinstance (
408
410
loader .idx [document [identifer ]], basestring )):
@@ -618,6 +620,7 @@ def check_file(self, fn): # type: (Union[str, unicode]) -> bool
618
620
FieldType = TypeVar ('FieldType' , unicode , List [str ], Dict [str , Any ])
619
621
620
622
def validate_scoped (self , field , link , docid ):
623
+ # type: (unicode, unicode, unicode) -> unicode
621
624
split = urlparse .urlsplit (docid )
622
625
sp = split .fragment .split ("/" )
623
626
n = self .scoped_ref_fields [field ]
0 commit comments