
    rh                    h   S SK Jr  S SKJr  S SKrS SKJr  S SKJr  S SKJr  / SQr	\" S\R                  4S	\R                  4S
\R                  4S\R                  4S\R                  4S\R                  4S\R                   4S\R"                  4S\R$                  4S\R&                  4S\R(                  4S\R*                  4S\R,                  4S\R.                  4S\R0                  4S\R2                  4/5      r\" \R7                  5        V Vs/ s H  u  pX4PM
     snn 5      r\\R2                  	 \\R                  	 \\R                  	 S
\\R                  '   S\\R                  '   \" S\R:                  4S\R<                  4S\R>                  4S\R@                  4S\RB                  4S\RD                  4S\RF                  4S\RH                  4S \RJ                  4S!\RL                  4S"\RN                  4S#\RP                  4S$\RR                  4S%\RT                  4S&\RV                  4S'\RX                  4S(\RZ                  4S)\R\                  4S*\R^                  4S+\R`                  4/5      r1\" \1R7                  5        V Vs/ s H  u  pX4PM
     snn 5      r2\2\R`                  	 S\2\Rf                  '   \Rh                  \Rj                  \Rj                  \Rl                  \Rl                  \Rn                  \Rp                  \Rr                  \Rt                  \Rv                  S,.
r< " S- S.\Rz                  5      r> " S/ S0\>5      r? " S1 S2\>5      r@ " S3 S4\A5      rBS5rCS6 rDS7 rES8 rF\R                  " S95      rHS: rI\JS;:X  a  S SKr\R                  " 5         ggs  snn f s  snn f )<    )annotations)OrderedDictN)articulations)exceptions21)expressions)pppppppppppppppppppppfffffffffffffffffffffmpmfsfsfpsfppfprfrfzsfzsffzfznpfsfzpzother-dynamicsaccentzstrong-accentstaccatostaccatissimospiccatotenutozdetached-legatoscoopplopdoitfalloffzbreath-markcaesurastressunstresszother-articulationzup-bowzdown-bowharmoniczopen-stringzthumb-position	fingeringpluckzdouble-tongueztriple-tonguestoppedzsnap-pizzicatostringbendtapfretheeltoefingernailshandbellzother-technical)
z
trill-markturnzdelayed-turnzinverted-turnzdelayed-inverted-turnshakemordentzinverted-mordent	schleiferzother-ornamentc                  8   ^  \ rS rSrSU 4S jjrU 4S jrSrU =r$ )MusicXMLExceptionl   c                @   > [         TU ]  U5        SU l        SU l        g )N )super__init__measureNumberpartName)selfmessage	__class__s     U/home/james-whalen/.local/lib/python3.13/site-packages/music21/musicxml/xmlObjects.pyrD   MusicXMLException.__init__m   s    !"$    c                   > [         TU ]  5       nU R                  (       d  U R                  (       a   SU R                   SU R                   S3U-   nU$ )Nz	In part (z), measure (z): )rC   __str__rE   rF   )rG   msgrI   s     rJ   rN   MusicXMLException.__str__r   sH    godmm_L9K9K8LCPSVVC
rL   )rE   rF   )rH   str)__name__
__module____qualname____firstlineno__rD   rN   __static_attributes____classcell__)rI   s   @rJ   r?   r?   l   s     
 rL   r?   c                      \ rS rSrSrg)MusicXMLExportExceptiony    NrR   rS   rT   rU   rV   r[   rL   rJ   rY   rY   y       rL   rY   c                      \ rS rSrSrg)MusicXMLImportException}   r[   Nr\   r[   rL   rJ   r_   r_   }   r]   rL   r_   c                      \ rS rSrSrg)MusicXMLWarning   r[   Nr\   r[   rL   rJ   rb   rb      r]   rL   rb   )hideObjectOnPrintc                    U S;   a  gg)N)yesTTFr[   values    rJ   yesNoToBooleanri      s    rL   c                    U (       a  gg)z
Convert a True, False bool to 'yes' or 'no'

>>> musicxml.xmlObjects.booleanToYesNo(True)
'yes'
>>> musicxml.xmlObjects.booleanToYesNo(False)
'no'

anything that evaluates to True becomes 'yes'

>>> musicxml.xmlObjects.booleanToYesNo(5)
'yes'

rf   nor[   rg   s    rJ   booleanToYesNorl      s     rL   c                0    [        [        U S-  5      5      $ )z
Turns a fraction into a string percent

>>> musicxml.xmlObjects.fractionToPercent(0.25)
'25'

Only does whole numbers for now:

>>> musicxml.xmlObjects.fractionToPercent(0.251)
'25'

d   )rQ   intrg   s    rJ   fractionToPercentrp      s     s53;  rL   z^[a-zA-Z_][\w.-]*$c                v    [        U [        5      (       d  gU (       d  g[        R                  U 5      (       a  gg)a  
Returns True or False if text is a valid xsd:id, that is, an NCName

From http://www.datypic.com/sc/xsd/t-xsd_NCName.html:

    The type xsd:NCName represents an XML non-colonized name,
    which is simply a name that does not contain colons. An xsd:NCName value must
    start with either a letter or underscore (_) and may contain only letters,
    digits, underscores (_), hyphens (-), and periods (.). This is equivalent
    to the Name type, except that colons are not permitted.

>>> musicxml.xmlObjects.isValidXSDID('hel_lo')
True

Names cannot begin with digits:

>>> musicxml.xmlObjects.isValidXSDID('4sad')
False

Names must be strings:

>>> musicxml.xmlObjects.isValidXSDID(12345)
False

FT)
isinstancerQ   _NCNAMEmatch)texts    rJ   isValidXSDIDrv      s/    4 dC  }}TrL   __main__)L
__future__r   collectionsr   remusic21r   r   r   DYNAMIC_MARKSAccentStrongAccentStaccatoStaccatissimoSpiccatoTenutoDetachedLegatoScoopPlopDoitFalloff
BreathMarkCaesuraStressUnstressArticulationARTICULATION_MARKSitemsARTICULATION_MARKS_REVUpBowDownBowStringHarmonic
OpenStringStringThumbPosition	FingeringFrettedPluckDoubleTongueTripleTongueStoppedSnapPizzicatoStringIndicationFretBendFretTapFretIndication	OrganHeelOrganToeHarpFingerNailsHandbellIndicationTechnicalIndicationTECHNICAL_MARKSTECHNICAL_MARKS_REVHarmonicTrillTurnInvertedTurnShakeMordentInvertedMordent	SchleiferOrnamentORNAMENT_MARKSMusic21Exceptionr?   rY   r_   UserWarningrb   STYLE_ATTRIBUTES_YES_NO_TO_BOOLri   rl   rp   compilers   rv   rR   mainTest)kvs   00rJ   <module>r      s   # # 	 "    !$$%}112-(()}223-(()$$%556}""#m  !m  !&&']--.&&'$$%-(()M667 , %9K9Q9Q9S%T9Sqf9S%TU =556=112=//01; }-- ./7 }++ ,-*=*=> *M,A,AB *M,H,HI -}/G/GH 0-2S2ST +]-D-DE ')C)CD /1K1KL /1K1KL )=+@+@A 0-2M2MN (-*H*HI
 !'(>(>? %}'<'<= &(D(DE &(?(?@ %}'='=> -}/L/LM !+M,L,LM 1=3T3TU3! "6 "o6K6K6M"N6MdaA66M"NO 99:.8 M** + !, 1 1%**"-"2"2#.#;#;+6+C+C&,,(00&1&A&A*44$/$8$8 
55 
	/ 		/ 		k 	 #: *!  ***
+#N z [ &UD #Os   N(
N.
