Add some arg types to docstrings
This commit is contained in:
@@ -525,18 +525,25 @@ class RefResolver(object):
|
||||
"""
|
||||
Resolve JSON References.
|
||||
|
||||
:argument string base_uri: URI of the referring document
|
||||
:argument referrer: the actual referring document
|
||||
:argument dict store: a mapping from URIs to documents to cache
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, base_uri, referrer, store=()):
|
||||
self.base_uri = base_uri
|
||||
self.referrer = referrer
|
||||
self.store = collections.defaultdict(dict, store, **_meta_schemas())
|
||||
self.store = dict(store, **_meta_schemas())
|
||||
|
||||
@classmethod
|
||||
def from_schema(cls, schema, *args, **kwargs):
|
||||
"""
|
||||
Construct a resolver from a JSON schema object.
|
||||
|
||||
:argument schema schema: the referring schema
|
||||
:rtype: :class:`RefResolver`
|
||||
|
||||
"""
|
||||
|
||||
return cls(schema.get("id", ""), schema, *args, **kwargs)
|
||||
@@ -545,6 +552,9 @@ class RefResolver(object):
|
||||
"""
|
||||
Resolve a JSON ``ref``.
|
||||
|
||||
:argument string ref: reference to resolve
|
||||
:returns: the referrant document
|
||||
|
||||
"""
|
||||
|
||||
base_uri = self.base_uri
|
||||
@@ -563,6 +573,9 @@ class RefResolver(object):
|
||||
"""
|
||||
Resolve a ``fragment`` within the referenced ``document``.
|
||||
|
||||
:argument document: the referrant document
|
||||
:argument string fragment: a URI fragment to resolve within it
|
||||
|
||||
"""
|
||||
|
||||
parts = unquote(fragment).split("/") if fragment else []
|
||||
@@ -583,6 +596,9 @@ class RefResolver(object):
|
||||
|
||||
Does not check the store first.
|
||||
|
||||
:argument string uri: the URI to resolve
|
||||
:returns: the retrieved document
|
||||
|
||||
"""
|
||||
|
||||
return json.load(urlopen(uri))
|
||||
|
||||
Reference in New Issue
Block a user