
    rh 
                        S SK Jr  SS/rS SKrS SKr\R                  " S5      rS	S jrS
S jr	\
S:X  a  S SKr\R                  " 5         gg)    )annotationswrapWeakrefunwrapWeakrefN_Tc                T     [         R                  " U 5      $ ! [         a    U s $ f = f)aN  
utility function that wraps objects as weakrefs but does not wrap
already wrapped objects; also prevents wrapping the unwrappable "None" type, etc.

>>> import weakref
>>> class Mock:
...     pass
>>> a1 = Mock()
>>> ref1 = common.wrapWeakref(a1)
>>> ref1
<weakref at 0x101f29ae8; to ...Mock' at 0x101e45358>
>>> ref2 = common.wrapWeakref(ref1)
>>> ref2
<weakref at 0x101f299af; to ...Mock' at 0x101e45358>
>>> ref3 = common.wrapWeakref(5)
>>> ref3
5

OMIT_FROM_DOCS

Note that the ...Mock was needed after Python 3.13.
When 3.13 is the lowest version, replace ... with the
actual output.
)weakrefref	TypeErrorreferents    U/home/james-whalen/.local/lib/python3.13/site-packages/music21/common/weakrefTools.pyr   r      s,    8{{8$$
  s    ''c                R    [        U [        R                  5      (       a  U " 5       $ U $ )a  
Utility function that gets an object that might be an object itself
or a weak reference to an object.  It returns obj() if it's a weakref.
and obj if it's not.

>>> class Mock:
...     pass
>>> a1 = Mock()
>>> a2 = Mock()
>>> a2.strong = a1
>>> a2.weak = common.wrapWeakref(a1)
>>> common.unwrapWeakref(a2.strong) is a1
True
>>> common.unwrapWeakref(a2.weak) is a1
True
>>> common.unwrapWeakref(a2.strong) is common.unwrapWeakref(a2.weak)
True
)
isinstancer   ReferenceTyper   s    r   r   r   =   s$    & (G1122z    __main__)r   r   returnzweakref.ReferenceType | _T)r   zweakref.ReferenceType | t.Anyr   zt.Any)
__future__r   __all__typingtr   TypeVarr   r   r   __name__music21mainTest r   r   <module>r      sP    #/
*  YYt_#L2 z r   