aboutsummaryrefslogtreecommitdiff
path: root/.venv/lib/python3.12/site-packages/referencing/typing.py
diff options
context:
space:
mode:
authorS. Solomon Darnell2025-03-28 21:52:21 -0500
committerS. Solomon Darnell2025-03-28 21:52:21 -0500
commit4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch)
treeee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/referencing/typing.py
parentcc961e04ba734dd72309fb548a2f97d67d578813 (diff)
downloadgn-ai-master.tar.gz
two version of R2R are hereHEADmaster
Diffstat (limited to '.venv/lib/python3.12/site-packages/referencing/typing.py')
-rw-r--r--.venv/lib/python3.12/site-packages/referencing/typing.py61
1 files changed, 61 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/referencing/typing.py b/.venv/lib/python3.12/site-packages/referencing/typing.py
new file mode 100644
index 00000000..a6144641
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/referencing/typing.py
@@ -0,0 +1,61 @@
+"""
+Type-annotation related support for the referencing library.
+"""
+
+from __future__ import annotations
+
+from collections.abc import Mapping as Mapping
+from typing import TYPE_CHECKING, Any, Protocol
+
+try:
+ from typing_extensions import TypeVar
+except ImportError: # pragma: no cover
+ from typing import TypeVar
+
+if TYPE_CHECKING:
+ from referencing._core import Resolved, Resolver, Resource
+
+#: A URI which identifies a `Resource`.
+URI = str
+
+#: The type of documents within a registry.
+D = TypeVar("D", default=Any)
+
+
+class Retrieve(Protocol[D]):
+ """
+ A retrieval callable, usable within a `Registry` for resource retrieval.
+
+ Does not make assumptions about where the resource might be coming from.
+ """
+
+ def __call__(self, uri: URI) -> Resource[D]:
+ """
+ Retrieve the resource with the given URI.
+
+ Raise `referencing.exceptions.NoSuchResource` if you wish to indicate
+ the retriever cannot lookup the given URI.
+ """
+ ...
+
+
+class Anchor(Protocol[D]):
+ """
+ An anchor within a `Resource`.
+
+ Beyond "simple" anchors, some specifications like JSON Schema's 2020
+ version have dynamic anchors.
+ """
+
+ @property
+ def name(self) -> str:
+ """
+ Return the name of this anchor.
+ """
+ ...
+
+ def resolve(self, resolver: Resolver[D]) -> Resolved[D]:
+ """
+ Return the resource for this anchor.
+ """
+ ...