
    3j                        d Z ddlmZ ddlZddlmZ ddlmZ ddlmZ  G d de	ej                        Z G d	 d
ej                  e      Z G d dej                        Zedk(  rddlZ ej"                  e       yy)z
The `tie` module contains a single class, `Tie` that represents the visual and
conceptual idea of tied notes.  They can be start or stop ties.
    )annotationsN)exceptions21)SlottedObjectMixin)prebasec                      e Zd Zy)TieExceptionN)__name__
__module____qualname__     8/DATA/.local/lib/python3.12/site-packages/music21/tie.pyr   r      s    r   r   c                  J    e Zd ZU dZdZddddZded<   d	Zdd
Zd Z	d Z
d Zy)Tiea  
    An object added to Notes that are tied to other notes. The `type` value is one
    of start, stop, or continue.

    >>> note1 = note.Note()
    >>> note1.tie = tie.Tie('start')  # start, stop, or continue
    >>> note1.tie.style = 'normal'  # default; could also be 'dotted' or 'dashed' or 'hidden'
    >>> note1.tie.type
    'start'

    >>> note1.tie
    <music21.tie.Tie start>

    Generally Ties have a placement of None, but if they are defined
    as 'above' or 'below' this will be retained.  (see: `this discussion`_
    for how orientation and placement in musicxml are essentially the same
    content).

    .. _this discussion: https://web.archive.org/web/20210302051136/https://forums.makemusic.com/viewtopic.php?f=12&t=2179&start=0

    >>> note1.tie.placement is None
    True

    Differences from MusicXML:

    *  notes do not need to know if they are tied from a
       previous note.  i.e., you can tie n1 to n2 just with
       a tie start on n1.  However, if you want proper musicXML output
       you need a tie stop on n2.

    *  one tie with "continue" implies tied from and tied to.

    The tie.style only applies to Tie objects of type 'start' or 'continue' (and then
    only to the next part of the tie).  For instance, if there are two
    tied notes, and the first note has a 'dotted'-start tie, and the
    second note has a 'dashed'-stop tie, the graphical tie itself will be dotted.

    A type of tie that is unknown raises a ValueError:

    >>> tie.Tie('hello')
    Traceback (most recent call last):
    music21.tie.TieException: Type must be one of
    ('start', 'stop', 'continue', 'let-ring', 'continue-let-ring'), not hello

    OMIT_FROM_DOCS
       optional (to know what notes are next):
          .to = note()   # not implemented yet, b/c of garbage coll.
          .from = note()

    (question: should notes be able to be tied to multiple notes
    for the case where a single note is tied both voices of a
    two-note-head unison?)
    )id	placementstyletypezo
            The tie type, can be 'start', 'stop', 'continue', 'let-ring', or 'continue-let-ring'.
            zj
            The style of the tie.  Currently can be 'normal', 'dotted', 'dashed' or 'hidden'
            z
            Whether the tie should go up or down. Can be None, meaning
            it is unknown or should be determined from context, or 'above' or 'below.
            )r   r   r   zdict[str, str]	_DOC_ATTR)startstopcontinuezlet-ringzcontinue-let-ringc                    || j                   vrt        d| j                    d|       t        |       | _        || _        d| _        d | _        y )NzType must be one of z, not normal)VALID_TIE_TYPESr   r   r   r   r   )selfr   s     r   __init__zTie.__init__l   sX    t+++&t';';&<F4&IK K
 T(	
r   c                d    t        |t        |             sy| j                  |j                  k(  ryy)a  
        Equality. Based entirely on Tie.type.

        >>> t1 = tie.Tie('start')
        >>> t2 = tie.Tie('start')
        >>> t3 = tie.Tie('stop')
        >>> t1 == t2
        True

        >>> t2 == t3, t3 == t1
        (False, False)

        >>> t2 == None
        False
        FT)
isinstancer   )r   others     r   __eq__z
Tie.__eq__z   s+    " %d,YY%**$r   c                    t        |       dz	  S )N   )r   r   s    r   __hash__zTie.__hash__   s    $x1}r   c                    | j                   S )N)r   r$   s    r   _reprInternalzTie._reprInternal   s    yyr   N)r   )r	   r
   r   __doc__	__slots__r   __annotations__r   r   r!   r%   r'   r   r   r   r   r      sH    4lI!I~  UO.r   r   c                      e Zd Zd Zy)Testc                2    ddl m}  || t                      y )Nr   )testCopyAll)music21.test.commonTestr.   globals)r   r.   s     r   testCopyAndDeepcopyzTest.testCopyAndDeepcopy   s    7D')$r   N)r	   r
   r   r1   r   r   r   r,   r,      s    %r   r,   __main__)r(   
__future__r   unittestmusic21r   music21.common.objectsr   r   
ValueErrorMusic21Exceptionr   ProtoM21Objectr   TestCaser,   r	   mainTestr   r   r   <module>r<      s{    #    5 	:|<< 	
x'
 
 "4 xt%8 % zGT r   