Skip to content

Commit c03eb1e

Browse files
committed
type fixes
1 parent 6e71f35 commit c03eb1e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

schema_salad/ref_resolver.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def __init__(self, ctx, schemagraph=None, foreign_properties=None,
111111
self.add_context(ctx)
112112

113113
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]
115115
if url in ("@id", "@type"):
116116
return url
117117

@@ -362,6 +362,7 @@ def _resolve_idmap(self, document, loader):
362362
typeDSLregex = re.compile(r"^([^[?]+)(\[\])?(\?)?$")
363363

364364
def _type_dsl(self, t):
365+
# type: (Any) -> Any
365366
r = t
366367
if not isinstance(t, (str, unicode)):
367368
return t
@@ -378,6 +379,7 @@ def _type_dsl(self, t):
378379
return r
379380

380381
def _resolve_type_dsl(self, document, loader):
382+
# type: (Dict[unicode, Union[unicode, List[unicode]]], Loader) -> None
381383
for d in loader.type_dsl_fields:
382384
if d in document:
383385
if isinstance(document[d], (str, unicode)):
@@ -387,7 +389,7 @@ def _resolve_type_dsl(self, document, loader):
387389

388390
if isinstance(document[d], list):
389391
document[d] = flatten(document[d])
390-
seen = []
392+
seen = [] # type: List[unicode]
391393
uniq = []
392394
for item in document[d]:
393395
if item not in seen:
@@ -402,7 +404,7 @@ def _resolve_identifier(self, document, loader, base_url):
402404
if identifer in document:
403405
if isinstance(document[identifer], basestring):
404406
document[identifer] = loader.expand_url(
405-
document[identifer], base_url, scoped=True)
407+
document[identifer], base_url, scoped_id=True)
406408
if (document[identifer] not in loader.idx
407409
or isinstance(
408410
loader.idx[document[identifer]], basestring)):
@@ -618,6 +620,7 @@ def check_file(self, fn): # type: (Union[str, unicode]) -> bool
618620
FieldType = TypeVar('FieldType', unicode, List[str], Dict[str, Any])
619621

620622
def validate_scoped(self, field, link, docid):
623+
# type: (unicode, unicode, unicode) -> unicode
621624
split = urlparse.urlsplit(docid)
622625
sp = split.fragment.split("/")
623626
n = self.scoped_ref_fields[field]

0 commit comments

Comments
 (0)