Skip to content

Commit beea67b

Browse files
committed
Remove RefResolver.scopes_stack_copy.
This makes the (anyhow-not-yet-working) dynamicRef validators access private state on ref resolvers, but that will be fixed when aforementioned not-working is fixed.
1 parent 15ddd2f commit beea67b

File tree

3 files changed

+2
-11
lines changed

3 files changed

+2
-11
lines changed

jsonschema/_legacy_validators.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,9 @@ def contains_draft6_draft7(validator, contains, instance, schema):
207207

208208

209209
def recursiveRef(validator, recursiveRef, instance, schema):
210-
scope_stack = validator.resolver.scopes_stack_copy
211210
lookup_url, target = validator.resolver.resolution_scope, validator.schema
212211

213-
for each in reversed(scope_stack[1:]):
212+
for each in reversed(validator.resolver._scopes_stack[1:]):
214213
lookup_url, next_target = validator.resolver.resolve(each)
215214
if next_target.get("$recursiveAnchor"):
216215
target = next_target

jsonschema/_validators.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,8 @@ def ref(validator, ref, instance, schema):
299299

300300
def dynamicRef(validator, dynamicRef, instance, schema):
301301
_, fragment = urldefrag(dynamicRef)
302-
scope_stack = validator.resolver.scopes_stack_copy
303302

304-
for url in scope_stack:
303+
for url in validator.resolver._scopes_stack:
305304
lookup_url = urljoin(url, dynamicRef)
306305
with validator.resolver.resolving(lookup_url) as subschema:
307306
if ("$dynamicAnchor" in subschema

jsonschema/validators.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -671,13 +671,6 @@ def resolution_scope(self):
671671
"""
672672
return self._scopes_stack[-1]
673673

674-
@property
675-
def scopes_stack_copy(self):
676-
"""
677-
Retrieve a copy of the stack of resolution scopes.
678-
"""
679-
return self._scopes_stack.copy()
680-
681674
@property
682675
def base_uri(self):
683676
"""

0 commit comments

Comments
 (0)