§
    ƒØj
  ã                  ó�   — d dl mZ ddgZd dlZd dlZ ej        d¦  «        Zdd	„Zdd„Z	e
dk    rd dlZ ej        ¦   «          dS dS )é    )ÚannotationsÚwrapWeakrefÚunwrapWeakrefNÚ_TÚreferentÚreturnúweakref.ReferenceType | _Tc                óP   — 	 t          j        | ¦  «        S # t          $ r | cY S w xY w)až  
    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©r   s    ú�/Users/tedpeters/Documents/Projects/Claude Projects/Misc Tools/notename-sheets/.venv/lib/python3.11/site-packages/music21/common/weakrefTools.pyr   r      s=   € ð8ÝŒ{˜8Ñ$Ô$Ð$øõ
 ð ð ð Øˆˆˆðøøøs   ‚ –%¤%úweakref.ReferenceType | t.Anyút.Anyc                óN   — t          | t          j        ¦  «        r
 | ¦   «         S | S )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Ñ2Ô2ð Øˆx‰zŒzÐàˆó    Ú__main__)r   r   r   r	   )r   r   r   r   )Ú
__future__r   Ú__all__ÚtypingÚtr   ÚTypeVarr   r   r   Ú__name__Úmusic21ÚmainTest© r   r   ú<module>r       s¥   ðð #Ð "Ð "Ð "Ð "Ð "à˜/Ð
*€à Ð Ð Ð Ø €€€à€Q„Yˆt�_„_€ð#ð #ð #ð #ðLð ð ð ð2 ˆzÒÐØ€N€N€NØ€GÔÑÔÐÐÐð Ðr   