
    i                     &    S SK Jr   " S S\5      rg)   )	NodeMixinc                   8   ^  \ rS rSrSrU 4S jrU 4S jrSrU =r$ )SymlinkNodeMixin   u  
The :any:`SymlinkNodeMixin` class extends any Python class to a symbolic link to a tree node.

The class **MUST** have a `target` attribute referring to another tree node.
The :any:`SymlinkNodeMixin` class has its own parent and its own child nodes.
All other attribute accesses are just forwarded to the target node.
A minimal implementation looks like (see :any:`SymlinkNode` for a full implementation):

>>> from anytree import SymlinkNodeMixin, Node, RenderTree
>>> class SymlinkNode(SymlinkNodeMixin):
...     def __init__(self, target, parent=None, children=None):
...         self.target = target
...         self.parent = parent
...         if children:
...             self.children = children
...     def __repr__(self):
...         return "SymlinkNode(%r)" % (self.target)

>>> root = Node("root")
>>> s1 = Node("sub1", parent=root)
>>> l = SymlinkNode(s1, parent=root)
>>> l0 = Node("l0", parent=l)
>>> print(RenderTree(root))
Node('/root')
├── Node('/root/sub1')
└── SymlinkNode(Node('/root/sub1'))
    └── Node('/root/sub1/l0')

Any modifications on the target node are also available on the linked node and vice-versa:

>>> s1.foo = 4
>>> s1.foo
4
>>> l.foo
4
>>> l.foo = 9
>>> s1.foo
9
>>> l.foo
9
c                 |   > US;   a  [         TU ]  U5      $ US:X  a  [        U5      e[        U R                  U5      $ )N)_NodeMixin__parent_NodeMixin__children__setstate__)super__getattr__AttributeErrorgetattrtarget)selfname	__class__s     J/app/mltbenv/lib/python3.13/site-packages/anytree/node/symlinknodemixin.pyr   SymlinkNodeMixin.__getattr__/   s@    AA7&t,,>! &&t{{D))    c                 ^   > US;   a  [         TU ]  X5        g [        U R                  X5        g )N)r   r	   parentchildrenr   )r   __setattr__setattrr   )r   r   valuer   s      r   r   SymlinkNodeMixin.__setattr__6   s'    aaG,DKK-r    )	__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes____classcell__)r   s   @r   r   r      s    (T*. .r   r   N)	nodemixinr   r   r   r   r   <module>r&      s     6.y 6.r   