
    ^hk                     \    S SK r S SKJr  S SKJr  SSKJr  S rS r	S r
S r " S	 S
5      rg)    N)filterfalse   )HEREc                  P    [         R                  " [         R                  " U 6 5      $ )z!Join paths to create a real path.)ospabspathjoin)argss    O/home/james-whalen/.local/lib/python3.13/site-packages/jupyterlab/coreconfig.pypjoinr      s    ;;sxx''    c                      [        [        [        SS5      5       n [        R                  " U 5      sSSS5        $ ! , (       d  f       g= f)z"Get the data for the app template.stagingzpackage.jsonN)openr   r   jsonload)fids    r   _get_default_core_datar      s,    	eD)^4	5yy~ 
6	5	5s	   ;
A	c                 $    U R                  S5      $ )z.Whether a package name is in the lab namespacez@jupyterlab/)
startswith)names    r   _is_lab_packager      s    ??>**r   c                 (   [        U [        5      (       a7  U R                  5        VVs0 s H  u  p[        U5      (       a  M  X_M     snn$ [        U [        [
        45      (       a  [	        [        [        U 5      5      $ Sn[        U5      es  snnf )zFilter a dict/sequence to remove all lab packages

This is useful to take the default values of e.g. singletons and filter
away the '@jupyterlab/' namespace packages, but leave any others (e.g.
lumino and react).
z2collection arg should be either dict or list/tuple)
isinstancedictitemsr   listtupler   	TypeError)
collectionkvmsgs       r   _only_nonlabr$      sv     *d###-#3#3#5P#5!_Q=O#5PP	Ju	.	.K<==
>C
C.	 Qs   BBc                       \ rS rSrSrS rSS jrS rSS jr\	S 5       r
\	S 5       r\	S	 5       r\	S
 5       r\R                  S 5       rSrg)
CoreConfig*   zAn object representing a core config.

This enables custom lab application to override some parts of the core
configuration of the build system.
c                 "    [        5       U l        g )N)r   _dataselfs    r   __init__CoreConfig.__init__1   s    +-
r   c                 B   U R                   nU(       d  Sn[        U5      eU(       d  Sn[        U5      eXS   ;   a  SU< 3n[        U5      eX%S   U'   U(       a  SUS   S   U'   X%S   U'   gU(       a  SUS   S	   U'   X%S   U'   gUS   S
   R                  U5        g)a`  Remove an extension/singleton.

If neither extension or mimeExtension is True (the default)
the package is added as a singleton dependency.

name: string
    The npm package name
semver: string
    The semver range for the package
extension: bool
    Whether the package is an extension
mime_extension: bool
    Whether the package is a MIME extension
zMissing package namezMissing package semverresolutionszPackage already present:  
jupyterlabmimeExtensionsdependencies
extensionssingletonPackagesN)r)   
ValueErrorappend)r+   r   semver	extensionmime_extensiondatar#   s          r   addCoreConfig.add4   s     zz(CS/!*CS/!&&-dX6CS/!$*]D! 9;D/06)/ &57D|,T2)/ &23::4@r   c                     U R                   nUS   US   US   S   US   S   4nU H  n XA	 M     US   S   R                  U5        g! [         a     M/  f = f)zCRemove a package/extension.

name: string
    The npm package name
r3   r/   r1   r4   r2   r5   N)r)   KeyErrorremove)r+   r   r;   mapsms        r   r@   CoreConfig.removeZ   s     zz |,/0	
 AG  	\./66t<  s   A		
AAc                 >   U R                   nU(       ah  [        US   5      US'   [        US   5      US'   [        US   S   5      US   S'   [        US   S   5      US   S'   [        US   S   5      US   S'   g0 US'   0 US'   0 US   S'   0 US   S'   / US   S'   g)zClear the packages/extensions.r3   r/   r1   r4   r2   r5   N)r)   r$   )r+   lab_onlyr;   s      r   clear_packagesCoreConfig.clear_packageso   s    zz#/^0D#ED ".tM/B"CD/;D<N|<\/]D|,3?\"#344D/0 7C\"#677D23 $&D "$D/1D|,35D/068D23r   c                 b    U R                   nUS   S    Vs0 s H  o"US   U   _M     sn$ s  snf )z2A dict mapping all extension names to their semverr1   r4   r/   r)   r+   r;   r!   s      r   r4   CoreConfig.extensions   s>     zz373El3ST3Sa4&q))3STTT   ,c                 b    U R                   nUS   S    Vs0 s H  o"US   U   _M     sn$ s  snf )z7A dict mapping all MIME extension names to their semverr1   r2   r/   rI   rJ   s      r   mime_extensionsCoreConfig.mime_extensions   s?     zz373EFV3WX3Wa4&q))3WXXXrL   c                 |    U R                   nUS   S    Vs0 s H  o"US   R                  US5      _M     sn$ s  snf )z2A dict mapping all singleton names to their semverr1   r5   r/   N)r)   getrJ   s      r   
singletonsCoreConfig.singletons   sO     zz9=l9KL_9`
9`AtM"&&q$//9`
 	
 
s   9c                 &    U R                   S   S   $ Nr1   	staticDirrI   r*   s    r   
static_dirCoreConfig.static_dir   s    zz,'44r   c                 &    XR                   S   S'   g rU   rI   )r+   rW   s     r   rW   rX      s    0:

< -r   rI   N)FF)T)__name__
__module____qualname____firstlineno____doc__r,   r<   r@   rF   propertyr4   rN   rR   rW   setter__static_attributes__ r   r   r&   r&   *   s    .$AL=*9, U U
 Y Y
 
 
 5 5 ; ;r   r&   )r   os.pathpathr   	itertoolsr   jlpmappr   r   r   r   r$   r&   rb   r   r   <module>rg      s3      ! (
+
u; u;r   