403Webshell
Server IP : 88.99.149.37  /  Your IP : 216.73.216.141
Web Server : nginx/1.31.2
System : Linux server-88-99-149-37 6.12.0-124.56.5.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Fri May 15 06:12:08 EDT 2026 x86_64
User : muralimurth ( 1015)
PHP Version : 8.4.23
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.12/site-packages/referencing/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.12/site-packages/referencing/__pycache__/retrieval.cpython-312.opt-1.pyc
�

�% g
���dZddlmZddlmZddlmZmZmZddl	Z	ddl
mZer
ddlm
Z
mZmZed�Zde	j"ej$f							d
d	�Zy)z2
Helpers related to (dynamic) resource retrieval.
�)�annotations��	lru_cache)�
TYPE_CHECKING�Callable�TypeVarN)�Resource)�URI�D�Retrieve�_Tc�8������td���d���fd�}|S)aG
    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�$����d���fd��}|S)Nc�4���|�}�|�}�|�S)N�)�uri�response�contents�
from_contents�loads�retrieves   ����:/usr/lib/python3.12/site-packages/referencing/retrieval.py�cached_retrievez>to_cached_resource.<locals>.decorator.<locals>.cached_retrieveNs �����}�H��X��H� ��*�*�)rr
r)rr�cacherrs` ���r�	decoratorz%to_cached_resource.<locals>.decoratorMs���	�	+�
�	+�
�r)rzCallable[[URI], _T]r)rrrrs``` r�to_cached_resourcers"���n
�}��$�'����r)rz+Callable[[Retrieve[D]], Retrieve[D]] | NonerzCallable[[_T], D]rzCallable[[D], Resource[D]]�returnz,Callable[[Callable[[URI], _T]], Retrieve[D]])�__doc__�
__future__r�	functoolsr�typingrrr�json�referencingr	�referencing.typingr
rrr
rrrrrr�<module>r'su���#��3�3�� ��3�3�
�T�]��:>�#�z�z�08�0F�0F�C�6�C��C�.�C�2�	Cr

Youez - 2016 - github.com/yon3zu
LinuXploit