§
    ƒØj½ê  ã                  óâ  — d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z
ddl	mZ ddlmc mZ ddlmZ ddlmZ ddlmZ dZdd
„Z G d„ dej        ¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ d¦  «        Z e¦   «         ddœZd„ Z G d„ d¦  «        Z G d„ d¦  «        Z d„ Z!d„ Z"d„ Z# G d„ dej$        ¦  «        Z%e eegZ&e'dk    rddlZ ej(        e%¦  «         dS dS ) a  
The environment module describes an object for accessing and setting
variables related to the user's music21 environment. Such variables include
the location of external applications such as MusicXML readers (e.g. MuseScore),
whether music21 is allowed to download files directly (via the virtual corpus),
and other settings.

Additional documentation for and examples of using this module are found in
:ref:`User's Guide, Chapter 24, Environment <usersGuide_24_environment>`.

# TODO: Update to user's guide -- showing each function
é    )ÚannotationsN)Úoverload)Úsaxutils)Úexceptions21)ÚcommonÚenvironmenté   c                óÂ  — d||z  dz  z   }t          | ¦  «        r—| j        r| j                             ¦   «         s||dz  z   | _        | j        r| j                             ¦   «         s|| _        | D ]}t	          ||dz   ¦  «         Œ| j        r| j                             ¦   «         s	|| _        dS dS |r)| j        r| j                             ¦   «         s|| _        dS dS dS )z4
    indent an elementTree element for printing
    ú
ú é   N)ÚlenÚtextÚstripÚtailÚetIndent)ÚelemÚlevelÚspacesÚiÚsubEls        úˆ/Users/tedpeters/Documents/Projects/Claude Projects/Misc Tools/notename-sheets/.venv/lib/python3.11/site-packages/music21/environment.pyr   r   -   s  € ð 	ˆu�v‰~ Ñ#Ñ#€AÝ
ˆ4�y„yð ØŒyð 	) ¤	§¢Ñ 1Ô 1ð 	)Ø˜F S™LÑ(ˆDŒIØŒyð 	 ¤	§¢Ñ 1Ô 1ð 	ØˆDŒIØð 	'ð 	'ˆEÝ�U˜E A™IÑ&Ô&Ð&Ð&ØŒyð 	 ¤	§¢Ñ 1Ô 1ð 	ØˆDŒIˆIˆIð	ð 	ð ð 	˜$œ)ð 	¨4¬9¯?ª?Ñ+<Ô+<ð 	ØˆDŒIˆIˆIð	ð 	ð 	ð 	ó    c                  ó   — e Zd ZdS )ÚEnvironmentExceptionN©Ú__name__Ú
__module__Ú__qualname__© r   r   r   r   C   ó   € € € € € Ø€Dr   r   c                  ó   — e Zd ZdS )ÚUserSettingsExceptionNr   r    r   r   r#   r#   G   r!   r   r#   c                  ó.   ‡ — e Zd ZdZdˆ fd„	Zˆ fd„Zˆ xZS )ÚLocalCorpusSettingsaN  
    A lightweight object for storing the 'LocalCorpusSettings' tag in the
    .music21rc

    It is a subclass of list and has two additional attributes, name (which
    should be None for the unnamed localCorpus) and cacheFilePath
    for a full filepath (ending in .json) as a location
    to store the .metadataBundle (.json) cache for the
    LocalCorpus.  This can be None, in which case the (volatile) temp
    directory is used.

    >>> lcs = environment.LocalCorpusSettings(['/tmp', '/home'])
    >>> lcs
    LocalCorpusSettings(['/tmp', '/home'])

    >>> lcs.name = 'theWholeEnchilada'
    >>> lcs
    LocalCorpusSettings(['/tmp', '/home'], name='theWholeEnchilada')

    >>> lcs.cacheFilePath = '/home/enchilada.json'
    >>> lcs
    LocalCorpusSettings(['/tmp', '/home'],
                        name='theWholeEnchilada',
                        cacheFilePath='/home/enchilada.json')

    >>> list(lcs)
    ['/tmp', '/home']
    >>> lcs.name
    'theWholeEnchilada'
    >>> lcs.cacheFilePath
    '/home/enchilada.json'
    >>> '/home' in lcs
    True
    >>> '/root' in lcs
    False
    Nc                ón   •— |€g }t          ¦   «                              |¦  «         || _        || _        d S ©N)ÚsuperÚ__init__ÚnameÚcacheFilePath)ÚselfÚpathsr*   r+   Ú	__class__s       €r   r)   zLocalCorpusSettings.__init__s   s:   ø€ Øˆ=ØˆEÝ‰Œ×Ò˜ÑÔÐØˆŒ	Ø*ˆÔÐÐr   c                óØ   •— t          ¦   «                              ¦   «         }d}d}| j        �dt          | j        ¦  «        z   }| j        �dt          | j        ¦  «        z   }d|› |› |› d�S )NÚ z, name=z, cacheFilePath=zLocalCorpusSettings(ú))r(   Ú__repr__r*   Úreprr+   )r,   ÚlistReprÚnamePartÚmdbpPartr.   s       €r   r2   zLocalCorpusSettings.__repr__z   su   ø€ Ý‘7”7×#Ò#Ñ%Ô%ˆØˆØˆØŒ9Ð Ø ¥4¨¬	¡?¤?Ñ2ˆHØÔÐ)Ø)­D°Ô1CÑ,DÔ,DÑDˆHØE hÐE°ÐE¸(ÐEÐEÐEÐEr   )NNN)r   r   r   Ú__doc__r)   r2   Ú__classcell__)r.   s   @r   r%   r%   M   sj   ø€ € € € € ð#ð #ðJ+ð +ð +ð +ð +ð +ðFð Fð Fð Fð Fð Fð Fð Fð Fr   r%   c                  ó¢   — e Zd ZdZdd„Zd„ Zd„ Zd„ Zd„ Zdd„Z	dd	„Z
d d„Zdd„Zd„ Zd„ Zd„ Zd„ Zd„ Zd!d"d„Zd„ Zd„ Zd„ Zdd„Zd„ Zdd„ZdS )#Ú_EnvironmentCorea¤  
    This private class should never be directly created; use the Environment
    object to access this object.

    Multiple Environment instances may exist, but all share access to the same
    _EnvironmentCore instance that is stored in this module.

    The only case in which a new _EnvironmentCore is created is if the
    forcePlatform argument is passed and is different from the stored
    forcePlatform argument. This is only used in testing--it allows authors to
    test what the settings on a different platform (win, Mac, etc.) would be.

    NOTE: this is a private class. All documentation for public methods should
    be placed in the Environment class.
    Nc                óÆ   — i | _         g | _        dD ]}| j                             |¦  «         Œ|                      |¬¦  «         |€|                      ¦   «          d | _        d S )N)
ÚbraillePathÚgraphicsPathÚlilypondPathÚlocalCorpusPathÚmanualCoreCorpusPathÚmidiPathÚmusescoreDirectPNGPathÚmusicxmlPathÚpdfPathÚ
vectorPath©ÚforcePlatform)Ú_refÚ_keysToPathsÚappendÚ_loadDefaultsÚreadÚdefaultRootTempDir)r,   rG   ÚpathKeys      r   r)   z_EnvironmentCore.__init__›   s|   € ð ˆŒ	ð ˆÔð
ð 	.ð 	.ˆGð Ô×$Ò$ WÑ-Ô-Ð-Ð-ð 	×Ò¨ÐÑ7Ô7Ð7àÐ Ø�IŠI‰KŒKˆKØ"&ˆÔÐÐr   c                óâ  — || j         vr|dk    rt          d|› �¦  «        ‚|dk    r| j         |         }n8t          | j         d         ¦  «        }t          |¦  «        dk    r	|d         }nd}t	          |t
          ¦  «        r|                     dd¬¦  «        }t          |¦  «                             ¦   «         }|d	k    ry|d
k    rt          j
        }nf|dk    rt          j        }nSd|v rt          j        }nBd|v rt          j
        }n1d|v rt          j        }n d|v rt          j        }nt          |¦  «        }|�1|dk    r+||                      ¦   «         v rt!          j        |¦  «        }nd }|S )Nr?   úno preference: ÚlocalCorpusSettingsr   r0   úutf-8Úreplace)ÚencodingÚerrorsÚdebugÚtrueÚfalseÚoffÚuserÚdevelÚall)rH   r   Úlistr   Ú
isinstanceÚbytesÚdecodeÚstrÚlowerr   Ú
DEBUG_USERÚ	DEBUG_OFFÚDEBUG_DEVELÚ	DEBUG_ALLÚintÚgetKeysToPathsÚpathlibÚPath)r,   ÚkeyÚvaluer-   ÚvalueStrs        r   Ú__getitem__z_EnvironmentCore.__getitem__¹   s�  € ð �d”iÐÐ CÐ+<Ò$<Ð$<Ý&Ð'>¸Ð'>Ð'>Ñ?Ô?Ð?àÐ#Ò#Ð#Ø”I˜c”NˆEˆEå˜œÐ#8Ô9Ñ:Ô:ˆEÝ�5‰zŒz˜AŠ~ˆ~Ø˜aœ��à�å�e�UÑ#Ô#ð 	EØ—L’L¨'¸)�LÑDÔDˆEå�u‘:”:×#Ò#Ñ%Ô%ˆà�'Š>ˆ>Ø˜6Ò!Ð!ÝÔ)��Ø˜WÒ$Ð$ÝÔ(��Ø˜(Ð"Ð"ÝÔ(��Ø˜8Ð#Ð#ÝÔ)��Ø˜HÐ$Ð$ÝÔ*��Ø˜(Ð"Ð"ÝÔ(��å˜E™
œ
�àÐ ¨"¢ Ø�d×)Ò)Ñ+Ô+Ð+Ð+Ýœ UÑ+Ô+�øàˆEØˆr   c                ó   — dS )Nz<Environment>r    ©r,   s    r   r2   z_EnvironmentCore.__repr__é   s   € Øˆr   c                ó2  — d|                      ¦   «         v r|�t          j        |d¬¦  «        }|| j        vr|dk    rt	          d|› �¦  «        ‚|dk    rd }d}|dk    r%|                      ¦   «         }|t          j        v rd}nv|d	k    r%|                      ¦   «         }|t          j        v rd}nK|d
k    r%|                      ¦   «         }|t          j        v rd}n |dk    rt          |t          ¦  «        rd}nd}|st	          |› d|› �¦  «        ‚t          |t          ¦  «        rt          j        |¦  «        }|dk    rMt          |¦  «        | j        d         vr/| j        d                              t          |¦  «        ¦  «         d S d S || j        |<   d S )NÚpathF©ÚreturnPathlibr?   rP   r0   Ú
showFormatTÚwriteFormatÚautoDownloadrQ   z, is not an acceptable value for preference: )rb   r   Ú	cleanpathrH   r   ÚVALID_SHOW_FORMATSÚVALID_WRITE_FORMATSÚVALID_AUTO_DOWNLOADr^   r%   ra   r   ÚescaperJ   )r,   rk   rl   Úvalids       r   Ú__setitem__z_EnvironmentCore.__setitem__ì   sÛ  € ð �S—Y’Y‘[”[Ð Ð  UÐ%6ÝÔ$ U¸%Ð@Ñ@Ô@ˆEà�d”iÐÐØÐ'Ò'Ð'Ý*Ð+B¸SÐ+BÐ+BÑCÔCÐCØ�BŠ;ˆ;ØˆEàˆØ�,ÒÐØ—K’K‘M”MˆEØ�Ô1Ð1Ð1Ø�øØ�MÒ!Ð!Ø—K’K‘M”MˆEØ�Ô2Ð2Ð2Ø�øØ�NÒ"Ð"Ø—K’K‘M”MˆEØ�Ô2Ð2Ð2Ø�øØÐ)Ò)Ð)å˜%Õ!4Ñ5Ô5ð Ø�øàˆEàð 	MÝ&ØÐKÐKÀcÐKÐKñMô Mð Mõ �e�SÑ!Ô!ð 	+Ý”O EÑ*Ô*ˆEàÐ#Ò#Ð#å�5‰zŒz ¤Ð+@Ô!AÐAÐAà”	Ð/Ô0×7Ò7½¸E¹
¼
ÑCÔCÐCÐCÐCð BÐAð #ˆDŒI�c‰NˆNˆNr   c                ó*   — t          | j        ¦  «        S r'   )r3   rH   rp   s    r   Ú__str__z_EnvironmentCore.__str__"  s   € Ý�D”I‰ŒÐr   c                ó$  — |€i }|                      ¦   «         }|D �]s}|j        dk    r|t          ¦   «         }|D ]e}|j        dk    r/|j                             ¦   «         }|                     |¦  «         Œ<|j        dk    r|j                             ¦   «         |_        Œf||d<   ŒŠ|j        dk    r©i |d<   |D ]Ÿ}|                     d¦  «        }	t          ¦   «         }|	|_        |D ]e}|j        dk    r/|j                             ¦   «         }|                     |¦  «         Œ<|j        dk    r|j                             ¦   «         |_        Œf||d         |	<   Œ �Œ>|                     d¦  «        }	|                     d¦  «        }
|	|vr�Œn|
||	<   �ŒudS )z�
        Takes in a ElementTree and possibly an already populated reference dictionary
        (or creates a new one) and populates it.
        NrQ   r?   r+   ÚlocalCorporaSettingsr*   rl   )	ÚgetrootÚtagr%   r   r   rJ   r+   Úgetr*   )r,   ÚsettingsTreeÚrefÚsettingsÚslotÚlcsÚ	slotChildÚfpCandidaterQ   r*   rl   s              r   Ú_fromSettingsz_EnvironmentCore._fromSettings&  sÙ  € ð
 ˆ;ØˆCØ×'Ò'Ñ)Ô)ˆØð  	&ñ  	&ˆDØŒxÐ0Ò0Ð0Ý)Ñ+Ô+�Ø!%ð Cð C�IØ ”}Ð(9Ò9Ð9Ø&/¤n×&:Ò&:Ñ&<Ô&<˜ØŸ
š
 ;Ñ/Ô/Ð/Ð/Ø"œ¨/Ò9Ð9Ø,5¬N×,@Ò,@Ñ,BÔ,B˜Ô)øØ-0�Ð)Ñ*Ð*à”Ð3Ò3Ð3Ø.0�Ð*Ñ+Ø+/ð 
<ð 
<Ð'Ø.×2Ò2°6Ñ:Ô:�DÝ-Ñ/Ô/�CØ#�C”HØ%8ð Gð G˜	Ø$œ=Ð,=Ò=Ð=Ø*3¬.×*>Ò*>Ñ*@Ô*@˜KØŸJšJ {Ñ3Ô3Ð3Ð3Ø&œ]¨oÒ=Ð=Ø09´×0DÒ0DÑ0FÔ0F˜CÔ-øØ8;�CÐ.Ô/°Ñ5Ð5ñ
<ð —x’x Ñ'Ô'�ØŸš Ñ)Ô)�Ø˜s�?�?Ùð !&�C˜‘I‘IðA 	&ð  	&r   c                óX  — d| j         d<   d| j         d<   d| j         d<   d| j         d<   d| j         d<   d| j         d	<   d| j         d
<   d| j         d<   d| j         d<   d| j         d<   d| j         d<   d| j         d<   d| j         d<   d| j         d<   d| j         d<   d| j         d<   d| j         d<   d| j         d<   t          ¦   «         | j         d<   i | j         d<   d| j         d<   |€t          j        ¦   «         }n|}|dk    r:dd	t          j        d ¦  «        fdt          j        d ¦  «        ffD ]
\  }}|| |<   ŒdS |d!k    rd"D ]
\  }}|| |<   ŒdS |d#k    rVt          j        ¦   «         }|d         d$k    s|d         d%k    r|d         d&k    rd'}nd(}d)d*d|fd|fd|fd+d,fD ]\  }}|| |<   ŒdS dS )-zS
        Load defaults.

        All keys are derived from these defaults.
        NÚdirectoryScratchr>   ÚlilypondVersionÚpdfÚlilypondFormatÚpsÚlilypondBackendrC   rA   r=   rE   rD   r<   rB   Úmusicxmlru   rv   zipython.musicxml.pngÚipythonShowFormatÚaskrw   r   rV   r   ÚwarningsrQ   r‚   r@   Úwin)r>   Úlilypondz-%PROGRAMFILES%\MuseScore 3\bin\MuseScore3.exeÚnix))r>   z/usr/bin/lilypond)rC   ú/usr/bin/mscore3)rB   rœ   )r=   ú/usr/bin/xdg-open)rD   r�   Údarwiné   é
   é   z /System/Applications/Preview.appz/Applications/Preview.app)r>   z:/Applications/Lilypond.app/Contents/Resources/bin/lilypond)rC   ú3/Applications/MuseScore 3.app/Contents/MacOS/mscore)rA   z/Applications/GarageBand.app)rB   r¢   )rH   r%   r   ÚgetPlatformrx   ÚmacOSVersion)r,   rG   Úplatformr*   rl   ÚversionTupleÚpreviewLocations          r   rK   z_EnvironmentCore._loadDefaultsP  s˜  € ð )-ˆŒ	Ð$Ñ%ð %)ˆŒ	�.Ñ!ð (,ˆŒ	Ð#Ñ$Ø&+ˆŒ	Ð"Ñ#Ø'+ˆŒ	Ð#Ñ$ð %)ˆŒ	�.Ñ!ð !%ˆŒ	�*Ñð %)ˆŒ	�.Ñ!ð #'ˆŒ	�,Ñð  $ˆŒ	�)Ñð $(ˆŒ	�-Ñ ð /3ˆŒ	Ð*Ñ+Ø",ˆŒ	�,ÑØ#-ˆŒ	�-Ñ Ø)?ˆŒ	Ð%Ñ&à$)ˆŒ	�.Ñ!ØˆŒ	�'Ñð !"ˆŒ	�*Ñõ ,?Ñ+@Ô+@ˆŒ	Ð'Ñ(Ø,.ˆŒ	Ð(Ñ)à,0ˆŒ	Ð(Ñ)àÐ ÝÔ)Ñ+Ô+ˆHˆHà$ˆHà�uÒÐà,ØÝÔ!Ð"RÑSÔSðð *ÝÔ!Ð"RÑSÔSðð ð 	#ð 	#‘��eð #��T‘
�
ð	#ð 	#ð ˜ÒÐð ð #ð #‘��eð #��T‘
�
ð#ð #ð ˜Ò!Ð!Ý!Ô.Ñ0Ô0ˆLØ˜AŒ "Ò$Ð$¨°a¬¸BÒ)>Ð)>À<ÐPQÄ?ÐVXÒCXÐCXØ"D��à"=�ðOðHà Ð1Ø˜Ð/Ø˜OÐ,Ø<ðHð ð #ð #‘��eð #��T‘
�
ð' "Ð!ð#ð #r   rr   ústr | pathlib.Path | NoneÚreturnÚboolc                ó  — t          |t          j        t          f¦  «        rct          j                             |¦  «        }t	          j        |t          j        ¦  «        }t	          j        |t          j	        ¦  «        }|o|o|S dS )zK
        Return True if the path exists, is readable and writable.
        F)
r^   ri   rj   ra   Úosrr   ÚexistsÚaccessÚR_OKÚW_OK)r,   rr   r­   ÚreadableÚwritables        r   Ú_checkAccessibilityz$_EnvironmentCore._checkAccessibilityµ  sk   € õ �d�Wœ\­3Ð/Ñ0Ô0ð 	Ý”W—^’^ DÑ)Ô)ˆFÝ”y ¥r¤wÑ/Ô/ˆHÝ”y ¥r¤wÑ/Ô/ˆHØÐ3˜hÐ3¨8Ð3à�5r   c                ó  — |€| j         }ddi}t          j        d|¦  «        }t          j        |¦  «        }t	          |                     ¦   «         ¦  «        D �]2\  }}|}|dk    rÄt          j        d¦  «        }t	          |¦  «        D ]A}	t          j        d¦  «        }
|	�t          |	¦  «        |
_        |                     |
¦  «         ŒB|j	        �Bt          j        d¦  «        }t          |j	        ¦  «        |_        |                     |¦  «         |                     |¦  «         ŒÒ|dk    �rt          j        d¦  «        }t	          |                     ¦   «         ¦  «        D ]Ê\  }}t          j        d|¬	¦  «        }t	          |¦  «        D ]A}	t          j        d¦  «        }
|	�t          |	¦  «        |
_        |                     |
¦  «         ŒB|j	        �Bt          j        d¦  «        }t          |j	        ¦  «        |_        |                     |¦  «         |                     |¦  «         ŒË|                     |¦  «         �Œðd
|i}|�t          |¦  «        |d<   t          j        d|¦  «        }|                     |¦  «         �Œ4|S )z‹
        Convert a ref dictionary to an xml.etree.ElementTree.Element object
        with root "<settings>" and return that object
        NrT   rR   rˆ   rQ   r?   r+   r‚   )r*   r*   rl   Ú
preference)
rH   ÚETÚElementÚElementTreeÚsortedÚitemsra   r   rJ   r+   )r,   r‡   ÚsettingsDictrˆ   r†   rk   rl   rŠ   rQ   ÚfilePathr?   Úmdbpr‚   r*   Úattribsr‰   s                   r   ÚtoSettingsXMLz_EnvironmentCore.toSettingsXMLÁ  s‰  € ð
 ˆ;Ø”)ˆCà" GÐ,ˆÝ”:˜j¨,Ñ7Ô7ˆå”~ hÑ/Ô/ˆÝ  §¢¡¤Ñ-Ô-ð &	&ñ &	&‰JˆC�ØˆCàÐ+Ò+Ð+Ý&(¤jÐ1FÑ&GÔ&GÐ#Ý & s¡¤ð @ð @�HÝ&(¤jÐ1BÑ&CÔ&C�OØÐ+Ý/2°8©}¬}˜Ô,Ø'×.Ò.¨Ñ?Ô?Ð?Ð?ØÔ$Ð0Ýœ: oÑ6Ô6�DÝ # CÔ$5Ñ 6Ô 6�D”IØ'×.Ò.¨tÑ4Ô4Ð4à—’Ð 3Ñ4Ô4Ð4Ð4ØÐ.Ò.Ñ.Ý')¤zÐ2HÑ'IÔ'IÐ$Ý!'¨¯ª©¬Ñ!6Ô!6ð Eð E‘I�D˜#Ý*,¬*Ð5JÐQUÐ*VÑ*VÔ*VÐ'Ý$*¨3¡K¤Kð Dð D˜Ý*,¬*Ð5FÑ*GÔ*G˜Ø#Ð/Ý36°x±=´=˜OÔ0Ø+×2Ò2°?ÑCÔCÐCÐCØÔ(Ð4Ý!œz¨/Ñ:Ô:˜Ý$'¨Ô(9Ñ$:Ô$:˜œ	Ø+×2Ò2°4Ñ8Ô8Ð8à(×/Ò/Ð0CÑDÔDÐDÐDØ—’Ð 4Ñ5Ô5Ð5Ñ5ð " 3˜-�ØÐ$Ý'*¨5¡z¤z�G˜GÑ$Ý”z ,°Ñ8Ô8�Ø—’ Ñ%Ô%Ð%Ñ%ØÐr   c                ó"  — |                       | j        ¦  «        r| j        S t          j        t	          j        ¦   «         ¦  «        dz  | _        |                       | j        ¦  «        r| j        S 	 | j                             ¦   «          nÿ# t          $ rò t          j	        ¦   «         dv r?t          j        ¦   «         }t          j        t	          j        ¦   «         ¦  «        d|› �z  }n't          j        t	          j        d¬¦  «        ¦  «        }|                       |¦  «        r|| _        nW	 |                     ¦   «          || _        n:# t          $ r- t          j        t	          j        ¦   «         ¦  «        | _        Y nw xY wY nw xY w| j        S )ak  
        returns whatever tempfile.gettempdir() returns plus 'music21'.

        Creates the subdirectory if it doesn't exist:

        >>> import tempfile
        >>> import pathlib
        >>> tempFile = tempfile.gettempdir()
        >>> #_DOCS_SHOW tempFile
        '/var/folders/x5/rymq2tx16lqbpytwb1n_cc4c0000gn/T'

        >>> import os
        >>> e = environment.Environment()
        >>> e.getDefaultRootTempDir() == pathlib.Path(tempFile) / 'music21'
        True

        If failed to create the subdirectory (OSError is raised), this function
        will return (1), for Linux and Mac platforms, a subdirectory under the
        system temp directory which is named with 'music21-userid-$UID' or (2),
        for other platforms, a temporary directory which is created by
        tempfile.mkdtemp(prefix="music21-"), which is named with 'music21-'
        plus 8 hashed codes, and (3) if failing for both above, it will return
        the directory from tempfile.gettempdir(). The location of this directory
        depends on OS.

        Note the temporary directory may be different in each python session.
        Úmusic21©r›   rž   úmusic21-userid-zmusic21-)Úprefix)r³   rM   ri   rj   ÚtempfileÚ
gettempdirÚmkdirÚOSErrorr   r£   r¬   ÚgetuidÚmkdtemp)r,   ÚuidÚdir_paths      r   ÚgetDefaultRootTempDirz&_EnvironmentCore.getDefaultRootTempDirø  sŸ  € ð: ×#Ò# DÔ$;Ñ<Ô<ð 	+ØÔ*Ð*õ #*¤,­xÔ/BÑ/DÔ/DÑ"EÔ"EÈ	Ñ"QˆÔð ×#Ò# DÔ$;Ñ<Ô<ð 	+ØÔ*Ð*ðVØÔ'×-Ò-Ñ/Ô/Ð/Ð/øÝð Vð Vð VÝÔ%Ñ'Ô'Ð+<Ð<Ð<Ýœ)™+œ+�CÝ&œ|­HÔ,?Ñ,AÔ,AÑBÔBÐE\ÐWZÐE\ÐE\Ñ\�H�Hå&œ|­HÔ,<ÀJÐ,OÑ,OÔ,OÑPÔP�Hà×+Ò+¨HÑ5Ô5ð VØ.6�DÔ+Ð+ðVØ ŸšÑ(Ô(Ð(Ø2:˜Ô/Ð/øÝ"ð Vð Vð Vå29´,½xÔ?RÑ?TÔ?TÑ2UÔ2U˜Ô/Ð/Ð/ðVøøøøøðVøøøð" Ô*Ð*s7   Á1B ÂB"FÄ.E
Å	FÅ
4FÅ>FÆ FÆFÆFc                ó   — | j         S )a  
        Find all keys that refer to paths

        >>> e = environment.Environment()
        >>> for i in e.getKeysToPaths():
        ...     #_DOCS_SHOW print(i)
        ...     pass #_DOCS_HIDE

        braillePath
        graphicsPath
        lilypondPath
        ...
        )rI   rp   s    r   rh   z_EnvironmentCore.getKeysToPaths5  s   € ð Ô Ð r   c                óN   — t          | j                             ¦   «         ¦  «        S )a)  
        Find all keys (in any order)...

        >>> e = environment.Environment()
        >>> for i in e.getRefKeys():
        ...     #_DOCS_SHOW print(i)
        ...     pass #_DOCS_HIDE

        lilypondBackend
        pdfPath
        lilypondVersion
        graphicsPath
        ...
        ©r]   rH   Úkeysrp   s    r   Ú
getRefKeysz_EnvironmentCore.getRefKeysE  s   € õ  �D”I—N’NÑ$Ô$Ñ%Ô%Ð%r   c                óÔ   — | j         d         €|                      ¦   «         S t          j        | j         d         ¦  «        }|                     ¦   «         st          d|›d�¦  «        ‚|S )zÔ
        gets either the directory in key 'directoryScratch' or self.getDefaultRootTempDir

        Returns an exception if directoryScratch is defined but does not exist.

        Returns a pathlib.Path
        r�   Nz"user-specified scratch directory (z=) does not exist; remove preference file or reset Environment)rH   rÍ   ri   rj   r­   r   )r,   ÚrefDirs     r   ÚgetRootTempDirz_EnvironmentCore.getRootTempDirW  s|   € ð Œ9Ð'Ô(Ð0Ø×-Ò-Ñ/Ô/Ð/õ ”˜dœiÐ(:Ô;Ñ<Ô<ˆà�}Š}‰Œð 	Ý&ð?°Vð ?ð ?ð ?ñô ð ð ˆr   c                ó‚  — t          j        ¦   «         }dt          j        v r(t	          j        t          j        d         ¦  «        dz  }nd}|dk    rndt          j        v r%t	          j        t          j        d         ¦  «        }n6|r|}n1t	          j        t          j                             d¦  «        ¦  «        }|dz  S |dv r{d	t          j        v rTt          j        t          j        d	         t          j	        ¦  «        r%t	          j        t          j        d	         ¦  «        }nt	          j        d
¦  «        }|dz  S dS )zI
        Return a pathlib.Path object to the '.music21rc' object
        ÚUSERPROFILEzApplication DataNr™   ÚAPPDATAú~zmusic21-settings.xmlrÂ   ÚHOMEz/tmp/z
.music21rc)
r   r£   r¬   Úenvironri   rj   rr   Ú
expanduserr®   r°   )r,   r¥   ÚuserProfilePathÚ	directorys       r   ÚgetSettingsPathz _EnvironmentCore.getSettingsPathl  s  € õ Ô%Ñ'Ô'ˆØ�BœJÐ&Ð&Ý%œl­2¬:°mÔ+DÑEÔEÐHZÑZˆOˆOà"ˆOà�uÒÐð �BœJÐ&Ð&Ý#œL­¬°IÔ)>Ñ?Ô?�	�	Ø ð BØ+�	�	å#œL­¬×);Ò);¸CÑ)@Ô)@ÑAÔA�	ØÐ5Ñ5Ð5ØÐ*Ð*Ð*à�œÐ#Ð#­¬	µ"´*¸VÔ2DÅbÄgÑ(NÔ(NÐ#Ý#œL­¬°FÔ);Ñ<Ô<�	�	å#œL¨Ñ1Ô1�	Ø˜|Ñ+Ð+ð +Ð*r   r0   Tústr | pathlib.Pathc                óþ   — |                       ¦   «         }|r|                     d¦  «        sd|z   }t          j        ||d¬¦  «        5 }|j        }ddd¦  «         n# 1 swxY w Y   |rt          j        |¦  «        S |S )a  
        Gets a temporary file with a suffix that will work for a bit.

        v5 -- added returnPathlib.
        v6 -- returnPathlib defaults to True

        OMIT_FROM_DOCS
        >>> e = environment.Environment()
        >>> tmp1 = e.getTempFile(returnPathlib=False)
        >>> isinstance(tmp1, str)
        True
        >>> import pathlib
        >>> tmp2 = e.getTempFile()
        >>> isinstance(tmp2, pathlib.Path)
        True
        >>> import os
        >>> os.remove(tmp1)
        >>> os.remove(tmp2)
        ú.F)ÚdirÚsuffixÚdeleteN)rÕ   Ú
startswithrÅ   ÚNamedTemporaryFiler*   ri   rj   )r,   rä   rt   ÚrootDirÚntfÚntf_names         r   ÚgetTempFilez_EnvironmentCore.getTempFileŠ  sÌ   € ð* ×%Ò%Ñ'Ô'ˆØð 	"˜&×+Ò+¨CÑ0Ô0ð 	"Ø˜6‘\ˆFåÔ(¨W¸VÈEÐRÑRÔRð 	 ÐVYØ”xˆHð	 ð 	 ð 	 ñ 	 ô 	 ð 	 ð 	 ð 	 ð 	 ð 	 ð 	 øøøð 	 ð 	 ð 	 ð 	 ð ð 	Ý”< Ñ)Ô)Ð)àˆOs   ÁAÁA Á#A c                óV   — t          | j                             ¦   «         ¦  «        dgz   S )Nr?   rÐ   rp   s    r   rÑ   z_EnvironmentCore.keys«  s%   € Ý�D”I—N’NÑ$Ô$Ñ%Ô%Ð):Ð(;Ñ;Ð;r   c                ó~   — d}|dk    rd}n1|dv rd}n*|dk    rd}n!|dk    rd	}n|d
v rd}n|dk    rd}n|dk    rd}|S )aM  
        Finds the appropriate key to the file/app that can launch the given format:

        >>> e = environment.Environment()
        >>> e.formatToKey('lilypond')
        'lilypondPath'
        >>> e.formatToKey('png')
        'graphicsPath'
        >>> e.formatToKey('jpeg')
        'graphicsPath'
        >>> e.formatToKey('svg')
        'vectorPath'
        >>> e.formatToKey('pdf')
        'pdfPath'
        >>> e.formatToKey('musicxml')
        'musicxmlPath'
        >>> e.formatToKey('midi')
        'midiPath'
        >>> e.formatToKey('braille')
        'braillePath'

        returns None if there is no key for this format (whether the format exists or not)

        >>> e.formatToKey('ipython') is None  # actual format
        True
        >>> e.formatToKey('adobePhotoshop') is None  # not a music21 format
        True
        Nrš   r>   )ÚpngÚjpegr=   ÚsvgrE   r‘   rD   )r•   rC   ÚmidirA   Úbrailler<   r    ©r,   Ú	m21FormatÚenvironmentKeys      r   ÚformatToKeyz_EnvironmentCore.formatToKey®  s‹   € ð: ˆØ˜
Ò"Ð"Ø+ˆNˆNØ˜/Ð)Ð)Ø+ˆNˆNØ˜%ÒÐØ)ˆNˆNØ˜%ÒÐØ&ˆNˆNØ˜-Ð'Ð'Ø+ˆNˆNØ˜&Ò Ð Ø'ˆNˆNØ˜)Ò#Ð#Ø*ˆNØÐr   c                ó„   — |                       |¦  «        }|�(|| j        vrt          |dz   ¦  «        ‚| j        |         S dS )zE
        Given a format, return the app that will launch it.
        Nz is not set in UserSettings. )rö   rH   r   ró   s      r   ÚformatToAppz_EnvironmentCore.formatToAppÜ  sP   € ð ×)Ò)¨)Ñ4Ô4ˆØÐ%Ø T¤YÐ.Ð.Ý*¨>Ð<[Ñ+[Ñ\Ô\Ð\Ø”9˜^Ô,Ð,Øˆtr   c           	     óN  — |€|                       ¦   «         }|                     ¦   «         sdS 	 t          j        t	          |¦  «        ¦  «        }n:# t          j        $ r(}t          d|› dt	          |¦  «        › �¦  «        |‚d}~ww xY w|                      || j        ¦  «         dS )z�
        Read the environment file from .music21rc and call _fromSettings
        Called only once per music21 instance.
        NzCannot parse file z: )	rß   r­   r¶   Úparsera   Ú
ParseErrorr   r�   rH   )r,   r¼   r†   Úpes       r   rL   z_EnvironmentCore.readç  s½   € ð
 ÐØ×+Ò+Ñ-Ô-ˆHØ�ŠÑ Ô ð 	Ø�4ð	Ýœ8¥C¨¡M¤MÑ2Ô2ˆLˆLøÝŒ}ð 	ð 	ð 	Ý&Ø: XÐ:Ð:µ°R±´Ð:Ð:ñô àðøøøøð	øøøð 	×Ò˜<¨¬Ñ3Ô3Ð3Ð3Ð3s   ®!A ÁBÁ#BÂBc                ó<   — i | _         |                      ¦   «          dS )zC
        Changes everything to default but does not write.
        N)rH   rK   rp   s    r   ÚrestoreDefaultsz _EnvironmentCore.restoreDefaultsû  s#   € ð ˆŒ	Ø×ÒÑÔÐÐÐr   c                ó>  — |€|                       ¦   «         }|�|j                             ¦   «         st          d|› �¦  «        ‚|                      ¦   «         }t          |                     ¦   «         ¦  «         |                     t          |¦  «        d¬¦  «         dS )zU
        Write the .music21rc using `.getSettingsPath` and `.toSettingsXML`.
        Nzbad file path for .music21rc: rR   )rT   )	rß   Úparentr­   r   r¿   r   rƒ   Úwritera   )r,   r¼   r†   s      r   r  z_EnvironmentCore.write  sŸ   € ð ÐØ×+Ò+Ñ-Ô-ˆHð Ð 8¤?×#9Ò#9Ñ#;Ô#;ÐÝ&Ð'RÈÐ'RÐ'RÑSÔSÐSØ×)Ò)Ñ+Ô+ˆÝ�×%Ò%Ñ'Ô'Ñ(Ô(Ð(ð
 	×Ò�3˜x™=œ=°7ÐÑ;Ô;Ð;Ð;Ð;r   r'   )rr   r¨   r©   rª   ©r0   T)r©   rà   )r   r   r   r7   r)   rn   r2   r~   r€   r�   rK   r³   r¿   rÍ   rh   rÒ   rÕ   rß   rë   rÑ   rö   rø   rL   rþ   r  r    r   r   r:   r:   ˆ   s’  € € € € € ðð ð$'ð 'ð 'ð 'ð<.ð .ð .ð`ð ð ð4#ð 4#ð 4#ðlð ð ð(&ð (&ð (&ð (&ðTc#ð c#ð c#ð c#ðJ
ð 
ð 
ð 
ð3ð 3ð 3ð 3ðn;+ð ;+ð ;+ðz!ð !ð !ð &ð &ð &ð$ð ð ð*,ð ,ð ,ð<ð ð ð ð ðB<ð <ð <ð,ð ,ð ,ð\	ð 	ð 	ð4ð 4ð 4ð 4ð(ð ð ð<ð <ð <ð <ð <ð <r   r:   )ÚinstancerG   c                 ó   — t           d         S )zX
    returns the _environStorage['instance'], _EnvironmentCore singleton
    object
    r  )Ú_environStorager    r   r   ÚenvSingletonr    s   € õ
 ˜:Ô&Ð&r   c                  óò   — e Zd ZU dZg d¢ZddiZded<   d(d„Zd	„ Zd
„ Z	d„ Z
d„ Zd„ Zd„ Zd„ Zd„ Zd„ Zed)d„¦   «         Zed*d+d„¦   «         Zd*d,d„Zd„ Zd „ Zd!„ Zej        fd"„Zd-d#„Zd$„ Zd-d%„Zd-d&„Zd'„ ZdS ).ÚEnvironmenta†  
    The environment.Environment object stores user preferences as a
    dictionary-like object.  Additionally, the Environment object provides
    convenience methods to music21 modules for getting temporary files,
    launching files with external applications, and printing debug and warning
    messages.

    Generally, each module creates a single, module-level instance of
    Environment, passing the module's name during creation. (This is an
    efficient operation since the Environment module caches most information
    from module to module)

    For a more user-friendly interface for creating and editing settings, see
    the :class:`~music21.environment.UserSettings` object.

    >>> env = environment.Environment(forcePlatform='darwin')
    >>> env['musicxmlPath'] = '/Applications/Finale Reader.app'
    >>> env['musicxmlPath']
    PosixPath('/Applications/Finale Reader.app')
    )rL   r  rß   ÚmodNameParentzt
            A string representation of the module that contains this
            Environment instance.
            zdict[str, str]Ú	_DOC_ATTRNc                ój   — || _         |t          d         k    rt          |¬¦  «        t          d<   dS dS )a[  
        Create an instance of this object, reading settings from disk.

        When created from a module, the `modName` parameter stores a string
        naming the module. This is used to identify the output of printDebug()
        calls.

        The `forcePlatform` argument can be used for testing what the
        environment settings would look like on another OS platform (e.g., win,
        nix, darwin).

        >>> myEnv = environment.Environment()
        >>> post = myEnv['writeFormat']
        >>> #_DOCS_SHOW post
        >>> print("'musicxml'") #_DOCS_HIDE
        'musicxml'
        rG   rF   r  N)r	  r  r:   )r,   ÚmodNamerG   s      r   r)   zEnvironment.__init__M  sA   € ð$ %ˆÔð �O¨OÔ<Ò<Ð<Ý*:ÈÐ*WÑ*WÔ*W�O˜JÑ'Ð'Ð'ð =Ð<r   c                óD   — t          ¦   «                              |¦  «        S r'   )r  rn   ©r,   rk   s     r   rn   zEnvironment.__getitem__h  s   € Ý‰~Œ~×)Ò)¨#Ñ.Ô.Ð.r   c                ó8   — t          t          ¦   «         ¦  «        S r'   )r3   r  rp   s    r   r2   zEnvironment.__repr__k  s   € Ý•L‘N”NÑ#Ô#Ð#r   c                óJ   — t          ¦   «                              ||¦  «         dS )a•  
        Dictionary-like setting. Changes are made only to local dictionary.

        Must call write() to make permanent:

        >>> from pathlib import Path
        >>> a = environment.Environment()
        >>> a['debug'] = 1
        >>> a['graphicsPath'] = '/test&Encode'
        >>> 'test&amp;Encode' in str(a['graphicsPath'])
        True
        >>> isinstance(a['graphicsPath'], Path)
        True

        >>> a['autoDownload'] = 'asdf'
        Traceback (most recent call last):
        music21.environment.EnvironmentException: asdf is not an acceptable
            value for preference: autoDownload

        >>> a['showFormat'] = 'asdf'
        Traceback (most recent call last):
        music21.environment.EnvironmentException: asdf is not an acceptable
            value for preference: showFormat

        >>> a['showFormat'] = 'musicxml'
        >>> a['localCorpusPath'] = '/path/to/local'
        N)r  r~   )r,   rk   rl   s      r   r~   zEnvironment.__setitem__n  s$   € õ8 	‰Œ×"Ò" 3¨Ñ.Ô.Ð.Ð.Ð.r   c                ó8   — t          t          ¦   «         ¦  «        S r'   )ra   r  rp   s    r   r€   zEnvironment.__str__Œ  s   € Ý•<‘>”>Ñ"Ô"Ð"r   c                óš   — t          ¦   «                              ¦   «         }|                      t          dt	          |¦  «        g¦  «         |S )a¢  
        Use the Python tempfile.gettempdir() to get the system specified
        temporary directory, and try to add a new 'music21' directory, and then
        return this directory.

        This method is only called if the no scratch directory preference has
        been set.

        If not able to create a 'music21' directory, the standard default is
        returned.

        Returns a pathlib.Path
        zusing temporary directory:)r  rÍ   Ú
printDebugÚ_MODra   )r,   ÚdstDirs     r   rÍ   z!Environment.getDefaultRootTempDir‘  s>   € õ ‘”×5Ò5Ñ7Ô7ˆØ�Š�Ð;½SÀ¹[¼[ÐIÑJÔJÐJØˆr   c                óB   — t          ¦   «                              ¦   «         S )a¢  
        Get the keys that refer to file paths.

        >>> a = environment.Environment()
        >>> for x in sorted(a.getKeysToPaths()):
        ...     x
        ...
        'braillePath'
        'graphicsPath'
        'lilypondPath'
        'localCorpusPath'
        'manualCoreCorpusPath'
        'midiPath'
        'musescoreDirectPNGPath'
        'musicxmlPath'
        'pdfPath'
        'vectorPath'

        )r  rh   rp   s    r   rh   zEnvironment.getKeysToPaths£  s   € õ( ‰~Œ~×,Ò,Ñ.Ô.Ð.r   c                óB   — t          ¦   «                              ¦   «         S )a1  
        Get the raw keys stored in the internal reference dictionary.

        These are different from the keys() method in that the
        'localCorpusPath' entry is not included.

        >>> a = environment.Environment()
        >>> for x in sorted(a.getRefKeys()):
        ...     x
        ...
        'autoDownload'
        'braillePath'
        'debug'
        'directoryScratch'
        'graphicsPath'
        'ipythonShowFormat'
        'lilypondBackend'
        'lilypondFormat'
        'lilypondPath'
        'lilypondVersion'
        'localCorporaSettings'
        'localCorpusSettings'
        'manualCoreCorpusPath'
        'midiPath'
        'musescoreDirectPNGPath'
        'musicxmlPath'
        'pdfPath'
        'showFormat'
        'vectorPath'
        'warnings'
        'writeFormat'
        )r  rÒ   rp   s    r   rÒ   zEnvironment.getRefKeys¹  s   € õB ‰~Œ~×(Ò(Ñ*Ô*Ð*r   c                óB   — t          ¦   «                              ¦   «         S )a  
        Return a directory for writing temporary files. This does not create a
        new directory for each use, but either uses the user-set preference or
        gets the system-provided directory (with a music21 subdirectory, if
        possible).
        )r  rÕ   rp   s    r   rÕ   zEnvironment.getRootTempDirÜ  s   € õ ‰~Œ~×,Ò,Ñ.Ô.Ð.r   c                óB   — t          ¦   «                              ¦   «         S ©zI
        Return the path to the platform specific settings file.
        )r  rß   rp   s    r   rß   zEnvironment.getSettingsPathå  s   € õ ‰~Œ~×-Ò-Ñ/Ô/Ð/r   rä   ra   rt   út.Literal[False]r©   c                ó   — d S r'   r    ©r,   rä   rt   s      r   rë   zEnvironment.getTempFileë  ó   € àˆr   r0   Tút.Literal[True]úpathlib.Pathc                ó   — d S r'   r    r  s      r   rë   zEnvironment.getTempFileï  r  r   rà   c                ó†   — t          ¦   «                              ||¬¦  «        }|                      t          d|g¦  «         |S )z¾
        Return a file path to a temporary file with the specified suffix (file
        extension).

        v5 -- added returnPathlib.
        v6 -- returnPathlib defaults to True.
        )rä   rt   ztemporary file:)r  rë   r  r  )r,   rä   rt   r¼   s       r   rë   zEnvironment.getTempFileó  s?   € õ  ‘>”>×-Ò-°VÈ=Ð-ÑYÔYˆØ�Š�Ð0°(Ð;Ñ<Ô<Ð<Øˆr   c                óB   — t          ¦   «                              ¦   «         S )aâ  
        Return valid keys to get and set values for the Environment instance.

        >>> e = environment.Environment()
        >>> for x in sorted(list(e.keys())):
        ...     x
        ...
        'autoDownload'
        'braillePath'
        'debug'
        'directoryScratch'
        'graphicsPath'
        'ipythonShowFormat'
        'lilypondBackend'
        'lilypondFormat'
        'lilypondPath'
        'lilypondVersion'
        'localCorporaSettings'
        'localCorpusPath'
        'localCorpusSettings'
        'manualCoreCorpusPath'
        'midiPath'
        'musescoreDirectPNGPath'
        'musicxmlPath'
        'pdfPath'
        'showFormat'
        'vectorPath'
        'warnings'
        'writeFormat'
        )r  rÑ   rp   s    r   rÑ   zEnvironment.keysÿ  s   € õ> ‰~Œ~×"Ò"Ñ$Ô$Ð$r   c                óD   — t          ¦   «                              |¦  «        S r'   )r  rø   ©r,   rô   s     r   rø   zEnvironment.formatToApp   ó   € Ý‰~Œ~×)Ò)¨)Ñ4Ô4Ð4r   c                óD   — t          ¦   «                              |¦  «        S r'   )r  rö   r%  s     r   rö   zEnvironment.formatToKey#  r&  r   c                ó  — t          ¦   «         d         |k    rmt          |t          ¦  «        r|g}|d         | j        k    r| j        �| j        dz   g|z   }t	          j        |Ž }t          j                             |¦  «         dS dS )zË
        Format one or more data elements into string, and print it to stderr.
        The first arg can be a list of strings or a string; lists are
        concatenated with common.formatStr().
        rV   r   Nú:)	r  r^   ra   r	  r   Ú	formatStrÚsysÚstderrr  )r,   ÚmsgÚstatusLevels      r   r  zEnvironment.printDebug&  s‘   € õ ‰>Œ>˜'Ô" kÒ1Ð1Ý˜#�sÑ#Ô#ð Ø�e�Ø�1Œv˜Ô+Ò+Ð+°Ô0BÐ0NØÔ)¨CÑ/Ð0°3Ñ6�åÔ" CÐ(ˆCÝŒJ×Ò˜SÑ!Ô!Ð!Ð!Ð!ð 2Ð1r   c                óF   — t          ¦   «                              |¬¦  «        S )a  
        Load an XML preference file if and only if the file is available
        and has been written in the past. This means that no preference file
        will ever be written unless manually done so. If no preference file
        exists, the method returns None.
        ©r¼   )r  rL   ©r,   r¼   s     r   rL   zEnvironment.read5  s   € õ ‰~Œ~×"Ò"¨HÐ"Ñ5Ô5Ð5r   c                óF   — t          ¦   «                              ¦   «          dS )a”  
        Restore only defaults for all parameters. Useful for testing.

        >>> a = environment.Environment()
        >>> a['debug'] = 1
        >>> a.restoreDefaults()
        >>> a['debug']
        0

        And we can ``read()`` the environment settings back from our
        configuration file to restore our normal working environment.

        >>> a = environment.Environment().read()
        N)r  rþ   rp   s    r   rþ   zEnvironment.restoreDefaults>  s    € õ 	‰Œ×&Ò&Ñ(Ô(Ð(Ð(Ð(r   c                óÐ  — t          |t          ¦  «        r|g}npt          |t          ¦  «        rt          |¦  «        g}nJt	          j        |¦  «        rt          |¦  «        g}n%t          |t          ¦  «        rt          |¦  «        g}|€'|d         | j        k    r| j        �| j        dz   g|z   }n|g|z   }t	          j        |Ž }t          j
                             |¦  «         dS )z�
        To print a warning to the user, send a list of strings to this method.
        Similar to printDebug but even if debug is off.
        Nr   z
: WARNING:)r^   ra   Údictr3   r   ÚisNumÚ	Exceptionr	  r*  r+  r,  r  )r,   r-  Úheaders      r   ÚwarnzEnvironment.warnO  sé   € õ
 �c�3ÑÔð 	Ø�%ˆCˆCÝ˜�TÑ"Ô"ð 	Ý˜‘9”9�+ˆCˆCÝŒ\˜#ÑÔð 	Ý�s‘8”8�*ˆCˆCÝ˜�YÑ'Ô'ð 	Ý�s‘8”8�*ˆCàˆ>Ø�1Œv˜Ô+Ò+Ð+°Ô0BÐ0NØÔ)¨LÑ8Ð9¸CÑ?�øà�(˜S‘.ˆCÝÔ Ð$ˆÝŒ
×Ò˜ÑÔÐÐÐr   c                óF   — t          ¦   «                              |¬¦  «        S )zä
        Write an XML preference file. This must be manually called to store
        any changes made to the object and access preferences later.
        If `filePath` is None, the default storage location will be used.
        r0  )r  r  r1  s     r   r  zEnvironment.writee  s   € õ ‰~Œ~×#Ò#¨XÐ#Ñ6Ô6Ð6r   c                óº   — | d         }t          j        ¦   «         r| d         }|sdS t          |¦  «                             ¦   «         }d|v rdS d|v rdS d|v rd	S d
S )a=  
        Returns an xmlReaderType depending on the 'musicxmlPath'

        >>> a = environment.Environment()
        >>> original = a['musicxmlPath']  #_DOCS_HIDE
        >>> a['musicxmlPath'] = '/Applications/Musescore.app'
        >>> a.xmlReaderType()
        'Musescore'
        >>> a['musicxmlPath'] = '/Applications/Sibelius 7.app'
        >>> a.xmlReaderType()
        'Sibelius'
        >>> a['musicxmlPath'] = r'C:\Program Files\Finale\Finale 2014.exe'
        >>> a.xmlReaderType()
        'Finale'

        Nostalgia is unknown...

        >>> a['musicxmlPath'] = r'C:\Program Files\Deluxe Music Construction Set.exe'
        >>> a.xmlReaderType()
        'unknown'

        >>> a['musicxmlPath'] = None
        >>> a.xmlReaderType() is None
        True

        >>> a['musicxmlPath'] = original  #_DOCS_HIDE
        rC   rB   NÚsibeliusÚSibeliusÚfinaleÚFinaleÚ	musescoreÚ	MusescoreÚunknown)r   ÚrunningInNotebookra   rb   )r,   Úxps     r   ÚxmlReaderTypezEnvironment.xmlReaderTypem  s}   € ð8 �.Ô!ˆÝÔ#Ñ%Ô%ð 	0ØÐ.Ô/ˆBàð 	Ø�4Ý�‰WŒW�]Š]‰_Œ_ˆØ˜ÐÐØ�:Ø˜ˆ^ˆ^Ø�8Ø˜BÐÐØ�;à�9r   )NN)rä   ra   rt   r  r©   ra   r  )rä   ra   rt   r  r©   r   )rä   ra   r©   rà   r'   )r   r   r   r7   Ú
_DOC_ORDERr
  Ú__annotations__r)   rn   r2   r~   r€   rÍ   rh   rÒ   rÕ   rß   r   rë   rÑ   rø   rö   r   rc   r  rL   rþ   r8  r  rD  r    r   r   r  r  *  sô  € € € € € € ðð ð, 6Ð5Ð5€Jð 	ð ð!€Ið ð ð ñ ðXð Xð Xð Xð6/ð /ð /ð$ð $ð $ð/ð /ð /ð<#ð #ð #ð
ð ð ð$/ð /ð /ð,!+ð !+ð !+ðF/ð /ð /ð0ð 0ð 0ð ðð ð ñ „Xðð ðð ð ð ñ „Xðð
ð 
ð 
ð 
ð 
ð%ð %ð %ðB5ð 5ð 5ð5ð 5ð 5ð +1Ô*;ð "ð "ð "ð "ð6ð 6ð 6ð 6ð)ð )ð )ð"ð ð ð ð,7ð 7ð 7ð 7ð*ð *ð *ð *ð *r   r  c                  óZ   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ ZdS )ÚUserSettingsaF  
    The UserSettings object provides a simple interface for configuring the
    user preferences in the :class:`~music21.environment.Environment` object.

    It automatically writes all changes to disk.

    First, create an instance of UserSettings:

    >>> us = environment.UserSettings()

    Second, view the available settings keys.

    >>> for key in sorted(us.keys()):
    ...     key
    'autoDownload'
    'braillePath'
    'debug'
    'directoryScratch'
    'graphicsPath'
    'ipythonShowFormat'
    'lilypondBackend'
    'lilypondFormat'
    'lilypondPath'
    'lilypondVersion'
    'localCorporaSettings'
    'localCorpusPath'
    'localCorpusSettings'
    'manualCoreCorpusPath'
    'midiPath'
    'musescoreDirectPNGPath'
    'musicxmlPath'
    'pdfPath'
    'showFormat'
    'vectorPath'
    'warnings'
    'writeFormat'

    Third, after finding the desired setting, supply the new value as a Python
    dictionary key value pair. Setting this value updates the user's settings
    file. For example, to set the file path to the Application that will be
    used to open MusicXML files, use the 'musicxmlPath' key.

    >>> #_DOCS_SHOW us['musicxmlPath'] = '/Applications/Finale Reader.app'
    >>> #_DOCS_SHOW us['musicxmlPath']
    '/Applications/Finale Reader.app'

    Note that the 'localCorpusPath' setting operates in a slightly different
    manner than other settings. Each time the 'localCorpusPath' setting is set,
    an additional local corpus file path is added to the list of local corpus
    paths (unless that path is already defined in the list of local corpus
    paths). To view all local corpus paths, access the 'localCorpusSettings'
    settings. This setting can also be used to set a complete list of file
    paths.

    >>> #_DOCS_SHOW us['localCorpusPath'] = '~/Documents'
    >>> #_DOCS_SHOW list(us['localCorpusSettings'])
    ['~/Documents']

    Alternatively, the environment.py module provides convenience functions for
    setting these settings: :func:`~music21.environment.keys`,
    :func:`~music21.environment.get`, and :func:`~music21.environment.set`.
    c                ó,   — t          ¦   «         | _        d S r'   )r  Ú_environmentrp   s    r   r)   zUserSettings.__init__ß  s   € å'™MœMˆÔÐÐr   c                ó6   — | j                              |¦  «        S r'   )rJ  rn   r  s     r   rn   zUserSettings.__getitem__å  s   € àÔ ×,Ò,¨SÑ1Ô1Ð1r   c                ó*   — t          | j        ¦  «        S ©zœ
        Return a string representation.

        >>> us = environment.UserSettings()
        >>> post = repr(us)  # location specific, cannot test
        )r3   rJ  rp   s    r   r2   zUserSettings.__repr__é  s   € õ �DÔ%Ñ&Ô&Ð&r   c                ó*   — t          | j        ¦  «        S rM  )ra   rJ  rp   s    r   r€   zUserSettings.__str__ò  s   € õ �4Ô$Ñ%Ô%Ð%r   c                óê  — || j                              ¦   «         v rl|�it          |¦  «                             d¦  «        sGt	          j        |d¬¦  «        }t          j                             |¦  «        st          d|› �¦  «        ‚n·|dk    r$t	          j
        |¦  «        st          d¦  «        ‚n�|dk    r‡t          |t          ¦  «        st          d	¦  «        ‚|ra|                     ¦   «         D ]L\  }}t          |t          ¦  «        st          d
¦  «        ‚t	          j
        |¦  «        st          d¦  «        ‚ŒM| j                              ||¦  «         | j                              ¦   «          dS )a[  
        Dictionary-like setting. Changes are made and written to the user
        configuration file.

        >>> us = environment.UserSettings()
        >>> us['musicxmlPath'] = 'asdf/asdf/asdf'
        Traceback (most recent call last):
        music21.environment.UserSettingsException: attempting to set a value
            to a path that does not exist: ...asdf

        >>> us['localCorpusPath'] = '/path/to/local'
        Traceback (most recent call last):
        music21.environment.UserSettingsException: attempting to set a value
            to a path that does not exist: ...local
        Nz/skipFrs   z9attempting to set a value to a path that does not exist: rQ   z/localCorpusSettings must be provided as a list.r‚   z0localCorporaSettings must be provided as a dict.z2Each key in localCorporaSettings must be a string.z8Each entry in localCorporaSettings must point to a list.)rJ  rh   ra   ræ   r   rx   r¬   rr   r­   r#   Ú
isListLiker^   r4  Úvaluesr~   r  )r,   rk   rl   ÚinnerKeyÚ
innerValues        r   r~   zUserSettings.__setitem__û  s¾  € ð* �$Ô#×2Ò2Ñ4Ô4Ð4Ð4àÐ ­¨U©¬×)>Ò)>¸wÑ)GÔ)GÐ ÝÔ(¨¸eÐDÑDÔD�Ý”w—~’~ eÑ,Ô,ð ]Ý/Ø[ÐTYÐ[Ð[ñ]ô ]ð ]øð Ð)Ò)Ð)ÝÔ$ UÑ+Ô+ð GÝ+ØEñGô Gð GðGð Ð*Ò*Ð*Ý˜e¥TÑ*Ô*ð HÝ+ØFñHô Hð Hàð XØ,1¯LªL©N¬Nð Xð XÑ(�H˜jÝ% hµÑ4Ô4ð RÝ3ØPñRô Rð Rå!Ô,¨ZÑ8Ô8ð XÝ3ØVñXô Xð XðXð
 	Ô×%Ò% c¨5Ñ1Ô1Ð1ØÔ×ÒÑ!Ô!Ð!Ð!Ð!r   c                ó¬   — | j                              ¦   «                              ¦   «         s| j                              ¦   «          dS t	          d¦  «        ‚)zx
        If an environment configuration file does not exist, create one based on
        the default settings.
        zNAn environment configuration file already exists; simply set values to modify.N)rJ  rß   r­   r  r#   rp   s    r   ÚcreatezUserSettings.create0  sY   € ð
 Ô ×0Ò0Ñ2Ô2×9Ò9Ñ;Ô;ð 	0ØÔ×#Ò#Ñ%Ô%Ð%Ð%Ð%å'ð/ñ0ô 0ð 0r   c                óÐ   — | j                              ¦   «                              ¦   «         r-| j                              ¦   «                              ¦   «          dS t	          d¦  «        ‚)zA
        Permanently remove the user configuration file.
        z1An environment configuration file does not exist.N)rJ  rß   r­   Úunlinkr#   rp   s    r   rå   zUserSettings.delete<  sg   € ð Ô×,Ò,Ñ.Ô.×5Ò5Ñ7Ô7ð 	EØÔ×-Ò-Ñ/Ô/×6Ò6Ñ8Ô8Ð8Ð8Ð8å'ØCñEô Eð Er   c                ó4   — | j                              ¦   «         S r  )rJ  rß   rp   s    r   rß   zUserSettings.getSettingsPathF  s   € ð Ô ×0Ò0Ñ2Ô2Ð2r   c              #  óP   K  — | j                              ¦   «         dgz   E d{V —† dS )zÞ
        Return the keys found in the user's
        :class:`~music21.environment.Environment` object.

        Changed in v9.3 -- yields a generator, like Python 3 dict -- rather than
            returning a list
        r?   N)rJ  rÒ   rp   s    r   rÑ   zUserSettings.keysL  s>   è è € ð Ô%×0Ò0Ñ2Ô2Ð6GÐ5HÑHÐIÐIÐIÐIÐIÐIÐIÐIÐIr   c              #  óP   K  — |                       ¦   «         D ]}|| |         fV — ŒdS )zX
        dict-like interface to allow iterating over items of the UserSettings.
        N)rÑ   )r,   Úks     r   rº   zUserSettings.itemsV  s@   è è € ð —’‘”ð 	ð 	ˆAØ�d˜1”g�,ÐÐÐÐð	ð 	r   c              #  óF   K  — |                       ¦   «         D ]	\  }}|V — Œ
dS )zY
        dict-like interface to allow iterating over values of the UserSettings.
        N)rº   )r,   Ú_Úvs      r   rQ  zUserSettings.values]  s8   è è € ð —J’J‘L”Lð 	ð 	‰DˆAˆqØˆGˆGˆGˆGð	ð 	r   c                ój   — | j                              ¦   «          | j                              ¦   «          dS )z5
        Restore platform specific defaults.
        N)rJ  rþ   r  rp   s    r   rþ   zUserSettings.restoreDefaultsd  s4   € ð
 	Ô×)Ò)Ñ+Ô+Ð+ØÔ×ÒÑ!Ô!Ð!Ð!Ð!r   N)r   r   r   r7   r)   rn   r2   r€   r~   rU  rå   rß   rÑ   rº   rQ  rþ   r    r   r   rH  rH  �  sÚ   € € € € € ð=ð =ðB*ð *ð *ð2ð 2ð 2ð'ð 'ð 'ð&ð &ð &ð0"ð 0"ð 0"ðj
0ð 
0ð 
0ðEð Eð Eð3ð 3ð 3ðJð Jð Jðð ð ðð ð ð"ð "ð "ð "ð "r   rH  c                 óF   — t          ¦   «         } |                      ¦   «         S )z-
    Return all valid UserSettings keys.
    )rH  rÑ   )Úuss    r   rÑ   rÑ   q  s   € õ 
‰Œ€BØ�7Š7‰9Œ9Ðr   c                óx   — t          ¦   «         }	 |                     ¦   «          n# t          $ r Y nw xY w||| <   dS )a  
    Directly set a single UserSettings key, by providing a key and the
    appropriate value. This will create a user settings file if necessary.

    >>> environment.set('wer', 'asdf')
    Traceback (most recent call last):
    music21.environment.EnvironmentException: no preference: wer

    >>> #_DOCS_SHOW environment.set('musicxmlPath', '/Applications/Finale Reader.app')
    N)rH  rU  r#   )rk   rl   ra  s      r   Úsetrc  {  sN   € õ 
‰Œ€BðØ
�	Š	‰ŒˆˆøÝ ð ð ð Øˆðøøøà€B€s�G€G€Gs   �% ¥
2±2c                ó.   — t          ¦   «         }||          S )zÏ
    Return the current setting of a UserSettings key.

    This will create a user settings file if necessary:

    >>> #_DOCS_SHOW environment.get('musicxmlPath')
    '/Applications/Finale Reader.app'
    )rH  )rk   ra  s     r   r…   r…   Ž  s   € õ 
‰Œ€BØˆcŒ7€Nr   c                  óp  — e Zd ZddlZd„ Z ej         ej        ¦   «         dk    d¦  «        d„ ¦   «         Z	 ej         ej        ¦   «         dk    d¦  «        d„ ¦   «         Z
 ej         ej        ¦   «         dk    d¦  «        d„ ¦   «         Z ej         ej        ¦   «         d	v d
¦  «        d„ ¦   «         ZdS )ÚTestr   Nc                óì   — t          |                     ¦   «         ¦  «         t          j        ¦   «         }|                     |dd¬¦  «         |                     ¦   «                              d¦  «        }|S )NrR   T)rT   Úxml_declaration)r   rƒ   ÚioÚBytesIOr  Úgetvaluer`   )r,   r†   ÚbioÚmatchs       r   ÚstringFromTreezTest.stringFromTree   sb   € Ý�×%Ò%Ñ'Ô'Ñ(Ô(Ð(ÝŒj‰lŒlˆØ×Ò˜3¨À$ÐÑGÔGÐGØ—’‘”×%Ò% gÑ.Ô.ˆØˆr   r™   ztest assumes Unix-style pathsc                ó  — t          d¬¦  «        }t          ¦   «                              ¦   «         }|                      |¦  «        }d | _        d|v rd}nd}d|z   dz   }t          j        |                     dd	¦  «        |¦  «        }|                      t          j        ||¦  «        p|¦  «         t          g d
¢¦  «        |d<   t          g d¢¦  «        }d|_
        d|_        ||d         d<   t          ¦   «                              ¦   «         }|                      |¦  «        }d|v rd}nd}d|z   dz   }t          j        |                     dd	¦  «        |¦  «        }|                      t          j        ||¦  «        p|¦  «         d S )Nrž   rF   rT   úencoding='utf-8'r0   ú<?xml version='1.0' a  ?>
<settings encoding="utf-8">
  <preference name="autoDownload" value="ask" />
  <preference name="braillePath" />
  <preference name="debug" value="0" />
  <preference name="directoryScratch" />
  <preference name="graphicsPath" value="/System/Applications/Preview.app" />
  <preference name="ipythonShowFormat" value="ipython.musicxml.png" />
  <preference name="lilypondBackend" value="ps" />
  <preference name="lilypondFormat" value="pdf" />
  <preference name="lilypondPath"
      value="/Applications/Lilypond.app/Contents/Resources/bin/lilypond" />
  <preference name="lilypondVersion" />
  <localCorporaSettings />
  <localCorpusSettings />
  <preference name="manualCoreCorpusPath" />
  <preference name="midiPath" value="/Applications/GarageBand.app" />
  <preference name="musescoreDirectPNGPath"
      value="/Applications/MuseScore 3.app/Contents/MacOS/mscore" />
  <preference name="musicxmlPath" value="/Applications/MuseScore 3.app/Contents/MacOS/mscore" />
  <preference name="pdfPath" value="/System/Applications/Preview.app" />
  <preference name="showFormat" value="musicxml" />
  <preference name="vectorPath" value="/System/Applications/Preview.app" />
  <preference name="warnings" value="1" />
  <preference name="writeFormat" value="musicxml" />
</settings>
ú/System/Applications/Previewú/Applications/Preview)ÚaÚbÚcrQ   )ÚbarÚbazÚfuzzyz/tmp/local.jsonÚfoor‚   a­  ?>
<settings encoding="utf-8">
  <preference name="autoDownload" value="ask" />
  <preference name="braillePath" />
  <preference name="debug" value="0" />
  <preference name="directoryScratch" />
  <preference name="graphicsPath" value="/System/Applications/Preview.app" />
  <preference name="ipythonShowFormat" value="ipython.musicxml.png" />
  <preference name="lilypondBackend" value="ps" />
  <preference name="lilypondFormat" value="pdf" />
  <preference name="lilypondPath"
      value="/Applications/Lilypond.app/Contents/Resources/bin/lilypond" />
  <preference name="lilypondVersion" />
  <localCorporaSettings>
    <localCorpusSettings name="foo">
      <localCorpusPath>bar</localCorpusPath>
      <localCorpusPath>baz</localCorpusPath>
      <localCorpusPath>fuzzy</localCorpusPath>
      <cacheFilePath>/tmp/local.json</cacheFilePath>
    </localCorpusSettings>
  </localCorporaSettings>
  <localCorpusSettings>
    <localCorpusPath>a</localCorpusPath>
    <localCorpusPath>b</localCorpusPath>
    <localCorpusPath>c</localCorpusPath>
  </localCorpusSettings>
  <preference name="manualCoreCorpusPath" />
  <preference name="midiPath" value="/Applications/GarageBand.app" />
  <preference name="musescoreDirectPNGPath"
      value="/Applications/MuseScore 3.app/Contents/MacOS/mscore" />
  <preference name="musicxmlPath" value="/Applications/MuseScore 3.app/Contents/MacOS/mscore" />
  <preference name="pdfPath" value="/System/Applications/Preview.app" />
  <preference name="showFormat" value="musicxml" />
  <preference name="vectorPath" value="/System/Applications/Preview.app" />
  <preference name="warnings" value="1" />
  <preference name="writeFormat" value="musicxml" />
</settings>
)r  r  r¿   rn  ÚmaxDiffr   ÚwhitespaceEqualrS   Ú
assertTruer%   r+   r*   )r,   Úenvr†   rm  ÚencÚcanonicÚtrue_but_for_preview_locationÚlcFoos           r   ÚtestToSettingszTest.testToSettings§  sÄ  € å¨Ð1Ñ1Ô1ˆÝ#‘~”~×3Ò3Ñ5Ô5ˆØ×#Ò# LÑ1Ô1ˆØˆŒØ˜ÐÐØ$ˆCˆCàˆCØ,¨sÑ2ð 6ñ ˆõ6 )/Ô(>¸w¿ºØ*Ð,Cñ@Eô @EØFKñ)Mô )MÐ%à�Š�Ô.¨w¸Ñ>Ô>Ð_ÐB_Ñ`Ô`Ð`õ &9¸¸¸Ñ%IÔ%IˆÐ!Ñ"å#Ð$;Ð$;Ð$;Ñ<Ô<ˆØ/ˆÔØˆŒ
Ø-2ˆÐ"Ô# EÑ*Ý#‘~”~×3Ò3Ñ5Ô5ˆØ×#Ò# LÑ1Ô1ˆØ˜ÐÐØ$ˆCˆCàˆCØ,¨sÑ2ð %6ñ %ˆõL )/Ô(>¸w¿ºØ*Ð,Cñ@Eô @EØFKñ)Mô )MÐ%à�Š�Ô.¨w¸Ñ>Ô>Ð_ÐB_Ñ`Ô`Ð`Ð`Ð`r   c                ó$  — t          d¬¦  «        }t          g d¢¦  «        ddœ}t          ¦   «                              |¦  «        }t          ¦   «                              |t          ¦   «         j        ¦  «         |                      t          ¦   «                              ¦   «         ¦  «        }d|v rd}nd}d	|z   d
z   }t          j        | 	                    dd¦  «        |¦  «        }|  
                    t          j        ||¦  «        p|¦  «         d S )Nrž   rF   )ÚxÚyÚzÚw)rQ   rA   rT   rp  r0   rq  a|  ?>
<settings encoding="utf-8">
  <preference name="autoDownload" value="ask" />
  <preference name="braillePath" />
  <preference name="debug" value="0" />
  <preference name="directoryScratch" />
  <preference name="graphicsPath" value="/System/Applications/Preview.app" />
  <preference name="ipythonShowFormat" value="ipython.musicxml.png" />
  <preference name="lilypondBackend" value="ps" />
  <preference name="lilypondFormat" value="pdf" />
  <preference name="lilypondPath"
      value="/Applications/Lilypond.app/Contents/Resources/bin/lilypond" />
  <preference name="lilypondVersion" />
  <localCorporaSettings />
  <localCorpusSettings>
    <localCorpusPath>x</localCorpusPath>
    <localCorpusPath>y</localCorpusPath>
    <localCorpusPath>z</localCorpusPath>
  </localCorpusSettings>
  <preference name="manualCoreCorpusPath" />
  <preference name="midiPath" value="w" />
  <preference name="musescoreDirectPNGPath"
      value="/Applications/MuseScore 3.app/Contents/MacOS/mscore" />
  <preference name="musicxmlPath" value="/Applications/MuseScore 3.app/Contents/MacOS/mscore" />
  <preference name="pdfPath" value="/System/Applications/Preview.app" />
  <preference name="showFormat" value="musicxml" />
  <preference name="vectorPath" value="/System/Applications/Preview.app" />
  <preference name="warnings" value="1" />
  <preference name="writeFormat" value="musicxml" />
</settings>
rr  rs  )r  r%   r  r¿   r�   rH   rn  r   r|  rS   r}  )r,   Ú
unused_envr‡   rˆ   rm  r  r€  r�  s           r   ÚtestFromSettingszTest.testFromSettings  s&  € õ !¨xÐ8Ñ8Ô8ˆ
õ $7°°°Ñ#GÔ#GØð
ð 
ˆõ  ‘>”>×/Ò/°Ñ4Ô4ˆõ 	‰Œ×$Ò$ XÝ%1¡^¤^Ô%8ñ	:ô 	:ð 	:ð ×#Ò#¥L¡N¤N×$@Ò$@Ñ$BÔ$BÑCÔCˆØ˜ÐÐØ$ˆCˆCàˆCØ,¨sÑ2ð 6ñ ˆõ> )/Ô(>¸w¿ºØ*Ð,Cñ@Eô @EØFKñ)Mô )MÐ%à�Š�Ô.¨w¸Ñ>Ô>Ð_ÐB_Ñ`Ô`Ð`Ð`Ð`r   c                ó  — t          d¬¦  «        }|                      |d         ¦  «         d|d<   |                      t          |d         ¦  «        dg¦  «         d|d<   |                      t          |d         ¦  «        ddg¦  «         d S )Nrž   rF   r?   z/arQ   z/b)r  ÚassertIsNoneÚassertEqualr]   )r,   r~  s     r   ÚtestEnvironmentAzTest.testEnvironmentA?  sš   € å¨Ð1Ñ1Ô1ˆð 	×Ò˜#Ð/Ô0Ñ1Ô1Ð1ð "&ˆÐÑØ×Ò�˜cÐ"7Ô8Ñ9Ô9¸D¸6ÑBÔBÐBà!%ˆÐÑØ×Ò�˜cÐ"7Ô8Ñ9Ô9¸DÀ$¸<ÑHÔHÐHÐHÐHr   rÂ   z.os.getuid can be called only on Unix platformsc                óª  — dd l }t          ¦   «         }|d         }d }d }d }	 d |d<   |                     ¦   «         }|                      ¦   «         |j                 }t	          j        ||j        ¦  «         |                     ¦   «         }|                      dt	          j        ¦   «         › �t          |¦  «        ¦  «         |�|�t	          j        ||¦  «         ||d<   |�e| 
                    t          j        ¦   «         ¦  «        }t          t	          j        |¦  «        ¦  «        dk    }|s|rt	          j        |¦  «         d S d S d S d S # |�|�t	          j        ||¦  «         ||d<   |�d| 
                    t          j        ¦   «         ¦  «        }t          t	          j        |¦  «        ¦  «        dk    }|s|rt	          j        |¦  «         w w w w xY w)Nr   r�   rÃ   )Ústatr  rÍ   ÚST_MODEr¬   ÚchmodÚS_IREADÚassertInrÉ   ra   ÚsamefilerÅ   rÆ   r   ÚlistdirÚrmdir)	r,   r�  ÚeÚoldScratchDirÚ
oldTempDirÚoldPermissionÚ
newTempDirÚtmpÚemptys	            r   ÚtestGetDefaultRootTempDirzTest.testGetDefaultRootTempDirM  s  € ð
 	ˆˆˆå‰MŒMˆØÐ,Ô-ˆØˆ
ØˆØˆ
ð!	)Ø$(ˆAÐ Ñ!Ø×0Ò0Ñ2Ô2ˆJØ&ŸOšOÑ-Ô-¨d¬lÔ;ˆMåŒH�Z ¤Ñ.Ô.Ð.Ø×0Ò0Ñ2Ô2ˆJØ�MŠMÐ9­B¬I©K¬KÐ9Ð9½3¸z¹?¼?ÑKÔKÐKð Ð%¨-Ð*Cå”˜ ]Ñ3Ô3Ð3Ø(5�Ð$Ñ%ð Ð%ð !×)Ò)­(Ô*=Ñ*?Ô*?Ñ@Ô@�Ý�BœJ zÑ2Ô2Ñ3Ô3°qÒ8�Øð )˜uð )Ý”H˜ZÑ(Ô(Ð(Ð(Ð(ð# &Ð%ð )ð )ð )ð )øð- Ð%¨-Ð*Cå”˜ ]Ñ3Ô3Ð3Ø(5�Ð$Ñ%ð Ð%ð !×)Ò)­(Ô*=Ñ*?Ô*?Ñ@Ô@�Ý�BœJ zÑ2Ô2Ñ3Ô3°qÒ8�Øð )˜uð )Ý”H˜ZÑ(Ô(Ð(Ð(ð# &ð )ð )øøøs   ¢BE
 Å
BG)r   r   r   r�  rn  ÚunittestÚskipIfr   r£   rƒ  rŠ  rŽ  Ú
skipUnlessrŸ  r    r   r   rf  rf  �  s5  € € € € € Ø€K€K€Kðð ð ð €X„_Ð'�VÔ'Ñ)Ô)¨UÒ2Ð4SÑTÔTð]að ]añ UÔTð]að~ €X„_Ð'�VÔ'Ñ)Ô)¨UÒ2Ð4SÑTÔTð5að 5añ UÔTð5aðn €X„_Ð'�VÔ'Ñ)Ô)¨UÒ2Ð4SÑTÔTðIð Iñ UÔTðIð €XÔØˆÔÑÔÐ 1Ð1Ø8ñô ð))ð ))ñ	ô ð))ð ))ð ))r   rf  Ú__main__)r   r	   ))r7   Ú
__future__r   ri  r¬   ri   r+  rÅ   r   ÚtypingÚtr   Úxml.etree.ElementTreeÚetreer¸   r¶   Úxml.saxr   rÁ   r   r   r  r   ÚMusic21Exceptionr   r#   r]   r%   r:   r  r  r  rH  rÑ   rc  r…   ÚTestCaserf  rE  r   ÚmainTestr    r   r   ú<module>r­     sÏ  ððð ð #Ð "Ð "Ð "Ð "Ð "à 	€	€	€	Ø 	€	€	€	Ø €€€Ø 
€
€
€
Ø €€€Ø €€€à Ð Ð Ð Ø Ð Ð Ð Ð Ð à "Ð "Ð "Ð "Ð "Ð "Ð "Ð "Ð "Ø Ð Ð Ð Ð Ð à  Ð  Ð  Ð  Ð  Ð  Ø Ð Ð Ð Ð Ð ð €ðð ð ð ð,	ð 	ð 	ð 	ð 	˜<Ô8ñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	Ð0ñ 	ô 	ð 	ð5Fð 5Fð 5Fð 5Fð 5F˜$ñ 5Fô 5Fð 5FðvJ
<ð J
<ð J
<ð J
<ð J
<ñ J
<ô J
<ð J
<ðh  0Ð/Ñ1Ô1ÀDÐIÐI€ð'ð 'ð 'ðmð mð mð mð mñ mô mð mðfM"ð M"ð M"ð M"ð M"ñ M"ô M"ð M"ðhð ð ðð ð ð&
ð 
ð 
ð])ð ])ð ])ð ])ð ])ˆ8Ôñ ])ô ])ð ])ðD ˜KÐ)<Ð=€
àˆzÒÐØ€N€N€Nà€GÔ�TÑÔÐÐÐð Ðr   