@@ -79,15 +79,6 @@ class Registry:
79
79
)
80
80
_uncrawled : PSet [str ] = field (default = s ())
81
81
82
- def with_resource (self , resource ) -> Registry :
83
- uri = id_of (resource )
84
- if uri is None :
85
- raise UnidentifiedResource (resource )
86
- return self .with_identified_resource (uri = uri , resource = resource )
87
-
88
- def with_identified_resource (self , uri , resource ) -> Registry :
89
- return self .with_resources ([(uri , resource )])
90
-
91
82
def update (self , * registries : Registry ) -> Registry :
92
83
contents = (each ._contents for each in registries )
93
84
uncrawled = (each ._uncrawled for each in registries )
@@ -97,6 +88,15 @@ def update(self, *registries: Registry) -> Registry:
97
88
uncrawled = self ._uncrawled .update (* uncrawled ),
98
89
)
99
90
91
+ def with_resource (self , resource ) -> Registry :
92
+ uri = id_of (resource )
93
+ if uri is None :
94
+ raise UnidentifiedResource (resource )
95
+ return self .with_identified_resource (uri = uri , resource = resource )
96
+
97
+ def with_identified_resource (self , uri , resource ) -> Registry :
98
+ return self .with_resources ([(uri , resource )])
99
+
100
100
def with_resources (self , pairs ) -> Registry :
101
101
uncrawled = self ._uncrawled
102
102
contents = self ._contents
@@ -125,13 +125,13 @@ def resource_at(self, uri: str) -> tuple[Schema, Registry]:
125
125
if at_uri is not None and at_uri [1 ]:
126
126
registry = self
127
127
else :
128
- registry = self .crawl ()
128
+ registry = self ._crawl ()
129
129
return registry ._contents [uri ][0 ], registry
130
130
131
131
def anchor_at (self , uri , name ) -> AnchorType :
132
132
return self ._contents [uri ][1 ][name ]
133
133
134
- def crawl (self ) -> Registry :
134
+ def _crawl (self ) -> Registry :
135
135
registry = self
136
136
resources = [(uri , self ._contents [uri ][0 ]) for uri in self ._uncrawled ]
137
137
while resources :
0 commit comments