§
    ƒØj’3  ã                  ó|  — 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 ddlmZ ddlm	Z	  ej
        d	¦  «        Z G d
„ dej        ¦  «        Zg d¢ZdddœZdddœZh d£Zd„ Zd„ Z G d„ d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¦  «         dS dS )z7
Object models of barlines, including repeat barlines.
é    )ÚannotationsN)Úbase)Úenvironment)Úexceptions21)Úexpressions)ÚrepeatÚbarc                  ó   — e Zd ZdS )ÚBarExceptionN)Ú__name__Ú
__module__Ú__qualname__© ó    ú€/Users/tedpeters/Documents/Projects/Claude Projects/Misc Tools/notename-sheets/.venv/lib/python3.11/site-packages/music21/bar.pyr   r      s   € € € € € Ø€Dr   r   )ÚregularÚdottedÚdashedÚheavyÚdoubleÚfinalúheavy-lightúheavy-heavyÚtickÚshortÚnoner   r   )úlight-lightúlight-heavyr   r   )r   r   >   r   r   r   r   r   c                óz   — |                       ¦   «         t          v rt          |                       ¦   «                  S | S )a¦  
    Convert a music21 barline name into the musicxml name --
    essentially just changes the names of 'double' and 'final'
    to 'light-light' and 'light-heavy'

    Does not do error checking to make sure it's a valid name,
    since setting the style on a Barline object already does that.

    >>> bar.typeToMusicXMLBarStyle('final')
    'light-heavy'
    >>> bar.typeToMusicXMLBarStyle('regular')
    'regular'
    )ÚlowerÚreverseBarTypeDict©Úvalues    r   ÚtypeToMusicXMLBarStyler$   4   s0   € ð ‡{‚{�}„}Õ*Ð*Ð*Ý! %§+¢+¡-¤-Ô0Ð0àˆr   c                ó˜   — | €dS |                       ¦   «         } | t          v r| S | t          v rt          |          S t          d| › �¦  «        ‚)zÈ
    Standardizes bar type names.

    converts all names to lower case, None to 'regular',
    and 'light-light' to 'double' and 'light-heavy' to 'final',
    raises an error for unknown styles.
    Nr   zcannot process style: )r    ÚbarTypeListÚbarTypeDictr   r"   s    r   ÚstandardizeBarTyper(   G   sZ   € ð €}Øˆyà�KŠK‰MŒM€Eà•ÐÐØˆØ	•+Ð	Ð	Ý˜5Ô!Ð!õ Ð;°EÐ;Ð;Ñ<Ô<Ð<r   c                  óž   ‡ — e Zd ZdZ ee                     ¦   «         ¦  «        ZdZdZ		 	 dˆ fd„	Z
d„ Zd„ Zd„ Z eeed	¬
¦  «        Zd„ Zˆ xZS )ÚBarlineaý  
    A representation of a barline.
    Barlines are conventionally assigned to Measure objects
    using the leftBarline and rightBarline attributes.

    >>> bl = bar.Barline('double')
    >>> bl
    <music21.bar.Barline type=double>

    The type can also just be set via a keyword of "type".  Or if no type is specified,
    a regular barline is returned.  Location can also be explicitly stored, but it's not
    needed except for musicxml translation:

    >>> bl2 = bar.Barline(type='dashed')
    >>> bl2
    <music21.bar.Barline type=dashed>
    >>> bl3 = bar.Barline()
    >>> bl3
    <music21.bar.Barline type=regular>
    >>> bl4 = bar.Barline(type='final', location='right')
    >>> bl4
    <music21.bar.Barline type=final>
    >>> bl4.type
    'final'

    Note that the barline type 'ticked' only is displayed correctly in Finale and Finale Notepad.

    N.B. for backwards compatibility reasons, currently
    Bar objects do not use the style.Style class since
    the phrase "style" was already used.
    éûÿÿÿ)ÚtypeÚpauseÚlocationNc                ór   •—  t          ¦   «         j        di |¤Ž d | _        || _        d | _        || _        d S )Nr   )ÚsuperÚ__init__Ú_typer,   r-   r.   )Úselfr,   r.   ÚkeywordsÚ	__class__s       €r   r1   zBarline.__init__„   sF   ø€ ð 	�‰ŒÔÐ$Ð$˜8Ð$Ð$Ð$àˆŒ
àˆŒ	ð ˆŒ
ð !ˆŒˆˆr   c                ó   — d| j         › �S )Nztype=)r,   ©r3   s    r   Ú_reprInternalzBarline._reprInternal•   s   € Ø"�t”yÐ"Ð"Ð"r   c                ó   — | j         S ©N)r2   r7   s    r   Ú_getTypezBarline._getType™   s
   € ØŒzÐr   c                ó.   — t          |¦  «        | _        d S r:   )r(   r2   ©r3   r#   s     r   Ú_setTypezBarline._setTypeœ   s   € Ý'¨Ñ.Ô.ˆŒ
ˆ
ˆ
r   a+  
        Get and set the Barline type property.

        >>> b = bar.Barline()
        >>> b.type = 'tick'
        >>> b.type
        'tick'

        Synonyms are given for some types, based on
        musicxml styles:

        >>> b.type = 'light-light'
        >>> b.type
        'double'
        )Údocc                ó*   — t          | j        ¦  «        S )aº  
        returns the musicxml style for the bar.  most are the same as
        `.type` but "double" and "final" are different.

        >>> b = bar.Barline('tick')
        >>> b.musicXMLBarStyle()
        'tick'

        >>> b.type = 'double'
        >>> b.musicXMLBarStyle()
        'light-light'

        >>> b.type = 'final'
        >>> b.musicXMLBarStyle()
        'light-heavy'

        * Changed in v5.7: was a property before.
        )r$   r,   r7   s    r   ÚmusicXMLBarStylezBarline.musicXMLBarStyle°   s   € õ& & d¤iÑ0Ô0Ð0r   )NN)r   r   r   Ú__doc__Úlistr'   ÚkeysÚvalidStylesÚclassSortOrderÚequalityAttributesr1   r8   r;   r>   Úpropertyr,   rA   Ú__classcell__)r5   s   @r   r*   r*   ^   sÔ   ø€ € € € € ðð ð> �$�{×'Ò'Ñ)Ô)Ñ*Ô*€Kà€Nà6Ðð Øð!ð !ð !ð !ð !ð !ð"#ð #ð #ðð ð ð/ð /ð /ð ˆ8�H˜hððñ ô €Dð"1ð 1ð 1ð 1ð 1ð 1ð 1r   r*   c                  óž   — e Zd ZdZddd„Zd	„ Zedd„¦   «         Zej        dd„¦   «         Zedd„¦   «         Z	e	j        dd„¦   «         Z	dd„Z
dS )ÚRepeata±  
    A Repeat barline.

    The `direction` parameter can be one of `start` or `end`.
    An `end` followed by a `start`
    should be encoded as two `bar.Repeat` signs.

    >>> rep = bar.Repeat(direction='end', times=3)
    >>> rep
    <music21.bar.Repeat direction=end times=3>

    To apply a repeat barline assign it to either the `.leftBarline` or
    `.rightBarline` attribute
    of a measure.

    >>> m = stream.Measure()
    >>> m.leftBarline = bar.Repeat(direction='start')
    >>> m.rightBarline = bar.Repeat(direction='end')
    >>> m.insert(0.0, meter.TimeSignature('4/4'))
    >>> m.repeatAppend(note.Note('D--5'), 4)
    >>> p = stream.Part()
    >>> p.insert(0.0, m)
    >>> p.show('text')
    {0.0} <music21.stream.Measure 0 offset=0.0>
        {0.0} <music21.bar.Repeat direction=start>
        {0.0} <music21.meter.TimeSignature 4/4>
        {0.0} <music21.note.Note D-->
        {1.0} <music21.note.Note D-->
        {2.0} <music21.note.Note D-->
        {3.0} <music21.note.Note D-->
        {4.0} <music21.bar.Repeat direction=end>

    The method :meth:`~music21.stream.Part.expandRepeats` on a
    :class:`~music21.stream.Part` object expands the repeats, but
    does not update measure numbers

    >>> q = p.expandRepeats()
    >>> q.show('text')
    {0.0} <music21.stream.Measure 0 offset=0.0>
        {0.0} <music21.bar.Barline type=double>
        {0.0} <music21.meter.TimeSignature 4/4>
        {0.0} <music21.note.Note D-->
        {1.0} <music21.note.Note D-->
        {2.0} <music21.note.Note D-->
        {3.0} <music21.note.Note D-->
        {4.0} <music21.bar.Barline type=double>
    {4.0} <music21.stream.Measure 0a offset=4.0>
        {0.0} <music21.bar.Barline type=double>
        {0.0} <music21.meter.TimeSignature 4/4>
        {0.0} <music21.note.Note D-->
        {1.0} <music21.note.Note D-->
        {2.0} <music21.note.Note D-->
        {3.0} <music21.note.Note D-->
        {4.0} <music21.bar.Barline type=double>
    ÚstartNÚ	directionÚstrÚtimesú
int | Nonec                óº   — t           j                             | ¦  «         |dk    rd}nd}t          j        | fd|i|¤Ž d | _        d | _        || _        || _        d S )NrL   r   r   r,   )r   Ú
RepeatMarkr1   r*   Ú
_directionÚ_timesrM   rO   )r3   rM   rO   r4   ÚbarTypes        r   r1   zRepeat.__init__  sp   € ÝÔ×"Ò" 4Ñ(Ô(Ð(Ø˜ÒÐØ#ˆGˆGàˆGÝÔ˜Ð8Ð8 GÐ8¨xÐ8Ð8Ð8à$(ˆŒØ $ˆŒð #ˆŒØˆŒ
ˆ
ˆ
r   c                óB   — d| j         › �}| j        �|d| j        › �z  }|S )Nz
direction=z times=)rM   rO   )r3   Úmsgs     r   r8   zRepeat._reprInternal  s3   € Ø+˜4œ>Ð+Ð+ˆØŒ:Ð!ØÐ)˜TœZÐ)Ð)Ñ)ˆCØˆ
r   Úreturnc                ó<   — | j         €t          d¦  «        ‚| j         S )z�
        Get or set the direction of this Repeat barline. Can be start or end.

        TODO: show how changing direction changes type.
        Nz1_direction unexpectedly None after initialization)rS   r   r7   s    r   rM   zRepeat.direction"  s#   € ð Œ?Ð"ÝÐRÑSÔSÐSØŒÐr   r#   c                óØ   — |                      ¦   «         dv rC|                      ¦   «         | _        | j        dk    r	d| _        d S | j        dk    r	d| _        d S d S t          d|› �¦  «        ‚)N)rL   Úendr[   r   rL   r   z cannot set repeat direction to: )r    rS   r,   r   r=   s     r   rM   zRepeat.direction-  sv   € à�;Š;‰=Œ=Ð,Ð,Ð,Ø#Ÿkšk™mœmˆDŒOØŒ %Ò'Ð'Ø#�”	�	�	Ø” GÒ+Ð+Ø)�”	�	�	ð ,Ð+õ ÐIÀ%ÐIÐIÑJÔJÐJr   c                ó   — | j         S )aÛ  
        Get or set the "times" property of this barline. This
        defines how many times the repeat happens. A standard repeat
        repeats 2 times; values equal to or greater than 0 are permitted.
        A repeat of 0 skips the repeated passage.

        >>> lb = bar.Repeat(direction='start')
        >>> rb = bar.Repeat(direction='end')

        Only end expressions can have times:

        >>> lb.times = 3
        Traceback (most recent call last):
        music21.bar.BarException: cannot set repeat times on a start Repeat

        >>> rb.times = 3
        >>> rb.times = -3
        Traceback (most recent call last):
        music21.bar.BarException: cannot set repeat times to a value less than zero: -3
        )rT   r7   s    r   rO   zRepeat.times8  s   € ð, Œ{Ðr   ÚNonec                óð   — |€	d | _         d S 	 t          |¦  «        }n # t          $ r t          d|›�¦  «        ‚w xY w|dk     rt          d|› �¦  «        ‚| j        dk    rt          d¦  «        ‚|| _         d S )Nzcannot set repeat times to: r   z3cannot set repeat times to a value less than zero: rL   z)cannot set repeat times on a start Repeat)rT   ÚintÚ
ValueErrorr   rM   )r3   r#   Ú	candidates      r   rO   zRepeat.timesP  s­   € àˆ=ØˆDŒKˆKˆKðÝ ™JœJ�	�	øÝð ð ð å"Ø<°5Ð<Ð<ñô ð ðøøøð ˜1Š}ˆ}Ý"ØQÈ%ÐQÐQñô ð ð Œ~ Ò(Ð(Ý"Ð#NÑOÔOÐOà#ˆDŒKˆKˆKs   � �:Ú Úxc                óD   — |› | j         › |› �}t          j        |¦  «        S )aà  
        Return a configured :class:`~music21.expressions.TextExpressions`
        object describing the repeat times. Append this to the stream
        for annotation of repeat times.

        >>> rb = bar.Repeat(direction='end')
        >>> rb.times = 3
        >>> rb.getTextExpression()
        <music21.expressions.TextExpression '3x'>

        >>> rb.getTextExpression(prefix='repeat ', postfix=' times')
        <music21.expressions.TextExpression 'repeat 3 t...'>
        )rT   r   ÚTextExpression)r3   ÚprefixÚpostfixr#   s       r   ÚgetTextExpressionzRepeat.getTextExpressiong  s,   € ð Ð1˜4œ;Ð1¨Ð1Ð1ˆÝÔ)¨%Ñ0Ô0Ð0r   )rL   N)rM   rN   rO   rP   )rX   rN   )r#   rN   )rX   rP   )r#   rP   rX   r]   )rb   rc   )r   r   r   rB   r1   r8   rH   rM   ÚsetterrO   rh   r   r   r   rK   rK   Ó   så   € € € € € ð6ð 6ðpð ð ð ð ðð ð ð ðð ð ñ „Xðð ÔðKð Kð Kñ ÔðKð ðð ð ñ „Xðð. „\ð$ð $ð $ñ „\ð$ð,1ð 1ð 1ð 1ð 1ð 1r   rK   c                  ó    — e Zd Zd„ Zd„ Zd„ ZdS )ÚTestc                óB   — ddl m}  || t          ¦   «         ¦  «         d S )Nr   )ÚtestCopyAll)Úmusic21.test.commonTestrm   Úglobals)r3   rm   s     r   ÚtestCopyAndDeepcopyzTest.testCopyAndDeepcopy{  s0   € Ø7Ð7Ð7Ð7Ð7Ð7Øˆ�D�'™)œ)Ñ$Ô$Ð$Ð$Ð$r   c                ó˜  — ddl m} ddl m} ddl m} ddl m} |                     ¦   «         }t          ¦   «         }||_        |                     ¦   «         }| 	                    |¦  «         | 
                    ¦   «         }| 	                    |¦  «         |                      |d         |¦  «         |                      |d         |¦  «         |                      |d         |¦  «         |                     ¦   «         }	|                     d|	¦  «         |                      |d         |	¦  «         |                      |d         |¦  «         d S )Nr   ©Ústream)Úclef)Únote)Úmetadataé   é   )Úmusic21rs   rt   ru   rv   ÚMeasurerK   ÚleftBarlineÚBassClefÚappendÚNoteÚassertEqualÚMetadataÚinsert)
r3   rs   rt   ru   rv   ÚmÚbÚcÚnÚmds
             r   ÚtestSortOrderzTest.testSortOrder  sO  € Ø"Ð"Ð"Ð"Ð"Ð"Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø$Ð$Ð$Ð$Ð$Ð$Ø�NŠNÑÔˆÝ‰HŒHˆØˆŒØ�MŠM‰OŒOˆØ	�Š�‰ŒˆØ�IŠI‰KŒKˆØ	�Š�‰Œˆð 	×Ò˜˜1œ˜qÑ!Ô!Ð!Ø×Ò˜˜1œ˜qÑ!Ô!Ð!Ø×Ò˜˜1œ˜qÑ!Ô!Ð!ð ×ÒÑ Ô ˆØ	�Š��B‰Œˆà×Ò˜˜1œ˜rÑ"Ô"Ð"Ø×Ò˜˜1œ˜qÑ!Ô!Ð!Ð!Ð!r   c                ó>  — ddl m} ddl m} ddlm}  |¦   «         }|                      d|j        ¦  «         |                     |g¦  «        }|                     |d¬¦  «        }| 	                    |¦  «        }|d         }|  
                    |j        d¦  «         d S )	Nr   )Ú	converterrr   )r*   Ú
StyleMixinÚpickle)ÚfmtF)ry   r‰   rs   Úmusic21.barr*   ÚassertNotInÚclassesÚStreamÚ	freezeStrÚthawStrr   ÚhasStyleInformation)	r3   r‰   rs   r*   rƒ   ÚsÚdataÚs2ÚthawedBarlines	            r   ÚtestFreezeThawzTest.testFreezeThaw˜  sÁ   € Ø%Ð%Ð%Ð%Ð%Ð%Ø"Ð"Ð"Ð"Ð"Ð"à'Ð'Ð'Ð'Ð'Ð'àˆG‰IŒIˆØ×Ò˜ q¤yÑ1Ô1Ð1Ø�MŠM˜1˜#ÑÔˆØ×"Ò" 1¨(Ð"Ñ3Ô3ˆØ×Ò˜tÑ$Ô$ˆØ˜1œˆà×Ò˜Ô:¸EÑBÔBÐBÐBÐBr   N)r   r   r   rp   r‡   r˜   r   r   r   rk   rk   z  sF   € € € € € ð%ð %ð %ð"ð "ð "ð2Cð Cð Cð Cð Cr   rk   Ú__main__)rB   Ú
__future__r   Úunittestry   r   r   r   r   r   ÚEnvironmentÚenvironLocalÚMusic21Exceptionr   r&   r'   r!   ÚstrongBarlineTypesr$   r(   ÚMusic21Objectr*   rR   rK   ÚTestCaserk   r   ÚmainTestr   r   r   ú<module>r£      s  ððð ð #Ð "Ð "Ð "Ð "Ð "à €€€à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø  Ð  Ð  Ð  Ð  Ð  Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à&ˆ{Ô& uÑ-Ô-€ð	ð 	ð 	ð 	ð 	�<Ô0ñ 	ô 	ð 	ðð ð €ð Øðð €ð
 Øðð Ð ð
 PÐOÐOÐ ðð ð ð&=ð =ð =ð.e1ð e1ð e1ð e1ð e1ˆdÔ ñ e1ô e1ð e1ðjc1ð c1ð c1ð c1ð c1ˆVÔ ñ c1ô c1ð c1ðN+Cð +Cð +Cð +Cð +Cˆ8Ôñ +Cô +Cð +Cð\ ˆzÒÐØ€N€N€NØ€GÔ�TÑÔÐÐÐð Ðr   