Add option to set MAX_CONTEXT_URLS in ContextResolver#268
Draft
mielvds wants to merge 1 commit into
Draft
Conversation
Collaborator
anatoly-scherbakov
left a comment
There was a problem hiding this comment.
I believe ContextResolver is said to be internal only because JSON-LD spec does not mandates its existence. It mandates existence and API of DocumentLoader though.
| """ | ||
|
|
||
| def __init__(self, shared_cache, document_loader): | ||
| def __init__(self, shared_cache, document_loader, max_context_urls = None): |
Collaborator
There was a problem hiding this comment.
Suggested change
| def __init__(self, shared_cache, document_loader, max_context_urls = None): | |
| def __init__(self, shared_cache, document_loader, max_context_urls: int = MAX_CONTEXT_URLS): |
| self.per_op_cache = {} | ||
| self.shared_cache = shared_cache | ||
| self.document_loader = document_loader | ||
| self._max_context_urls: int = max_context_urls if isinstance(max_context_urls, int) else MAX_CONTEXT_URLS |
Collaborator
There was a problem hiding this comment.
Suggested change
| self._max_context_urls: int = max_context_urls if isinstance(max_context_urls, int) else MAX_CONTEXT_URLS | |
| self.max_context_urls: int = max_context_urls |
| self._max_context_urls: int = max_context_urls if isinstance(max_context_urls, int) else MAX_CONTEXT_URLS | ||
|
|
||
| @property | ||
| def max_context_urls(self) -> int: |
Collaborator
There was a problem hiding this comment.
Not sure why this is necessary. Perhaps just a property is enough?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #104
This would allow setting a custom ContextResolver with a different level, for instance 20:
This is a ok fix, but the contextresolver could use a refactor.
cyclesparameter inContextResolver.resolve()is aset(), but can also be an integer.