Skip to content

Commit 191457a

Browse files
committed
Minor DRYing
1 parent bb80d66 commit 191457a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

referencing/jsonschema.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,12 @@ def id_of(self, resource):
181181
if resource is True or resource is False or "$ref" in resource:
182182
return None
183183
id = resource.get("id")
184-
if id is not None and not id.startswith("#"):
185-
return id
184+
if id is None or id.startswith("#"):
185+
return
186+
return id
186187

187188
def anchors_in(self, resource):
188-
anchor = resource.get("id", "")
189+
anchor = self.id_of(resource) or ""
189190
if anchor.startswith("#"):
190191
yield Anchor(name=anchor[1:], resource=resource)
191192

0 commit comments

Comments
 (0)