Skip to content

Commit 66b6ff7

Browse files
committed
Allow list-of-tuple coersions as well.
This doesn't affect the microbenchmark, and actually passes the unit tests... :/
1 parent a44b626 commit 66b6ff7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

referencing/_core.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from urllib.parse import unquote, urldefrag, urljoin
66

77
from attrs import evolve, field
8-
from pyrsistent import plist, pmap, s
8+
from pyrsistent import PMap as PMapType, plist, pmap, s
99
from pyrsistent.typing import PList, PMap, PSet
1010

1111
from referencing import exceptions
@@ -198,8 +198,12 @@ def _fail_to_retrieve(uri: URI):
198198
raise exceptions.NoSuchResource(ref=uri)
199199

200200

201-
def _to_pmap(mapping: dict[URI, Resource[D]] | PMap[URI, Resource[D]]):
202-
return pmap(mapping) if isinstance(mapping, dict) else mapping
201+
def _to_pmap(
202+
value: dict[URI, Resource[D]]
203+
| PMap[URI, Resource[D]]
204+
| list[tuple[URI, Resource[D]]],
205+
):
206+
return value if isinstance(value, PMapType) else pmap(value)
203207

204208

205209
@frozen

0 commit comments

Comments
 (0)