Skip to content

Commit 86e8816

Browse files
committed
Few more type hints.
1 parent e008282 commit 86e8816

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

referencing/_core.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Anchor:
2121
name: str
2222
resource: Schema
2323

24-
def resolve(self, resolver, uri) -> tuple[Schema, str]:
24+
def resolve(self, resolver: Resolver, uri: str) -> tuple[Schema, str]:
2525
return self.resource, uri
2626

2727

@@ -63,7 +63,7 @@ def update(self, *registries: Registry) -> Registry:
6363
uncrawled=self._uncrawled.update(*uncrawled),
6464
)
6565

66-
def with_resource(self, resource) -> Registry:
66+
def with_resource(self, resource: Schema) -> Registry:
6767
uri = self._specification.id_of(resource)
6868
if uri is None:
6969
raise UnidentifiedResource(resource)
@@ -72,7 +72,7 @@ def with_resource(self, resource) -> Registry:
7272
def with_identified_resource(self, uri, resource) -> Registry:
7373
return self.with_resources([(uri, resource)])
7474

75-
def with_resources(self, pairs) -> Registry:
75+
def with_resources(self, pairs: Iterable[tuple[str, Schema]]) -> Registry:
7676
uncrawled = self._uncrawled
7777
contents = self._contents
7878
for uri, resource in pairs:
@@ -109,7 +109,7 @@ def resource_at(self, uri: str) -> tuple[Schema, Registry]:
109109
registry = self._crawl()
110110
return registry._contents[uri][0], registry
111111

112-
def anchors_at(self, uri) -> PMap[str, AnchorType]:
112+
def anchors_at(self, uri: str) -> PMap[str, AnchorType]:
113113
return self._contents[uri][1]
114114

115115
def _crawl(self) -> Registry:
@@ -137,7 +137,7 @@ def _crawl(self) -> Registry:
137137
)
138138
return evolve(registry, uncrawled=s())
139139

140-
def resolver(self, root, specification) -> Resolver:
140+
def resolver(self, root: Schema, specification: Specification) -> Resolver:
141141
uri = self._specification.id_of(root) or ""
142142
registry = self.with_identified_resource(uri=uri, resource=root)
143143
registry = evolve(registry, specification=specification)
@@ -187,7 +187,7 @@ def lookup(self, ref: str) -> tuple[Schema, Resolver]:
187187
base_uri = urljoin(self._base_uri, id).rstrip("#")
188188
return target, self.evolve(base_uri=base_uri, registry=registry)
189189

190-
def with_root(self, root) -> Resolver:
190+
def with_root(self, root: Schema) -> Resolver:
191191
maybe_relative = self._registry._specification.id_of(root)
192192
if maybe_relative is None:
193193
return self

0 commit comments

Comments
 (0)