77from pyrsistent import m , plist , s
88from pyrsistent .typing import PList , PMap , PSet
99
10+ from referencing .typing import Anchor as AnchorType , Schema , Specification
11+
1012
1113class UnsupportedSubclassing (Exception ):
1214 @classmethod
@@ -24,8 +26,6 @@ class UnidentifiedResource(Exception):
2426
2527if TYPE_CHECKING :
2628 from attrs import define , evolve , field , frozen
27-
28- from referencing .typing import AnchorType , Schema , Specification
2929else :
3030 from attrs import define as _define , evolve , field , frozen as _frozen
3131
@@ -56,7 +56,7 @@ class DynamicAnchor:
5656 name : str
5757 resource : Schema
5858
59- def resolve (self , dynamic_scope , uri ) -> tuple [ Schema , str ] :
59+ def resolve (self , dynamic_scope , uri ):
6060 last = self .resource
6161 for resource , anchors in dynamic_scope :
6262 anchor = anchors .get (self .name )
@@ -124,7 +124,7 @@ def with_resources(self, pairs) -> Registry:
124124 uncrawled = uncrawled .add (uri )
125125 return evolve (self , contents = contents , uncrawled = uncrawled )
126126
127- def with_anchor (self , anchor : Anchor | DynamicAnchor ) -> Registry :
127+ def with_anchor (self , anchor : AnchorType ) -> Registry :
128128 resource , anchors = self ._contents [anchor .uri ]
129129 new = resource , anchors .set (anchor .name , anchor )
130130 return evolve (self , contents = self ._contents .set (anchor .uri , new ))
0 commit comments