
    rhy                       % S r SSKJr  SSKrSSKJr  SSKJr  \R                  " S5      r " S S5      r	 " S	 S
\	5      r
 " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\R&                  5      r " S S\R&                  5      r/ rS\S '   \S!:X  a  SSKr\R2                  " \5        gg)"a  
The virtual.py module is a library of references to remotely stored music data files,
as well as metadata necessary to download and, if available, access an already downloaded file.

This is probably not the best way to handle this -- instead it should be a link to
a directory or listing of files and repositories, each handled as a different Corpus.

TURNED OFF in 2017 -- to be recreated with a bigger test set.

TODO: Demonstrate with JRP.
    )annotationsN)common)environmentzcorpus.virtualc                  $    \ rS rSrS rSS jrSrg)VirtualWork    c                <    S U l         S U l        S U l        / U l        g N)composertitle
corpusPathurlList)selfs    P/home/james-whalen/.local/lib/python3.13/site-packages/music21/corpus/virtual.py__init__VirtualWork.__init__!   s"    
      Nc                   [         R                  " U5      (       d  U/nUb  US/:X  a  U R                  S   /$ / nU HF  nU R                   H3  n[         R                  " U5      u  pVXc:X  d  M"  UR	                  U5        M5     MH     U$ )z
Given a request for an extension, find the best match for a URL from
the list of known URLs. If ext is None, return the first URL.
Nr   )r   
isListLiker   findFormatExtURLappend)r   extListpostexturlunused_formatextFounds          r   getUrlByExtVirtualWork.getUrlByExt8   s    
   ))iG?g$/LLO$$C||*0*A*A#*F'?KK$	 $  r   )r   r   r   r   r
   )__name__
__module____qualname____firstlineno__r   r   __static_attributes__ r   r   r   r       s    
.r   r   c                  ,   ^  \ rS rSrSrU 4S jrSrU =r$ )BachBWV1007PreludeO   z

>>> a = corpus.virtual.BachBWV1007Prelude()
>>> a.getUrlByExt('.xml')
['https://kern.ccarh.org/cgi-bin/ksdata?l=cc/bach/cello&file=bwv1007-01.krn&f=xml']
c                   > [         TU ]  5         SU l        SU l        SU l        SnU R
                  R                  US-   5        U R
                  R                  US-   5        g )NJohann Sebastian Bachz3Prelude from Cello Suite No. 1 in G Major, BWV 1007zbach/bwv1007/preludez5https://kern.ccarh.org/cgi-bin/ksdata?l=cc/bach/celloz&file=bwv1007-01.krn&f=xmlz&file=bwv1007-01.krn&f=kernsuperr   r   r   r   r   r   )r   cello	__class__s     r   r   BachBWV1007Prelude.__init__W   sX    /J
0GE$@@AE$AABr   r   r   r   )r    r!   r"   r#   __doc__r   r$   __classcell__r.   s   @r   r'   r'   O   s    C Cr   r'   c                  (   ^  \ rS rSrU 4S jrSrU =r$ )
BachBWV772b   c                   > [         TU ]  5         SU l        SU l        SU l        SnU R
                  R                  US-   5        g )Nr*   z#Invention No. 1 in C Major, BWV 772zbach/bwv772Ehttps://kern.ccarh.org/cgi-bin/ksdata?l=osu/classical/bach/inventionsz&file=inven01.krn&f=xmlr+   r   	inventionr.   s     r   r   BachBWV772.__init__c   s@    /:
'[	I(AABr   r0   r    r!   r"   r#   r   r$   r2   r3   s   @r   r5   r5   b   s    C Cr   r5   c                  (   ^  \ rS rSrU 4S jrSrU =r$ )
BachBWV773m   c                   > [         TU ]  5         SU l        SU l        SU l        SnU R
                  R                  US-   5        U R
                  R                  US-   5        g )Nr*   z#Invention No. 2 in C Minor, BWV 773zbach/bwv773r8   z&file=inven02.krn&f=xmlz&file=inven02.krn&f=kernr+   r9   s     r   r   BachBWV773.__init__n   sX    /:
'[	I(AABI(BBCr   r0   r<   r3   s   @r   r>   r>   m   s    D Dr   r>   c                  (   ^  \ rS rSrU 4S jrSrU =r$ )ColtraneGiantStepsy   c                   > [         TU ]  5         SU l        SU l        SU l        U R
                  R                  S5        g )NzJohn ColtranezGiant Stepszcoltrane/giantStepsz^http://impromastering.com/uploads/transcription_file/file/196/Giant_Steps__John_Coltrane_C.xmlr+   r   r.   s    r   r   ColtraneGiantSteps.__init__{   s;    '"
/ ? 	@r   r0   r<   r3   s   @r   rC   rC   y   s    @ @r   rC   c                  (   ^  \ rS rSrU 4S jrSrU =r$ )SchubertD576   c                   > [         TU ]  5         SU l        SU l        SU l        U R
                  R                  S5        g )NFranz Schubert1   13 Variations on a Theme by Anselm Hüttenbrennerzschubert/d576-1zWhttps://kern.ccarh.org/cgi-bin/ksdata?l=cc/schubert/piano/d0576&file=d0576-06.krn&f=xmlr+   rF   s    r   r   SchubertD576.__init__   s:    (H
+ < 	=r   r0   r<   r3   s   @r   rI   rI      s    = =r   rI   c                  (   ^  \ rS rSrU 4S jrSrU =r$ )SchubertD5762   c                   > [         TU ]  5         SU l        SU l        SU l        U R
                  R                  S5        g )NrL   rM   zschubert/d576-2zjhttps://kern.ccarh.org/cgi-bin/ksdata?l=users/craig/classical/schubert/piano/d0576&file=d0576-02.krn&f=xmlr+   rF   s    r   r   SchubertD5762.__init__   s<    (H
+ [ 	\r   r0   r<   r3   s   @r   rP   rP      s    \ \r   rP   c                  (   ^  \ rS rSrU 4S jrSrU =r$ )SchubertD5763   c                   > [         TU ]  5         SU l        SU l        SU l        U R
                  R                  S5        g )NrL   rM   zschubert/d576-3zjhttps://kern.ccarh.org/cgi-bin/ksdata?l=users/craig/classical/schubert/piano/d0576&file=d0576-03.krn&f=xmlr+   rF   s    r   r   SchubertD5763.__init__   <    (H
+ K 	Lr   r0   r<   r3   s   @r   rU   rU          L Lr   rU   c                  (   ^  \ rS rSrU 4S jrSrU =r$ )SchubertD5764   c                   > [         TU ]  5         SU l        SU l        SU l        U R
                  R                  S5        g )NrL   rM   zschubert/d576-4zjhttps://kern.ccarh.org/cgi-bin/ksdata?l=users/craig/classical/schubert/piano/d0576&file=d0576-04.krn&f=xmlr+   rF   s    r   r   SchubertD5764.__init__   rY   r   r0   r<   r3   s   @r   r\   r\      rZ   r   r\   c                  (   ^  \ rS rSrU 4S jrSrU =r$ )PachelbelCanonD   c                   > [         TU ]  5         SU l        SU l        SU l        U R
                  R                  S5        g )NzJohann PachelbelzCanon in D Majorzpachelbel/canonzIhttps://kern.ccarh.org/cgi-bin/ksdata?l=cc/pachelbel&file=canon.krn&f=xmlr+   rF   s    r   r   PachelbelCanonD.__init__   s:    *'
+ = 	>r   r0   r<   r3   s   @r   ra   ra      s    > >r   ra   c                      \ rS rSrSrg)TestExternal   r%   N)r    r!   r"   r#   r$   r%   r   r   rf   rf      s    r   rf   c                      \ rS rSrS rSrg)Test   c                @   [        5       nU R                  UR                  S/5      / 5        U R                  UR                  S/5      / 5        [        5         [	        5         [        5         [        5         [        5         [        5         [        5         [        5         g)zE
Test instantiating all objects defined in the virtual corpus module
z.xmlz.krnN)r'   assertNotEqualr   r5   r>   rC   rI   rP   rU   r\   ra   )r   as     r   	testBasicTest.testBasic   sl      AMM6(3R8AMM6(3R8r   r%   N)r    r!   r"   r#   rn   r$   r%   r   r   ri   ri      s    r   ri   z
list[type]
_DOC_ORDER__main__)r1   
__future__r   unittestmusic21r   r   EnvironmentenvironLocalr   r'   r5   r>   rC   rI   rP   rU   r\   ra   TestCaserf   ri   rp   __annotations__r    mainTestr%   r   r   <module>rz      s   
 #   &&'78) )^C C&C C	D 	D	@ 	@=; =\K \LK LLK L>k >	8$$ 	
8 * 
J zT r   