+
    8•üi©
  ã                  óø   € R t ^ RIHt ^ RIHt ^ RIHt ^ RIt ^ RIH	t	 ^ RIHt ]'       d   ^ RIHt ^ RIHtHtHt ]	! R	]R
7      tR]P*                  ]P,                  3R R lltR#   ]
 d
    ^ RIH	t	  LXi ; i)z2
Helpers related to (dynamic) resource retrieval.
)Úannotations©Ú	lru_cache)ÚTYPE_CHECKINGN)ÚTypeVar)ÚResource)ÚCallable)ÚURIÚDÚRetrieveÚ_T)Údefaultc               ó(   € V ^8„  d   QhRRRRRRRR/# )	é   Úcachez+Callable[[Retrieve[D]], Retrieve[D]] | NoneÚloadszCallable[[_T], D]Úfrom_contentszCallable[[D], Resource[D]]Úreturnz,Callable[[Callable[[URI], _T]], Retrieve[D]]© )Úformats   "ÚS/var/www/html/photoedit/myenv/lib/python3.14/site-packages/referencing/retrieval.pyÚ__annotate__r      s6   € ÷ Cñ CØ6ðCàðCð .ðCð 2ñ	Có    c                óB   a aa€ S f   \        RR7      o R V VV3R llpV# )a·  
Create a retriever which caches its return values from a simpler callable.

Takes a function which returns things like serialized JSON (strings) and
returns something suitable for passing to `Registry` as a retrieve
function.

This decorator both reduces a small bit of boilerplate for a common case
(deserializing JSON from strings and creating `Resource` objects from the
result) as well as makes the probable need for caching a bit easier.
Retrievers which otherwise do expensive operations (like hitting the
network) might otherwise be called repeatedly.

Examples
--------

.. testcode::

    from referencing import Registry
    from referencing.typing import URI
    import referencing.retrieval


    @referencing.retrieval.to_cached_resource()
    def retrieve(uri: URI):
        print(f"Retrieved {uri}")

        # Normally, go get some expensive JSON from the network, a file ...
        return '''
            {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "foo": "bar"
            }
        '''

    one = Registry(retrieve=retrieve).get_or_retrieve("urn:example:foo")
    print(one.value.contents["foo"])

    # Retrieving the same URI again reuses the same value (and thus doesn't
    # print another retrieval message here)
    two = Registry(retrieve=retrieve).get_or_retrieve("urn:example:foo")
    print(two.value.contents["foo"])

.. testoutput::

    Retrieved urn:example:foo
    bar
    bar

N)Úmaxsizec               ó   € V ^8„  d   QhRR/# )r   ÚretrievezCallable[[URI], _T]r   )r   s   "r   r   Ú(to_cached_resource.<locals>.__annotate__U   s   € ÷ ñ Ð/ñ r   c                ó*   <a € SR  VVV 3R ll4       pV# )c               ó   € V ^8„  d   QhRR/# )r   Úurir	   r   )r   s   "r   r   Ú;to_cached_resource.<locals>.decorator.<locals>.__annotate__W   s   € ÷ 	+ñ 	+ ñ 	+r   c                ó4   <€ S! V 4      pS! V4      pS! V4      # )Nr   )r    ÚresponseÚcontentsr   r   r   s   &  €€€r   Úcached_retrieveÚ>to_cached_resource.<locals>.decorator.<locals>.cached_retrieveV   s    ø€ á “}ˆHÙ˜X“ˆHÙ  Ó*Ð*r   r   )r   r%   r   r   r   s   f €€€r   Ú	decoratorÚ%to_cached_resource.<locals>.decoratorU   s"   ù€ Ø	÷	+ñ 	+ó 
ð	+ð
 Ðr   r   )r   r   r   r'   s   fff r   Úto_cached_resourcer)      s'   ú€ ðn ‚}Ü $Ô'ˆ÷ò ð Ðr   )Ú__doc__Ú
__future__r   Ú	functoolsr   Útypingr   ÚjsonÚtyping_extensionsr   ÚImportErrorÚreferencingr   Úcollections.abcr   Úreferencing.typingr	   r
   r   Ústrr   r   r   r)   r   r   r   Ú<module>r5      st   ðñõ #å Ý  Û ðÝ)õ !çÝ(ç3Ñ3ñ ˆT˜3Ô€ð :>Ø#Ÿz™zØ08×0FÑ0F÷Cñ Cøð ô ßðús   šA) Á)A9Á8A9