§
    ƒØjÄ  ã                  óŒ  — d dl mZ g d¢Zd dlZd dlmZ d dlZd dlZd dlZd dl	Z	 ej
        deej        z  ¬¦  «        Zd$d	„Zd$d
„Zd$d„Zd%d„Zd$d„Zd&d'd„Zeddœd(d„¦   «         Zeddœd)d„¦   «         Zed*d„¦   «         Zed+d„¦   «         Zddœd,d „Z G d!„ d"e	j        ¦  «        Zed#k    rd dlZ ej        e¦  «         dS dS )-é    )Úannotations)ÚgetRootFilePathÚgetSourceFilePathÚgetMetadataCacheFilePathÚgetCorpusFilePathÚgetCorpusContentDirsÚrelativepathÚ	cleanpathN)ÚoverloadÚ	StrOrPath)ÚboundÚreturnúpathlib.Pathc                 óü   — t          j        t          j        t          ¦  «        ¦  «                             ¦   «         } | j        j        }dd„ |                     ¦   «         D ¦   «         vrt          d|› �¦  «        ‚|S )z¡
    Get the music21 directory that contains source files such as note.py, etc.
    This is not the same as the
    outermost package development directory.
    Ústreamc                ó   — g | ]	}|j         ‘Œ
S © )Úname)Ú.0Úxs     ú�/Users/tedpeters/Documents/Projects/Claude Projects/Misc Tools/notename-sheets/.venv/lib/python3.11/site-packages/music21/common/pathTools.pyú
<listcomp>z%getSourceFilePath.<locals>.<listcomp>*   s   € Ð<Ð<Ð< 1˜œÐ<Ð<Ð<ó    z(cannot find expected music21 directory: )	ÚpathlibÚPathÚinspectÚgetfiler   ÚresolveÚparentÚiterdirÚFileNotFoundError)ÚfpThisÚ	fpMusic21s     r   r   r   !   s   € õ Œ\�'œ/Õ*;Ñ<Ô<Ñ=Ô=×EÒEÑGÔG€FØ”Ô$€IàÐ<Ð<¨	×(9Ò(9Ñ(;Ô(;Ð<Ñ<Ô<Ð<Ð<ÝØB°yÐBÐBñ
ô 
ð 	
ð Ðr   c                 ó*   — t          ¦   «         dz  dz  S )zÏ
    Get the stored music21 directory that contains the corpus metadata cache.

    >>> fp = common.getMetadataCacheFilePath()
    >>> fp.name == '_metadataCache' and fp.parent.name == 'corpus'
    True
    ÚcorpusÚ_metadataCache)r   r   r   r   r   r   1   s   € õ ÑÔ Ñ)Ð,<Ñ<Ð<r   c                 ó¢   — ddl m}  | j                             ¦   «         }|j        €t          ¦   «         dz  S t          j        |j        ¦  «        S )zÁ
    Get the stored music21 directory that contains the corpus metadata cache.

    >>> fp = common.getCorpusFilePath()
    >>> fp.name == 'corpus' and fp.parent.name == 'music21'
    True
    r   )r%   Nr%   )Úmusic21r%   ÚcorporaÚ
CoreCorpusÚmanualCoreCorpusPathr   r   r   )r%   Ú
coreCorpuss     r   r   r   <   sV   € ð ÐÐÐÐÐØ”×*Ò*Ñ,Ô,€JØÔ&Ð.Ý Ñ"Ô" XÑ-Ð-ÝŒ<˜
Ô7Ñ8Ô8Ð8r   ú	list[str]c                 ó  — t          ¦   «         } g }d}t          t          j        | ¦  «        ¦  «        D ]H}|                     d¦  «        rŒ|                     d¦  «        rŒ.||v rŒ3|                     |¦  «         ŒIt          |¦  «        S )a"  
    Get all dirs that are found in the CoreCorpus that contain content;
    that is, exclude dirs that have code or other resources.

    >>> fp = common.getCorpusContentDirs()
    >>> fp  # this list will be fragile, depending on composition of dirs
    ['airdsAirs', 'bach', 'beach', 'beethoven', 'chopin',
     'ciconia', 'corelli', 'cpebach',
     'demos', 'essenFolksong', 'handel', 'haydn', 'johnson_j_r', 'joplin', 'josquin',
     'leadSheet', 'liliuokalani', 'luca', 'lusitano',
     'miscFolk', 'monteverdi', 'mozart',
     'nottingham-dataset',
     'oneills1850', 'palestrina',
     'ryansMammoth', 'schoenberg', 'schubert', 'schumann_clara', 'schumann_robert',
     'theoryExercises', 'trecento', 'verdi', 'weber', 'webern']

    Make sure that all corpus data has a directoryInformation tag in
    CoreCorpus.

    >>> cc = corpus.corpora.CoreCorpus()
    >>> failed = []
    >>> di = [d.directoryName for d in cc.directoryInformation]
    >>> for f in fp:
    ...     if f not in di:
    ...         failed.append(f)
    >>> failed
    []
    )zlicense.txtr&   Ú__pycache__)z.pyz.pycú.)r   ÚsortedÚosÚlistdirÚendswithÚ
startswithÚappend)ÚdirectoryNameÚresultÚexcludedNamesÚfilenames       r   r   r   K   sŸ   € õ: &Ñ'Ô'€MØ€Fð€Mõ �2œ: mÑ4Ô4Ñ5Ô5ð  ð  ˆØ×Ò˜_Ñ-Ô-ð 	ØØ× Ò  Ñ%Ô%ð 	ØØ˜Ð&Ð&ØØ�Š�hÑÔÐÐÝ�&‰>Œ>Ðr   c                 ó0   — t          ¦   «         } | j        }|S )a  
    Return the root directory for music21 -- outside the music21 namespace
    which has directories such as "dist", "documentation", "music21"

    >>> fp = common.getRootFilePath()
    >>> #_DOCS_SHOW fp
    PosixPath('/Users/florencePrice/git/music21')
    )r   r   )r#   ÚfpParents     r   r   r   |   s   € õ "Ñ#Ô#€IØÔ€Hà€Or   ÚpathÚstartú
str | NoneúStrOrPath | strc                óZ   — ddl }|dk    r| S t          j                             | |¦  «        S )a  
    A cross-platform wrapper for `os.path.relpath()`, which returns `path` if
    under Windows, otherwise returns the relative path of `path`.

    This avoids problems under Windows when the current working directory is
    on a different drive letter from `path`.
    r   NÚWindows)Úplatformr2   r=   Úrelpath)r=   r>   rC   s      r   r	   r	   ‹   s3   € ð €O€O€OØ�9ÒÐØˆÝŒ7�?Š?˜4 Ñ'Ô'Ð'r   )ÚreturnPathlibrE   út.Literal[None]c               ó   — d S ©Nr   ©r=   rE   s     r   r
   r
   ™   ó	   € ð €Cr   Ústrc               ó   — d S rH   r   rI   s     r   r
   r
   ž   rJ   r   ústr | pathlib.Pathút.Literal[True]c               ó   — d S rH   r   rI   s     r   r
   r
   £   rJ   r   út.Literal[False]c               ó   — d S rH   r   rI   s     r   r
   r
   ¨   rJ   r   úbool | Nonec               óÌ  — t          | t          j        ¦  «        rt          | ¦  «        } |€d}n|€d}t          j                             | ¦  «        } t          j                             | ¦  «        } t          j                             | ¦  «        st          j         	                    | ¦  «        } t          j         
                    | ¦  «        } |s| S t          j        | ¦  «        S )a¸  
    Normalizes the path by expanding ~user on Unix, ${var} environmental vars
    (is this a good idea?), expanding %name% on Windows, normalizing path names
    (Windows turns backslashes to forward slashes), and finally if that file
    is not an absolute path, turns it from a relative path to an absolute path.

    v5 -- returnPathlib -- None (default) does not convert. False, returns a string,
    True, returns a pathlib.Path.
    NTF)Ú
isinstancer   r   rK   r2   r=   Ú
expanduserÚnormpathÚisabsÚabspathÚ
expandvarsrI   s     r   r
   r
   ­   s¿   € õ �$�œÑ%Ô%ð Ý�4‰yŒyˆØÐ Ø ˆMøØ	Ð	ØˆÝŒ7×Ò˜dÑ#Ô#€DÝŒ7×Ò˜DÑ!Ô!€DÝŒ7�=Š=˜ÑÔð %ÝŒw�Š˜tÑ$Ô$ˆåŒ7×Ò˜dÑ#Ô#€DØð "ØˆåŒ|˜DÑ!Ô!Ð!r   c                  ó   — e Zd Zd„ ZdS )ÚTestc                ób   — t          ¦   «         }|                      |t          j        ¦  «         d S rH   )r   ÚassertIsInstancer   r   )ÚselfÚfps     r   ÚtestGetSourcePathzTest.testGetSourcePathË   s+   € ÝÑ Ô ˆØ×Ò˜b¥'¤,Ñ/Ô/Ð/Ð/Ð/r   N)Ú__name__Ú
__module__Ú__qualname__r`   r   r   r   r[   r[   Ê   s#   € € € € € ð0ð 0ð 0ð 0ð 0r   r[   Ú__main__)r   r   )r   r-   rH   )r=   r   r>   r?   r   r@   )r=   r   rE   rF   r   r   )r=   rK   rE   rF   r   rK   )r=   rM   rE   rN   r   r   )r=   rM   rE   rP   r   rK   )r=   rM   rE   rR   r   rM   )Ú
__future__r   Ú__all__ÚtypingÚtr   r   r2   r   ÚunittestÚTypeVarrK   r   r   r   r   r   r   r   r	   r
   ÚTestCaser[   ra   r(   ÚmainTestr   r   r   ú<module>rm      s*  ðð #Ð "Ð "Ð "Ð "Ð "ðð ð €ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø €€€Ø 	€	€	€	Ø €€€Ø €€€àˆAŒI�k¨¨W¬\Ñ)9Ð:Ñ:Ô:€	ðð ð ð ð =ð =ð =ð =ð9ð 9ð 9ð 9ð.ð .ð .ð .ðbð ð ð ð(ð (ð (ð (ð (ð 
à/3ðð ð ð ð ñ 
„ðð 
à/3ðð ð ð ð ñ 
„ðð 
ðð ð ñ 
„ðð 
ðð ð ñ 
„ðð
 *.ð"ð "ð "ð "ð "ð "ð:0ð 0ð 0ð 0ð 0ˆ8Ôñ 0ô 0ð 0ð ˆzÒÐØ€N€N€NØ€GÔ�TÑÔÐÐÐð Ðr   