+
    O(iSF                     v   ^ RI t ^ RIt^ RIt^ RIHtHtHt ^ RIHt	 ^ RI
Ht ^ RIHt  ^ RIt]! ]P                   P                  4      '       g   Rt^ RIHt Rt ! R R	]4      t ! R
 R]4      t ! R R]4      tR tRR ltR]RRRRR3R ltR tRR ltRR ltRR ltR t R t!R t"R#   ] d    Rt Lei ; i)    N)MappingMutableMappingSequence)parse)unquote)urlopen)	LazyProxyz1.1.0c                   6   a  ] tR t^t o RR ltR tR tRtV tR# )JsonRefErrorNc                ^    Wn         W n        W0n        W@n        WPn        V;V n        V n        R # N)message	referenceuribase_uripathcause	__cause__)selfr   r   r   r   r   r   s   &&&&&&&M/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/jsonref.py__init__JsonRefError.__init__   s)    " 	&++
T^    c                T    R V P                   P                  : RV P                  : R2# )<: >)	__class____name__r   r   s   &r   __repr__JsonRefError.__repr__    s    !^^44dllCCr   c                ,    \        V P                  4      # r   )strr   r    s   &r   __str__JsonRefError.__str__#   s    4<<  r   )r   r   r   r   r   r   r   ) r'    N)	r   
__module____qualname____firstlineno__r   r!   r%   __static_attributes____classdictcell____classdict__s   @r   r   r      s     ,D! !r   r   c                      a  ] tR t^'t o RtRt]RR l4       tRR lt]	R 4       t
]	R 4       tR tR tRR	 ltR
 tRtV tR# )JsonRefzW
A lazy loading proxy to the dereferenced data pointed to by a JSON
Reference object.

Nc                "    \        VVVVVR7      # )a  
.. deprecated:: 0.4
    Use :func:`replace_refs` instead.

Returns a deep copy of `obj` with all contained JSON reference objects
replaced with :class:`JsonRef` instances.

:param obj: If this is a JSON reference object, a :class:`JsonRef`
    instance will be created. If `obj` is not a JSON reference object,
    a deep copy of it will be created with all contained JSON
    reference objects replaced by :class:`JsonRef` instances
:param base_uri: URI to resolve relative references against
:param loader: Callable that takes a URI and returns the parsed JSON
    (defaults to global ``jsonloader``)
:param jsonschema: Flag to turn on `JSON Schema mode
    <http://json-schema.org/latest/json-schema-core.html#anchor25>`_.
    'id' keyword changes the `base_uri` for references contained within
    the object
:param load_on_repr: If set to ``False``, :func:`repr` call on a
    :class:`JsonRef` object will not cause the reference to be loaded
    if it hasn't already. (defaults to ``True``)

)r   loader
jsonschemaload_on_repr)replace_refs)clsobjr   r3   r4   r5   s   &&&&&&r   r6   JsonRef.replace_refs0   s     6 !%
 	
r   c	                0   \        VP                  R 4      \        4      '       g   \        RV,          4      hWn        W n        T;'       g    \        V n        W@n        WPn	        W`n
        Wpn        Wn        V P                  f   \        4       V n        R# R# )$refz%Not a valid json reference object: %sN)
isinstancegetr$   
ValueError__reference__r   
jsonloaderr3   r4   r5   merge_propsr   storeURIDict)	r   refobjr   r3   r4   r5   rA   _path_stores	   &&&&&&&&&r   r   JsonRef.__init__S   sx     &**V,c22DvMNN# **
$(&	
:: DJ r   c           
         \        V P                  V P                  V P                  V P                  V P
                  V P                  V P                  R 7      # ))r   r3   r4   r5   rA   r   rB   )dictr   r3   r4   r5   rA   r   rB   r    s   &r   _ref_kwargsJsonRef._ref_kwargsk   sD    ]];;**((**
 	
r   c                f    \         P                  ! V P                  V P                  R ,          4      # )r;   )urlparseurljoinr   r?   r    s   &r   full_uriJsonRef.full_uriw   s$    t/A/A&/IJJr   c           	        \         P                  ! V P                  4      w  rWP                  9  d2    V P	                  V4      p\        T3/ / T P                  CRTRR/CB pMV P                  V,          pV P                  W24      pWPJ d   V P                  R4      h\        VR4      '       d   VP                  pV P                  '       dl   \!        V\"        4      '       dV   \%        V P&                  4      ^8  d<   / VCV P&                  P)                  4        UUu/ uF  w  rgVR8w  g   K  WgbK  	  uppCpV#   \
         d>   pT P                  TP                  P                  : R \        T4      : 2TR7      ThRp?ii ; iu uppi )	r   r   Nr   	recursingFz$Reference refers directly to itself.__subject__r;   )rM   	urldefragrO   rB   r3   	Exception_errorr   r   r$   _replace_refsrJ   resolve_pointerhasattrrT   rA   r<   r   lenr?   items)r   r   fragmentbase_doceresultkvs   &       r   callbackJsonRef.callback{   sn    **4==9 jj ;;s+
 %Ut//US+uUH zz#H%%h9>++DEE6=))''F67++D&&'!+$($6$6$<$<$>N$>DA!v+414$>NF /  kk ! 4 4c!f=Q " * Os#   D; F.F;F8E>>Fc                   V'       d*   \        VP                  R4      4      P                  R4      M. pV Fa  pVP                  RR4      P                  RR4      p\	        V\
        4      '       d    \        V4      pWJ d   V P                  p W,          pKc  	  V#   \         d     L-i ; i  \        \        3 d!   pT P                  RT,          TR7      ThRp?ii ; i)z
Resolve a json pointer ``pointer`` within the referenced ``document``.

:argument document: the referent document
:argument str pointer: a json pointer URI fragment to resolve within it

/z~1z~0~zUnresolvable JSON pointer: %rrR   N)r   lstripsplitreplacer<   r   intr>   r?   	TypeErrorLookupErrorrW   )r   documentpointerpartspartr_   s   &&&   r   rY   JsonRef.resolve_pointer   s     <Cs+,2237D<<c*224=D(H--t9D --#> $  "  {+ kk3g=Q " s*   2BB.B+*B+.C?CCc           	         R P                  V P                  V4      p\        VV P                  V P                  V P                  V P
                  VR7      # )zError while resolving `{}`: {})r   r   r   r   )formatrO   r   r?   r   r   )r   r   r   s   &&&r   rW   JsonRef._error   sI    299$--Q]]
 	
r   c                    \        V R 4      '       g   V P                  '       d   \        V P                  4      # RV P                  ,          # )cachezJsonRef(%r))rZ   r5   reprrT   r?   r    s   &r   r!   JsonRef.__repr__   s<    4!!T%6%6%6(())t1111r   )r?   r   r4   r5   r3   rA   r   rB   r?   )r'   NFT)r'   NFTFr(   Nr   )r   r)   r*   r+   __doc____notproxied__classmethodr6   r   propertyrJ   rO   rc   rY   rW   r!   r,   r-   r.   s   @r   r1   r1   '   sm      (N 
  
D#0 	
 	
 K KB<	
2 2r   r1   c                   T   a  ] tR t^t o RtR tR tR tR tR t	R t
R tR	 tR
tV tR# )rC   z0
Dictionary which uses normalized URIs as keys.
c                J    \         P                  ! V4      P                  4       # r   )rM   urlsplitgeturlr   r   s   &&r   	normalizeURIDict.normalize   s      %,,..r   c                \    \        4       V n        V P                  P                  ! V/ VB  R # r   )rI   rB   update)r   argskwargss   &*,r   r   URIDict.__init__   s"    V


4*6*r   c                F    V P                   V P                  V4      ,          # r   rB   r   r   s   &&r   __getitem__URIDict.__getitem__   s    zz$..-..r   c                @    W P                   V P                  V4      &   R # r   r   )r   r   values   &&&r   __setitem__URIDict.__setitem__   s    */

4>>#&'r   c                >    V P                   V P                  V4       R # r   r   r   s   &&r   __delitem__URIDict.__delitem__   s    JJt~~c*+r   c                ,    \        V P                  4      # r   )iterrB   r    s   &r   __iter__URIDict.__iter__       DJJr   c                ,    \        V P                  4      # r   )r[   rB   r    s   &r   __len__URIDict.__len__   s    4::r   c                ,    \        V P                  4      # r   )rx   rB   r    s   &r   r!   URIDict.__repr__   r   r   )rB   N)r   r)   r*   r+   r{   r   r   r   r   r   r   r   r!   r,   r-   r.   s   @r   rC   rC      s7     /+/0,    r   rC   c                   \         P                  ! V 4      P                  pVR9   dH   \        '       d<   \        P                  ! V 4      pVP                  4         VP                  ! R/ VB pV# \        V 4      ;_uu_ 4       p\        P                  ! VP                  4       P                  R4      3/ VB pRRR4       V#   \         d+    \        P                  ! R4       TP                  4       p T# i ; i  + '       g   i     X# ; i)z
Provides a callable which takes a URI, and returns the loaded JSON referred
to by that URI. Uses :mod:`requests` if available for HTTP URIs, and falls
back to :mod:`urllib`.
z7requests >=1.2 required for custom kwargs to json.loadszutf-8N)httphttpsr(   )rM   r   schemerequestsr=   raise_for_statusjsonrl   warningswarnr   loadsreaddecode)r   r   r   respr`   contents   &,    r   r@   r@      s     s#**F""xx||C  		!YY((F M S\\WZZ 5 5g >I&IF  M  	!MMSTYY[F M	!
 \ Ms   C 5C91C65C69D
	Fc                    T;'       g    / p\        V 4      pWC9   d	   W4,          # \        V 4      \        J d   V! V 4      pV'       d   TMT p WV&   \        V \        4      '       d7   V P                  4        F   w  rg\        WqW#R 7      pV'       g   K  WPV&   K"  	  V # \        V \        4      '       dF   \        V \        4      '       g0   \        V 4       F   w  r\        WqW#R 7      pV'       g   K  WPV&   K"  	  V # ))rj   
_processed)
idtyper1   r<   r   r\   
_walk_refsr   r$   	enumerate)	r8   funcrj   r   oidrra   rb   is	   &&&&     r   r   r     s    !!rJ
S'C
CyGIasO#wIIKDA1GKAwA   J 
C	"	":c3+?+?cNDA1GKAwA # Jr   r'   Tc                    \        V VVVVV\        4       RRR7	      pV'       g   \        VR RR7       V# V'       g   \        VR 4       V# )ax  
Returns a deep copy of `obj` with all contained JSON reference objects
replaced with :class:`JsonRef` instances.

:param obj: If this is a JSON reference object, a :class:`JsonRef`
    instance will be created. If `obj` is not a JSON reference object,
    a deep copy of it will be created with all contained JSON
    reference objects replaced by :class:`JsonRef` instances
:param base_uri: URI to resolve relative references against
:param loader: Callable that takes a URI and returns the parsed JSON
    (defaults to global ``jsonloader``, a :class:`JsonLoader` instance)
:param jsonschema: Flag to turn on `JSON Schema mode
    <http://json-schema.org/latest/json-schema-core.html#anchor25>`_.
    'id' or '$id' keyword changes the `base_uri` for references contained
    within the object
:param load_on_repr: If set to ``False``, :func:`repr` call on a
    :class:`JsonRef` object will not cause the reference to be loaded
    if it hasn't already. (defaults to ``True``)
:param merge_props: When ``True``, JSON reference objects that
    have extra keys other than '$ref' in them will be merged into the
    document resolved by the reference (if it is a dictionary.) NOTE: This
    is not part of the JSON Reference spec, and may not behave the same as
    other libraries.
:param proxies: If `True`, references will be replaced with transparent
    proxy objects. Otherwise, they will be replaced directly with the
    referred data. (defaults to ``True``)
:param lazy_load: When proxy objects are used, and this is `True`, the
    references will not be resolved until that section of the JSON
    document is accessed. (defaults to ``True``)

Fr   r3   r4   r5   rA   rB   r   rS   c                     V P                   # r   rT   r   s   &r   <lambda>replace_refs.<locals>.<lambda>Q      Q]]r   T)rj   c                     V P                   # r   r   r   s   &r   r   r   S  r   r   r(   )rX   rC   r   )	r8   r   r3   r4   r5   rA   proxies	lazy_loadr`   s	   &&&&&&&& r   r6   r6     sZ    R !i
F 62DA M 623Mr   c                |   \         P                  ! V4      w  rR p
V	'       g   V'       g   Tp
V'       do   \        V \        4      '       dY   V P	                  R4      ;'       g    V P	                  R4      p\        V\
        4      '       d   \         P                  ! W4      pTp
\        V \        4      '       d?   V P                  4        UUu/ uF!  w  rV\        VVVVVVVW|3,           RR7	      bK#  	  p ppMc\        V \        4      '       dN   \        V \
        4      '       g8   \        V 4       UUu. uF   w  r\        VVVVVVVW~3,           RR7	      NK"  	  p pp\        V \        4      '       d9   \        V P	                  R4      \
        4      '       d   \        V VVVVVVVR7      p V
e   WV
&   V # u uppi u uppi )Nz$idr   Tr   r;   )r   r3   r4   r5   rA   rE   rF   )rM   rU   r<   r   r=   r$   rN   r\   rX   r   r   r1   )r8   r   r3   r4   r5   rA   rB   r   rS   frag	store_uriid_ra   rb   r   s   &$$$$$$$$      r   rX   rX   W  s    ''1NHI		jg..ggen--c3''6H I #w 		
 $ }!%)'D[
 
 $ 	 
 
C	"	":c3+?+? "#
 ' !%)'D[
 ' 	 
  #wJswwv$D$D!%#	
 iJ_

s   'F21&F8c                    Vf   \         P                  ! \        3/ VB p\        \        P
                  ! V 3/ VB VVVVVVVR7      # )aB  
Drop in replacement for :func:`json.load`, where JSON references are
proxied to their referent data.

:param fp: File-like object containing JSON document
:param **kwargs: This function takes any of the keyword arguments from
    :func:`replace_refs`. Any other keyword arguments will be passed to
    :func:`json.load`

r   r3   r4   r5   rA   r   r   )	functoolspartialr@   r6   r   load)	fpr   r3   r4   r5   rA   r   r   r   s	   &&&&&&&&,r   r   r     sQ    , ~"":88		"!	 	r   c                    Vf   \         P                  ! \        3/ VB p\        \        P
                  ! V 3/ VB VVVVVVVR7      # )a9  
Drop in replacement for :func:`json.loads`, where JSON references are
proxied to their referent data.

:param s: String containing JSON document
:param **kwargs: This function takes any of the keyword arguments from
    :func:`replace_refs`. Any other keyword arguments will be passed to
    :func:`json.loads`

r   )r   r   r@   r6   r   r   )	sr   r3   r4   r5   rA   r   r   r   s	   &&&&&&&&,r   r   r     sQ    , ~"":88

1!	 	r   c                T    Vf   \         pVf   T p\        V! V 4      VVVVVVVR7      # )z
Load JSON data from ``uri`` with JSON references proxied to their referent
data.

:param uri: URI to fetch the JSON from
:param **kwargs: This function takes any of the keyword arguments from
    :func:`replace_refs`

r   )r@   r6   )r   r   r3   r4   r5   rA   r   r   s   &&&&&&&&r   load_urir     sB    ( ~s!	 	r   c                <    VP                  \        V 3/ VB 4       R# )aY  
Serialize `obj`, which may contain :class:`JsonRef` objects, as a JSON
formatted stream to file-like `fp`. `JsonRef` objects will be dumped as the
original reference object they were created from.

:param obj: Object to serialize
:param fp: File-like to output JSON string
:param kwargs: Keyword arguments are the same as to :func:`json.dump`

N)writedumps)r8   r   r   s   &&,r   dumpr     s     HHU3!&!"r   c                    \        VP                  R\        P                  4      4      VR&   \        P                  ! V 3/ VB # )a  
Serialize `obj`, which may contain :class:`JsonRef` objects, to a JSON
formatted string. `JsonRef` objects will be dumped as the original
reference object they were created from.

:param obj: Object to serialize
:param kwargs: Keyword arguments are the same as to :func:`json.dumps`

r7   )_ref_encoder_factoryr=   r   JSONEncoderr   )r8   r   s   &,r   r   r   !  s7     )E4;K;K)LMF5M::c$V$$r   c                 (   a a  ! VV 3R  lRS 4      oS# )c                   T   <a a ] tR tRt oVV V3R ltVV 3R ltVV 3R ltRtVtV ;t	# ),_ref_encoder_factory.<locals>.JSONRefEncoderi0  c                ^   < \        VR 4      '       d   VP                  # \        SS`  V4      # rz   )rZ   r?   superdefault)r   oJSONRefEncoderr   r7   s   &&r   r   4_ref_encoder_factory.<locals>.JSONRefEncoder.default1  s,    q/**&5a88r   c                h   < \        VR 4      '       d   VP                  p\        SV `  ! V.VO5/ VB # rz   )rZ   r?   r   _iterencoder   r   r   r   r   r   s   &&*,r   r   8_ref_encoder_factory.<locals>.JSONRefEncoder._iterencode7  s5    q/**OO:1NtNvNNr   c                h   < \        VR 4      '       d   VP                  p\        SV `  ! V.VO5/ VB # rz   )rZ   r?   r   _encoder   s   &&*,r   r   4_ref_encoder_factory.<locals>.JSONRefEncoder._encode=  s5    q/**OO6qJ4J6JJr   r(   )
r   r)   r*   r+   r   r   r   r,   r-   __classcell__)r   r/   r   r7   s   @@r   r   r   0  s     	9	O	K 	Kr   r   r(   )r7   r   s   f@r   r   r   /  s    K K K$ r   )FN)r'   NFTFTT)NNFTFTT)#r   r   r   collections.abcr   r   r   urllibr   rM   urllib.parser   urllib.requestr   r   callableResponseImportError
proxytypesr	   __version__rV   r   r1   rC   r@   r   r6   rX   r   r   r   r   r   r   r(   r   r   <module>r      s       = = $   "H%%**++ !!9 ! a2i a2H n  >62 8vHV"J"J"J# %A  Hs   %B, B, ,	B87B8