
    3j                    
   d Z ddlmZ ddlZddlmZ ddlmZ  G d dej                  e      Z	 G d d	ej                  ej                        Z G d
 dej                        Ze	efZedk(  rddlZ ej                   e       yy)a  
Editorial objects store comments and other metadata associated with specific
:class:`~music21.base.Music21Object` elements such as Notes.

Some aspects of :class:`~music21.editorial.Editorial` objects
represent very early (pre-v0.1) versions of music21.  Thus, some
pre-defined aspects might be removed from documentation in the future.

Access an editorial object by calling `.editorial` on any music21 object:

>>> c = clef.TrebleClef()
>>> ed = c.editorial
>>> ed
<music21.editorial.Editorial {}>

The object is lazily created on first access.
To see if there is any existing editorial information without creating
the object, call `.hasEditorialInformation`

>>> n = note.Note('C#4')
>>> n.hasEditorialInformation
False

>>> n.editorial.unedited = True
>>> n.hasEditorialInformation
True
    )annotationsN)prebase)stylec                  L    e Zd ZU dZddddddZded	<   d
ZdZd Zd Z	d Z
d Zy)	EditorialaI  
    Editorial comments and special effects that can be applied to music21 objects.

    >>> ed1 = editorial.Editorial()
    >>> ed1.backgroundHighlight = 'yellow'  # non-standard.
    >>> ed1.backgroundHighlight
    'yellow'
    >>> list(ed1.keys())
    ['backgroundHighlight']
    >>> ed1
     <music21.editorial.Editorial {'backgroundHighlight': 'yellow'}>

    Every GeneralNote object already has a NoteEditorial object attached to it
    at object.editorial.  Normally you will just change that object instead.

    For instance, take the case where a scribe wrote F in the score, knowing
    that a good singer would automatically sing F-sharp instead.  We can store
    the editorial suggestion to sing F-sharp as a "musica ficta" accidental
    object:

    >>> fictaSharp = pitch.Accidental('sharp')
    >>> n = note.Note('F')
    >>> n.editorial.ficta = fictaSharp
    >>> assert(n.editorial.ficta.alter == 1.0) #_DOCS_HIDE
    >>> #_DOCS_SHOW n.show('lily.png')  # only Lilypond currently supports musica ficta

    .. image:: images/noteEditorialFictaSharp.*
        :width: 103

    z
            a list of :class:`~music21.editorial.Comment` objects that represent any comments
            about the object.
            z
            a list of :class:`~music21.editorial.Comment` objects that represent annotations
            for the object.  These have specific meanings in MusicXML.
            za :class:`~music21.pitch.Accidental` object that specifies musica
            ficta for the note.  Will only be displayed in LilyPond and then only if
            there is no Accidental object on the note itselfzan :class:`~music21.interval.Interval` object that specifies
            the harmonic interval between this object and a single other object, or None
            (useful for storing information post analysis)zan :class:`~music21.interval.Interval` object that specifies
            the melodic interval to the next object in this Part/Voice/Stream, etc.)comments	footnotesfictaharmonicIntervalmelodicIntervalzdict[str, str]	_DOC_ATTR)r	   r   )r
   r   r   c                ,    t         j                  |       S N)dict__repr__selfs    >/DATA/.local/lib/python3.12/site-packages/music21/editorial.py_reprInternalzEditorial._reprInternald   s    }}T""    c                    || v r| |   S || j                   v r
g | |<   | |   S || j                  v r
d | |<   | |   S t        d|       )Nz%Editorial does not have an attribute )predefinedListspredefinedNonesAttributeErrorr   names     r   __getattr__zEditorial.__getattr__h   sh    4<:T)))DJ:T)))DJ: #H!OPPr   c                    || |<   y r    )r   r   values      r   __setattr__zEditorial.__setattr__t   s    T
r   c                .    || v r| |= y t        d|z         )NzNo such attribute: )r   r   s     r   __delattr__zEditorial.__delattr__w   s!    4<T
 !6!=>>r   N)__name__
__module____qualname____doc__r   __annotations__r   r   r   r   r!   r#   r   r   r   r   r   .   sQ    >@>W!I~ ( 0OFO#
Q?r   r   c                  *     e Zd ZdZd fd	Zd Z xZS )Commenta  
    A comment or footnote or something else attached to a note.

    >>> c = editorial.Comment('presented as C natural in the 1660 print.')
    >>> c
    <music21.editorial.Comment 'presented as C na...'>

    Note that the text is truncated in representation, but it is all there in `.text`:

    >>> c.text
    'presented as C natural in the 1660 print.'

    >>> c.isFootnote = True
    >>> c.levelInformation = 'musicological'

    >>> n = note.Note('C#4')
    >>> n.editorial.footnotes.append(c)
    >>> n.editorial.footnotes[0]
    <music21.editorial.Comment 'presented as C na...'>

    Comments have style information:

    >>> c.style.color = 'red'
    >>> c.style.color
    'red'
    c                Z    t         |           || _        d| _        d| _        d | _        y )NF)super__init__text
isFootnoteisReferencelevelInformation)r   r.   	__class__s     r   r-   zComment.__init__   s,    	  $r   c                    | j                   yt        | j                         dk  rt        | j                         S t        | j                   d d dz         S )N       z...)r.   lenreprr   s    r   r   zComment._reprInternal   sG    99tyy>B		?"		#2.//r   r   )r$   r%   r&   r'   r-   r   __classcell__)r2   s   @r   r*   r*      s    4%0r   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&   r@   r   r   r   r;   r;      s    %r   r;   __main__)r'   
__future__r   unittestmusic21r   r   ProtoM21Objectr   r   
StyleMixinr*   TestCaser;   
_DOC_ORDERr$   mainTestr   r   r   <module>rJ      s   6 #   M?&& M?b)0g$$e&6&6 )0\%8 % 

 z GT	 r   