7
7
from pyrsistent import m , plist , s
8
8
from pyrsistent .typing import PList , PMap , PSet
9
9
10
+ from referencing .typing import Anchor as AnchorType , Schema , Specification
11
+
10
12
11
13
class UnsupportedSubclassing (Exception ):
12
14
@classmethod
@@ -24,8 +26,6 @@ class UnidentifiedResource(Exception):
24
26
25
27
if TYPE_CHECKING :
26
28
from attrs import define , evolve , field , frozen
27
-
28
- from referencing .typing import AnchorType , Schema , Specification
29
29
else :
30
30
from attrs import define as _define , evolve , field , frozen as _frozen
31
31
@@ -56,7 +56,7 @@ class DynamicAnchor:
56
56
name : str
57
57
resource : Schema
58
58
59
- def resolve (self , dynamic_scope , uri ) -> tuple [ Schema , str ] :
59
+ def resolve (self , dynamic_scope , uri ):
60
60
last = self .resource
61
61
for resource , anchors in dynamic_scope :
62
62
anchor = anchors .get (self .name )
@@ -124,7 +124,7 @@ def with_resources(self, pairs) -> Registry:
124
124
uncrawled = uncrawled .add (uri )
125
125
return evolve (self , contents = contents , uncrawled = uncrawled )
126
126
127
- def with_anchor (self , anchor : Anchor | DynamicAnchor ) -> Registry :
127
+ def with_anchor (self , anchor : AnchorType ) -> Registry :
128
128
resource , anchors = self ._contents [anchor .uri ]
129
129
new = resource , anchors .set (anchor .name , anchor )
130
130
return evolve (self , contents = self ._contents .set (anchor .uri , new ))
0 commit comments