+
    O(in3                     F   R t ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RI
Ht ^ R	I
Ht ^ R
IHt ^ RIHt ^ RIHt ^ RIHt ]! R]RR7      t]! RRR7      t]! R4      t]! R]RR7      t]! RRR7      t]! R]RR7      t]! RRR7      t ! R R]]]]3,          4      t ! R R]]	]]3,          4      t ! R R]]]]3,          ],          ]]3,          ]]]3,          4      t ! R R]]]3,          ]]]3,          4      t  ! R  R!] ]]3,          4      t!R# )"zPathable accessors moduleN)OrderedDict)Hashable)Mapping)Sequence)Path)Any)Generic)TypeVar)Subscriptable)	LookupKey)
LookupNode)LookupValueKT)boundcontravariantV)	covariantNSKSVCSKCSVc                   v  a  ] tR t^t o RtV 3R lR lt]V 3R lR l4       tV 3R lR ltV 3R lR	 lt	V 3R
 lR lt
V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR lt]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R  lR! l4       tR"tV tR## )$NodeAccessorzNode accessor.c                    < V ^8  d   QhRS[ /#    noder   )format__classdict__s   "X/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/pathable/accessors.py__annotate__NodeAccessor.__annotate__   s      Q     c                    Wn         R # N_node)selfr   s   &&r!   __init__NodeAccessor.__init__   s    
r$   c                    < V ^8  d   QhRS[ /# )r   returnr   )r   r    s   "r!   r"   r#   "   s      a r$   c                    V P                   # r&   r'   r)   s   &r!   r   NodeAccessor.node!   s    zzr$   c                6   < V ^8  d   QhRS[ S[,          RS[/# r   partsr-   )r   r   r   )r   r    s   "r!   r"   r#   %   s     0 0! 0 0r$   c                :    V P                  V P                  V4      # r&   )	_get_noder   r)   r3   s   &&r!   __getitem__NodeAccessor.__getitem__%   s    ~~dii//r$   c                &   < V ^8  d   QhRS[ RS[/# )r   otherr-   )objectr   )r   r    s   "r!   r"   r#   (   s     ' 'F 's 'r$   c                l    \        V\        4      '       g   \        # V P                  VP                  8H  # r&   )
isinstancer   NotImplementedr   )r)   r:   s   &&r!   __eq__NodeAccessor.__eq__(   s(    %..!!yyEJJ&&r$   c                Z   < V ^8  d   QhRS[ S[,          RS[S[S[3,          R,          /# r   r3   r-   N)r   r   dictstrr   )r   r    s   "r!   r"   r#   -   s,     " "(1+ "$sCx.4*? "r$   c                    \         hr&   NotImplementedErrorr6   s   &&r!   statNodeAccessor.stat-       !!r$   c                F   < V ^8  d   QhRS[ S[,          RS[ S[,          /# r2   r   r   )r   r    s   "r!   r"   r#   0   s#     " "(1+ "(1+ "r$   c                    \         h)zReturn the keys of the node at `parts` if it is traversable, or raise `KeyError` if not.

This performs a segment-by-segment traversal and raises `KeyError` with the failing segment if any part is missing or non-traversable.
rF   r6   s   &&r!   keysNodeAccessor.keys0   s
    
 "!r$   c                6   < V ^8  d   QhRS[ S[,          RS[/# r2   r   r   bool)r   r    s   "r!   r"   r#   7   s        HQK  D  r$   c                r    W,          p T P                  T4      #   \          d     R# \         d;     T P                  T4       M#  \         \        \        \        3 d      R# i ; i R# i ; i  \         d;     T P                  T4       M#  \         \        \        \        3 d      R# i ; i R# i ; i)a  Return True if the node at `parts` can enumerate child keys.

This is intended for control-flow ("can I call keys()/len()/iterate?")
and must not raise for missing or non-traversable paths, but may raise
OSError for permission or I/O errors.

The default implementation attempts a cheap node inspection via
`_is_traversable_node` after traversing to the node. If that is not
implemented, it falls back to calling `keys()`.

Note: the fallback may be expensive for accessors where `keys()`
enumerates large containers.
FT)KeyErrorrG   rN   
IndexError	TypeError_is_traversable_noder)   r3   r   s   && r!   is_traversableNodeAccessor.is_traversable7   s    		;D	,,T22  	" 			% j)5HI 	 # 			% j)5HI 	sq    A1 A.A.A.AA.A'"A.&A''A.-A.1B6=BB6B/*B6.B//B65B6c                <   < V ^8  d   QhRS[ S[,          RS[RS[/# r   r3   keyr-   rQ   )r   r    s   "r!   r"   r#   Y   s&      hqk  d r$   c                    W,          p V P                  W24       R#   \        \        \        3 d     R# i ; i  \         d     R# \         d6     Y P                  T4      9   u #   \        \        \        3 d      R# i ; ii ; i)a  Return True if `key` is a valid child of the node at `parts`.

The default implementation tries to validate membership by traversing
a single step (fast for accessors that implement `_get_subnode`). If
traversal isn't available, it falls back to `keys()` for compatibility
with accessors that only define enumeration.

This method is intended to be used for membership checks (e.g. `key in
path`) where errors should not be raised.
FT)_get_subnoderT   rU   rV   rG   rN   )r)   r3   r]   parents   &&& r!   containsNodeAccessor.containsY   s    	[F!!&.  j)4   	" 	ii...j)4 	sM   ;  8; 8; B	BBA)&B)B?BBBc                :   < V ^8  d   QhRS[ S[,          RS[RR/# r   r3   r]   r-   NrL   )r   r    s   "r!   r"   r#   s   s&     $ $8A; $Q $4 $r$   c                     W,          p V P                  W24       R#   \         d   p\        T4      ThRp?ii ; i  \         d'    T P                  T4      pY%9  d   \        T4      h R# i ; i)zgAssert that `key` is a valid child of the node at `parts`.

Raises `KeyError` with stable diagnostics.
N)r_   rT   rG   rN   )r)   r3   r]   r`   excrN   s   &&&   r!   require_childNodeAccessor.require_childs   sr    
	$ [F-!!&. -sm,-" 	$99U#Dsm# 	$s#   =  :5:= -A.-A.c                6   < V ^8  d   QhRS[ S[,          RS[/# r2   )r   r   int)r   r    s   "r!   r"   r#      s     " "! " "r$   c                    \         hr&   rF   r6   s   &&r!   lenNodeAccessor.len   rJ   r$   c                6   < V ^8  d   QhRS[ S[,          RS[/# r2   )r   r   r   )r   r    s   "r!   r"   r#      s     % %(1+ %! %r$   c                4    W,          pV P                  V4      # r&   
_read_noderX   s   && r!   readNodeAccessor.read       {t$$r$   c                4   < V ^8  d   QhRS[ S[,          RR/# rB   rL   )r   r    s   "r!   r"   r#      s      hqk d r$   c                    W,           R# )zValidate that the node at `parts` exists.

This performs a traversal only and raises `KeyError` (with the failing
part when available) if the path is missing or non-traversable.
N r6   s   &&r!   validateNodeAccessor.validate   s     	r$   c                &   < V ^8  d   QhRS[ RS[/# r   r   r-   )r   rR   )r   r    s   "r!   r"   r#      s     " " "d "r$   c                    \         hr&   rF   clsr   s   &&r!   rW   !NodeAccessor._is_traversable_node       !!r$   c                <   < V ^8  d   QhRS[ RS[S[,          RS[ /# )r   r   r3   r-   )r   r   r   )r   r    s   "r!   r"   r#      s&      Q x{ q r$   c                D    TpV P                   pV F  pV! W54      pK  	  V# r&   )r_   )r~   r   r3   currentget_subnodeparts   &&&   r!   r5   NodeAccessor._get_node   s+    &&D!'0G r$   c                &   < V ^8  d   QhRS[ RS[/# r{   )r   r   )r   r    s   "r!   r"   r#      s     " "a "A "r$   c                    \         hr&   rF   r}   s   &&r!   rq   NodeAccessor._read_node   r   r$   c                ,   < V ^8  d   QhRS[ RS[RS[ /# r   r   r   r-   )r   r   )r   r    s   "r!   r"   r#      s"     " " " "q "r$   c                    \         hr&   rF   )r~   r   r   s   &&&r!   r_   NodeAccessor._get_subnode   r   r$   r'   N)__name__
__module____qualname____firstlineno____doc__r*   propertyr   r7   r?   rH   rN   rY   ra   rg   rl   rr   rx   classmethodrW   r5   rq   r_   __static_attributes____classdictcell__r    s   @r!   r   r      s        0 0' '
" "" "   D 4$ $&" "% %  " "   " " " "r$   r   c                      a  ] tR t^t o V 3R lR ltV 3R lR lt]V 3R lR l4       tV 3R lR ltV 3R	 lR
 lt	V 3R lR lt
V 3R lR lt]V 3R lR l4       t]V 3R lR l4       tRtV tR# )PathAccessorc                Z   < V ^8  d   QhRS[ S[,          RS[S[S[3,          R,          /# rB   )r   rD   rC   r   )r   r    s   "r!   r"   PathAccessor.__annotate__   s,     

 

(3- 

DcNT,A 

r$   c                   V P                   P                  ! V!  p VP                  R R7      p\	        T4       Uu/ uF(  pTP                  R4      '       g   K  T\        Y44      bK*  	  up#   \         d     R# i ; iu upi )F)follow_symlinksNst_)r   joinpathrH   OSErrordir
startswithgetattr)r)   r3   subpathrH   r]   s   &&   r!   rH   PathAccessor.stat   s    ))$$e,	<<<6D
 4y
 ~~e$ $C## 
 	
  		
s   A, A>A>,A;:A;c                F   < V ^8  d   QhRS[ S[,          RS[ S[,          /# r2   r   rD   )r   r    s   "r!   r"   r      s#     	$ 	$(3- 	$HSM 	$r$   c                    W,          p VP                  4        Uu. uF  q3P                  NK  	  up# u upi   \        \        3 d(   pT'       d   \	        TR,          4      Th\        ThRp?ii ; i   N)iterdirnameFileNotFoundErrorNotADirectoryErrorrT   )r)   r3   r   pathrf   s   &&   r!   rN   PathAccessor.keys   se     +	$*1//*;<*;$II*;<<<!#56 	$uRy)s2#	$s!   8 38 8 A0	"A++A0c                &   < V ^8  d   QhRS[ RS[/# r{   )r   rR   )r   r    s   "r!   r"   r      s        r$   c                     \         P                  ! VP                  4       P                  4      #   \         d     R # i ; iF)rH   S_ISDIRlstatst_moder   r}   s   &&r!   rW   !PathAccessor._is_traversable_node   s4    	<<

 4 455 		s   -0 ??c                <   < V ^8  d   QhRS[ S[,          RS[RS[/# r\   )r   rD   rR   )r   r    s   "r!   r"   r      s&     ( (hsm (# ($ (r$   c                d     W,          pY2,          P                  4       #   \          d     R # i ; ir   )rT   exists)r)   r3   r]   r   s   &&& r!   ra   PathAccessor.contains   s5    	kG %%''  		s     //c                :   < V ^8  d   QhRS[ S[,          RS[RR/# rd   r   )r   r    s   "r!   r"   r      s&        8C=  s  t  r$   c                    W,          pVP                  4       '       g!   V'       d   \        VR,          4      h\        hW2,          pVP                  4       '       g   \        V4      hR# r   )is_dirrT   r   )r)   r3   r]   r   childs   &&&  r!   rg   PathAccessor.require_child   sN    +~~uRy))N||~~3- r$   c                6   < V ^8  d   QhRS[ S[,          RS[/# r2   )r   rD   rj   )r   r    s   "r!   r"   r      s     	$ 	$# 	$3 	$r$   c                    W,          p \        R  VP                  4        4       4      #   \        \        3 d(   pT'       d   \	        TR,          4      Th\        ThRp?ii ; i)c              3   &   "   T F  p^x  K	  	  R# 5i)r   Nrw   ).0_s   & r!   	<genexpr>#PathAccessor.len.<locals>.<genexpr>   s     4"3Qq"3s   Nr   )sumr   r   r   rT   )r)   r3   r   rf   s   &&  r!   rl   PathAccessor.len   sZ     +	$4'//"3444!#56 	$uRy)s2#	$s   * A""AA"c                6   < V ^8  d   QhRS[ S[,          RS[/# r2   )r   rD   bytes)r   r    s   "r!   r"   r      s     % %(3- %E %r$   c                4    W,          pV P                  V4      # r&   rp   rX   s   && r!   rr   PathAccessor.read   rt   r$   c                &   < V ^8  d   QhRS[ RS[/# r{   )r   r   )r   r    s   "r!   r"   r      s     ! !d !u !r$   c                "    VP                  4       # r&   )
read_bytesr}   s   &&r!   rq   PathAccessor._read_node   s      r$   c                ,   < V ^8  d   QhRS[ RS[RS[ /# r   )r   rD   )r   r    s   "r!   r"   r      s"       C D r$   c                X    W,          pVP                  4       '       g   \        V4      hV# r&   )r   rT   )r~   r   r   subnodes   &&& r!   r_   PathAccessor._get_subnode   s%    +~~4. r$   rw   N)r   r   r   r   rH   rN   r   rW   ra   rg   rl   rr   rq   r_   r   r   r   s   @r!   r   r      s}     

 

	$ 	$  ( (   	$ 	$% % ! !  r$   r   c                   @   a  ] tR t^t o Rt]V 3R lR l4       tRtV tR# )SubscriptableAccessorz#Accessor for subscriptable content.c                x   < V ^8  d   QhRS[ S[S[3,          S[,          RS[RS[ S[S[3,          S[,          /# r   )r
   r   r   )r   r    s   "r!   r"   "SubscriptableAccessor.__annotate__   sA     * * R(2-*57*	r2v		#*r$   c                    \        V\        4      '       g   \        V4      h W,          #   \        \        \        3 d   p\        T4      ThR p?ii ; ir&   )r=   r
   rT   rU   rV   )r~   r   r   rf   s   &&& r!   r_   "SubscriptableAccessor._get_subnode   sK     $..4. 	*:*i0 	*4.c)	*s   + AAArw   N)	r   r   r   r   r   r   r_   r   r   r   s   @r!   r   r      s      .* *r$   r   c                      a a ] tR tRt oV3R lV 3R lltV3R lR ltV3R lR ltR^/V3R	 lR
 lltV3R lR ltRt	Vt
V ;t# )CachedSubscriptableAccessori	  c                F   < V ^8  d   QhRS[ S[S[3,          S[,          /# r   )r
   r   r   )r   r    s   "r!   r"   (CachedSubscriptableAccessor.__annotate__  s%     G G]384s: Gr$   c                `   < \         SV `  V4       R V n        ^V n        \	        4       V n        R# )TN)superr*   _cache_enabled_cache_maxsizer   _cache)r)   r   	__class__s   &&r!   r*   $CachedSubscriptableAccessor.__init__  s+     #*-9Dr$   c                   < V ^8  d   QhRR/# r   r-   Nrw   )r   r    s   "r!   r"   r     s      T r$   c                :    V P                   P                  4        R# )z2Clear any cached reads for this accessor instance.N)r   clearr/   s   &r!   clear_cache'CachedSubscriptableAccessor.clear_cache  s    r$   c                   < V ^8  d   QhRR/# r   rw   )r   r    s   "r!   r"   r     s      t r$   c                H    RV n         V P                  P                  4        R# )z+Disable caching for this accessor instance.FN)r   r   r   r/   s   &r!   disable_cache)CachedSubscriptableAccessor.disable_cache  s    #r$   maxsizec                2   < V ^8  d   QhRS[ R,          RR/# )r   r   Nr-   )rj   )r   r    s   "r!   r"   r     s      sTz D r$   c               T    RV n         Wn        V P                  P                  4        R# )zEnable caching for this accessor instance.

Args:
    maxsize: Maximum number of distinct paths to cache.
        - 128 by default (matches functools.lru_cache)
        - None for unbounded
        - 0 to disable caching
TN)r   r   r   r   )r)   r   s   &$r!   enable_cache(CachedSubscriptableAccessor.enable_cache  s"     #%r$   c                6   < V ^8  d   QhRS[ S[,          RS[/# r2   )r   r   r   )r   r    s   "r!   r"   r   +  s      (3- C r$   c                   \        V4      pV P                  '       d   V P                  ^ 8X  d   W,          pV P                  V4      #  V P                  V,          pV P                  P                  V4       V#   \         d+    Y,          pT P                  T4      pY@P                  T&    Mi ; iT P                  eC   \        T P                  4      T P                  8  d   T P                  P                  RR7       KB  T# )    F)last)	tupler   r   rq   r   move_to_endrT   rl   popitem)r)   r3   r]   r   values   &&   r!   rr    CachedSubscriptableAccessor.read+  s    El###(;(;q(@;D??4((		KK$E KK##C(L  	%;DOOD)E$KK	% *dkk"T%8%88###/s   	A9 92B.-B.)r   r   r   )r   r   r   r   r*   r   r   r   rr   r   r   __classcell__)r   r    s   @@r!   r   r   	  sE     G G  
C    r$   r   c                      a  ] tR tRt o ]V 3R lR l4       tV 3R lR ltV 3R lR ltV 3R lR	 ltV 3R
 lR lt	V 3R lR lt
]V 3R lR l4       tRtV tR# )LookupAccessoriD  c                &   < V ^8  d   QhRS[ RS[/# r{   )r   rR   )r   r    s   "r!   r"   LookupAccessor.__annotate__G  s     0 0
 0t 0r$   c                8    \        V\        \        ,          4      # r&   )r=   r   listr}   s   &&r!   rW   #LookupAccessor._is_traversable_nodeF  s    $$//r$   c                Z   < V ^8  d   QhRS[ S[,          RS[S[S[3,          R,          /# rB   )r   r   rC   rD   r   )r   r    s   "r!   r"   r  J  s-     
 
(9- 
$sCx.42G 
r$   c                
    W,          pT;\        Rc ;e   w   M ;\        Rc ;e   w   M  M \        T4      pM  \        T4      pR\        T4      P                  RT/#   \          d     R # i ; i  \         d    R p L:i ; i)Nrw   typelength)rT   r   r  rl   rV   r
  r   )r)   r3   r   r  s   &&  r!   rH   LookupAccessor.statJ  s    	;D
 VTVV#T" YF
 DJ''f
 	
  		 ! "!F"s"   A  A2  A/.A/2BBc                <   < V ^8  d   QhRS[ S[,          RS[RS[/# r\   )r   r   rR   )r   r    s   "r!   r"   r  _  s'      hy1 	 d r$   c                     W,          pT;\        Rc ;e   w    Y#9   #  ;\        Rc ;e;   w   p\        T\        4      ;'       d     ^ Tu;8*  ;'       d    \        T4      8  # u #    R #   \          d     R # i ; i)Frw   )rT   r   r  r=   rj   rl   r)   r3   r]   r   itemss   &&&  r!   ra   LookupAccessor.contains_  s{    	;D {"  !#s+EES0E0E3u:0EE0EE !  		s   A* *A98A9c                :   < V ^8  d   QhRS[ S[,          RS[RR/# rd   r   r   )r   r    s   "r!   r"   r  m  s*     $ $i($/8$	$r$   c                   W,          pT;\         R c ;e   w    W#9  d   \        V4      hR#  ;\        R c ;eA   w   p\        V\        4      '       d   ^ Tu;8:  d   \        V4      8  g   M \        V4      hR#    \        V4      h)rw   N)r   rT   r  r=   rj   rl   r  s   &&&  r!   rg   LookupAccessor.require_childm  su     {?"3-'  !"3,,c1FCJ1F"3-' ! sm#r$   c                F   < V ^8  d   QhRS[ S[,          RS[ S[,          /# r2   r  )r   r    s   "r!   r"   r    s%     
 
(9- 
(92E 
r$   c                   W,          pT;\         R c ;e   w    \        VP                  4       4      #  ;\        R c ;e!   w   p\        \        \	        V4      4      4      #   V'       d   \        VR,          4      h\
        h)rw   r   )r   r  rN   rangerl   rT   )r)   r3   r   r  s   &&  r!   rN   LookupAccessor.keys  sd    {DIIK((  E#e*-.. ! 59%%r$   c                6   < V ^8  d   QhRS[ S[,          RS[/# r2   )r   r   rj   )r   r    s   "r!   r"   r    s       ),  r$   c                    W,          pV P                  V4      '       d   \        V4      # V'       d   \        VR,          4      h\        h)r   r   )rW   rl   rT   rX   s   && r!   rl   LookupAccessor.len  s;    {$$T**t959%%r$   c                &   < V ^8  d   QhRS[ RS[/# r{   )r   r   )r   r    s   "r!   r"   r    s      j [ r$   c                    V# r&   rw   r}   s   &&r!   rq   LookupAccessor._read_node  s    r$   rw   N)r   r   r   r   r   rW   rH   ra   rg   rN   rl   rq   r   r   r   s   @r!   r  r  D  s]     0 0
 
* $ $$
 
   r$   r  )"r   rH   collectionsr   collections.abcr   r   r   pathlibr   typingr   r   r	   pathable.protocolsr
   pathable.typesr   r   r   r   r   r   r   r   r   r   r   rD   r   r   r   r   r  rw   r$   r!   <module>r&     s'     # $ # $     , $ % &Cxt4C4 CLT6TT"e848et$L"71a7# L"^K<c5 01 K\*r2v&+R34gb"fo*"8#s(#WS#X%68vS0K1GH Sr$   