|
OpenQuizz
Une application de gestion des contenus pédagogiques
|


Public Member Functions | |
| def | __init__ (self, base_uri, referrer, store=(), cache_remote=True, handlers=(), urljoin_cache=None, remote_cache=None) |
| def | from_schema (cls, schema, id_of=_id_of, *args, **kwargs) |
| def | push_scope (self, scope) |
| def | pop_scope (self) |
| def | resolution_scope (self) |
| def | base_uri (self) |
| def | in_scope (self, scope) |
| def | resolving (self, ref) |
| def | resolve (self, ref) |
| def | resolve_from_url (self, url) |
| def | resolve_fragment (self, document, fragment) |
| def | resolve_remote (self, uri) |
Data Fields | |
| referrer | |
| cache_remote | |
| handlers | |
| store | |
Resolve JSON References.
Arguments:
base_uri (str):
The URI of the referring document
referrer:
The actual referring document
store (dict):
A mapping from URIs to documents to cache
cache_remote (bool):
Whether remote refs should be cached after first resolution
handlers (dict):
A mapping from URI schemes to functions that should be used
to retrieve them
urljoin_cache (:func:`functools.lru_cache`):
A cache that will be used for caching the results of joining
the resolution scope to subscopes.
remote_cache (:func:`functools.lru_cache`):
A cache that will be used for caching the results of
resolved remote URLs.
Attributes:
cache_remote (bool):
Whether remote refs should be cached after first resolution
| def __init__ | ( | self, | |
| base_uri, | |||
| referrer, | |||
store = (), |
|||
cache_remote = True, |
|||
handlers = (), |
|||
urljoin_cache = None, |
|||
remote_cache = None |
|||
| ) |
| def base_uri | ( | self | ) |
Retrieve the current base URI, not including any fragment.
| def from_schema | ( | cls, | |
| schema, | |||
id_of = _id_of, |
|||
| * | args, | ||
| ** | kwargs | ||
| ) |
Construct a resolver from a JSON schema object.
Arguments:
schema:
the referring schema
Returns:
`RefResolver`
| def in_scope | ( | self, | |
| scope | |||
| ) |
Temporarily enter the given scope for the duration of the context.
| def pop_scope | ( | self | ) |
Exit the most recent entered scope. Treats further dereferences as being performed underneath the original scope. Don't call this method more times than `push_scope` has been called.
| def push_scope | ( | self, | |
| scope | |||
| ) |
Enter a given sub-scope. Treats further dereferences as being performed underneath the given scope.
| def resolution_scope | ( | self | ) |
Retrieve the current resolution scope.
| def resolve | ( | self, | |
| ref | |||
| ) |
Resolve the given reference.
| def resolve_fragment | ( | self, | |
| document, | |||
| fragment | |||
| ) |
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
| def resolve_from_url | ( | self, | |
| url | |||
| ) |
Resolve the given remote URL.
| def resolve_remote | ( | self, | |
| uri | |||
| ) |
Resolve a remote ``uri``.
If called directly, does not check the store first, but after
retrieving the document at the specified URI it will be saved in
the store if :attr:`cache_remote` is True.
.. note::
If the requests_ library is present, ``jsonschema`` will use it to
request the remote ``uri``, so that the correct encoding is
detected and used.
If it isn't, or if the scheme of the ``uri`` is not ``http`` or
``https``, UTF-8 is assumed.
Arguments:
uri (str):
The URI to resolve
Returns:
The retrieved document
.. _requests: https://pypi.org/project/requests/
| def resolving | ( | self, | |
| ref | |||
| ) |
Resolve the given ``ref`` and enter its resolution scope.
Exits the scope on exit of this context manager.
Arguments:
ref (str):
The reference to resolve
| cache_remote |
| handlers |
| referrer |
| store |