§
    �Ÿj‡)  ã                   ó†  — d Z ddlZddlmZ ddlmZmZ ddlmZ ddl	m
Z
 ddlmZmZ ddlmZmZmZmZ d	Zd
ZdZdZdZdZd„ Zd„ Z G d„ de¦  «        Z G d„ de¦  «        Zi Ze                     e¦  «         e                     d¦  «         dddiidfed<   dddiidfed<    G d„ de¦  «        Z  G d„ de¦  «        Z!dS ) zx
An application for managing IPython profiles.

To be invoked as the `ipython profile` subcommand.

Authors:

* Min RK

é    N)ÚApplication)ÚBaseIPythonApplicationÚ
base_flags)Ú
ProfileDir)Úimport_item)Úget_ipython_dirÚget_ipython_package_dir)ÚUnicodeÚBoolÚDictÚobservea&  Create an IPython profile by name

Create an ipython profile directory by its name or
profile directory path. Profile directories contain
configuration, log and security related files and are named
using the convention 'profile_<name>'. By default they are
located in your ipython directory. Once created, you will
can edit the configuration files in the profile
directory to configure IPython. Most users will create a
profile directory by name,
`ipython profile create myprofile`, which will put the directory
in `<ipython_dir>/profile_myprofile`.
zêList available IPython profiles

List all available profiles, by profile location, that can
be found in the current working directly or in the ipython
directory. Profile directories are named using the convention
'profile_<profile>'.
a-  Manage IPython profiles

Profile directories contain
configuration, log and security related files and are named
using the convention 'profile_<name>'. By default they are
located in your ipython directory.  You can create profiles
with `ipython profile create <name>`, or see the profiles you
already have with `ipython profile list`

To get started configuring IPython, simply do:

$> ipython profile create

and IPython will create the default profile in <ipython_dir>/profile_default,
where you can edit ipython_config.py to start configuring IPython.

z)ipython profile list  # list all profileszé
ipython profile create foo         # create profile foo w/ default config files
ipython profile create foo --reset # restage default config files over current
ipython profile create foo --parallel # also stage parallel config files
zç
ipython profile create -h  # show the help string for the create subcommand
ipython profile list -h    # show the help string for the list subcommand

ipython locate profile foo # print the path to the directory for profile 'foo'
c                 ó   — g }t          j        | ¦  «        }|D ]d}|                     ¦   «         rN|j                             d¦  «        r4|                     |j                             dd¦  «        d         ¦  «         Œe|S )z'list profiles in a given root directoryÚprofile_Ú_é   éÿÿÿÿ)ÚosÚscandirÚis_dirÚnameÚ
startswithÚappendÚsplit)ÚpathÚprofilesÚfilesÚfs       úd/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/IPython/core/profileapp.pyÚlist_profiles_inr   a   s{   € à€Hõ ŒJ�tÑÔ€EØð 6ð 6ˆØ�8Š8‰:Œ:ð 	6˜!œ&×+Ò+¨JÑ7Ô7ð 	6Ø�OŠO˜AœFŸLšL¨¨aÑ0Ô0°Ô4Ñ5Ô5Ð5øØ€Oó    c                  ó  — t           j                             t          ¦   «         dd¦  «        } g }t          j        | ¦  «        }|D ];}|                     ¦   «         r%|j        dk    r|                     |j        ¦  «         Œ<|S )z,list profiles that are bundled with IPython.ÚcoreÚprofileÚ__pycache__)r   r   Újoinr	   r   r   r   r   )r   r   r   r#   s       r   Úlist_bundled_profilesr&   m   s}   € åŒ7�<Š<Õ/Ñ1Ô1°7¸JÑGÔG€DØ€Hõ ŒZ˜ÑÔ€EØð *ð *ˆØ�>Š>ÑÔð 	* ¤°Ò =Ð =Ø�OŠO˜GœLÑ)Ô)Ð)øØ€Or    c                   ó*   ‡ — e Zd ZdZdˆ fd„	Zd„ Zˆ xZS )ÚProfileLocatez(print the path to an IPython profile dirNc                 óŽ   •— t          t          | ¦  «                             |¦  «         | j        r| j        d         | _        d S d S ©Nr   )Úsuperr(   Úparse_command_lineÚ
extra_argsr#   ©ÚselfÚargvÚ	__class__s     €r   r,   z ProfileLocate.parse_command_line}   sG   ø€ Ý�m˜TÑ"Ô"×5Ò5°dÑ;Ô;Ð;ØŒ?ð 	.Øœ?¨1Ô-ˆDŒLˆLˆLð	.ð 	.r    c                 ó8   — t          | j        j        ¦  «         d S ©N)ÚprintÚprofile_dirÚlocation©r/   s    r   ÚstartzProfileLocate.start‚   s   € ÝˆdÔÔ'Ñ(Ô(Ð(Ð(Ð(r    r3   )Ú__name__Ú
__module__Ú__qualname__Údescriptionr,   r8   Ú__classcell__©r1   s   @r   r(   r(   z   sQ   ø€ € € € € Ø@€Kð.ð .ð .ð .ð .ð .ð
)ð )ð )ð )ð )ð )ð )r    r(   c                   óÐ   — e Zd ZdZeZeZ edddœ¦  «        Z	 e e
dddiidf¬	¦  «        ¦  «        Z e e¦   «         d
¬¦  «                             d¬¦  «        Zd„ Zd„ Zd„ ZdS )ÚProfileListúipython-profilezProfileList.ipython_dirzApplication.log_level)zipython-dirz	log-levelr   Ú	log_levelr   z6Set Application.log_level to 0, maximizing log output.)Údebuga  
        The name of the IPython directory. This directory is used for logging
        configuration (through profiles), history storage, etc. The default
        is usually $HOME/.ipython. This options can also be specified through
        the environment variable IPYTHONDIR.
        ©ÚhelpT©Úconfigc                 ó4   — |D ]}t          d|z  ¦  «         ŒdS )z!print list of profiles, indented.z    %sN)r4   )r/   r   r#   s      r   Ú_print_profileszProfileList._print_profilesŸ   s1   € àð 	&ð 	&ˆGÝ�(˜WÑ$Ñ%Ô%Ð%Ð%ð	&ð 	&r    c                 ó¢  — t          ¦   «         }|rut          ¦   «          t          d¦  «         |                      |¦  «         t          ¦   «          t          d¦  «         t          d| j        z  ¦  «         t          d¦  «         t	          | j        ¦  «        }|r:t          ¦   «          t          d| j        z  ¦  «         |                      |¦  «         t	          t          j        ¦   «         ¦  «        }|rt          ¦   «          t          d¦  «         t          ¦   «          t          d¦  «         t          d¦  «         t          ¦   «          d S )	NzAvailable profiles in IPython:z8    The first request for a bundled profile will copy itz%    into your IPython directory (%s),z    where you can customize it.zAvailable profiles in %s:zLProfiles from CWD have been removed for security reason, see CVE-2022-21699:z5To use any of the above profiles, start IPython with:z    ipython --profile=<name>)r&   r4   rI   Úipython_dirr   r   Úgetcwd)r/   r   s     r   Úlist_profile_dirszProfileList.list_profile_dirs¤   s:  € Ý(Ñ*Ô*ˆØð 	5Ý‰GŒGˆGÝÐ2Ñ3Ô3Ð3Ø× Ò  Ñ*Ô*Ð*Ý‰GŒGˆGÝÐLÑMÔMÐMÝÐ9¸DÔ<LÑLÑMÔMÐMÝÐ3Ñ4Ô4Ð4å# DÔ$4Ñ5Ô5ˆØð 	+Ý‰GŒGˆGÝÐ-°Ô0@Ñ@ÑAÔAÐAØ× Ò  Ñ*Ô*Ð*å#¥B¤I¡K¤KÑ0Ô0ˆØð 	Ý‰GŒGˆGÝØ^ñô ð õ 	‰ŒˆÝÐEÑFÔFÐFÝÐ,Ñ-Ô-Ð-Ý‰Œˆˆˆr    c                 ó.   — |                       ¦   «          d S r3   )rM   r7   s    r   r8   zProfileList.startÁ   s   € Ø×ÒÑ Ô Ð Ð Ð r    N)r9   r:   r;   r   Ú	list_helpr<   Ú_list_examplesÚexamplesr   ÚaliasesÚdictÚflagsr
   r   ÚtagrK   rI   rM   r8   © r    r   r@   r@   †   sç   € € € € € Ø€DØ€KØ€HàˆdØ1Ø-ðð ñ ô €Gð ˆD��Ø ;°Ð"3Ð4ØDð
ðñ ô ñ ô €Eð �'˜/˜/Ñ+Ô+ððñ ô ÷ 
‚c�€cÑÔð ð&ð &ð &ð
ð ð ð:!ð !ð !ð !ð !r    r@   ÚinitÚProfileCreateÚ	overwriteTz3reset config files in this profile to the defaults.ÚresetÚparallelzSInclude the config files for parallel computing apps (ipengine, ipcontroller, etc.)c                   óè   ‡ — e Zd ZdZeZeZ ed¦  «        Z	d„ Z
d„ Z edd¬¦  «                             d¬¦  «        Z ed	¦  «        d
„ ¦   «         Zˆ fd„Z ee¦  «        ZegZd„ Zˆ fd„Zd„ Zˆ xZS )rX   rA   Tc                 ó   — dS )Nz[%(name)s] %(message)srV   r7   s    r   Ú_log_format_defaultz!ProfileCreate._log_format_defaultÕ   s   € Ø'Ð'r    c                 ó   — dS )NTrV   r7   s    r   Ú_copy_config_files_defaultz(ProfileCreate._copy_config_files_defaultØ   s   € Øˆtr    Fz2whether to include parallel computing config filesrD   rF   r[   c                 ó°   — g d¢}|d         r!|D ]}| j                              |¦  «         Œd S |D ]%}|| j         v r| j                              |¦  «         Œ&d S )N)zipcontroller_config.pyzipengine_config.pyzipcluster_config.pyÚnew)Úconfig_filesr   Úremove)r/   ÚchangeÚparallel_filesÚcfs       r   Ú_parallel_changedzProfileCreate._parallel_changedß   s•   € ðð ð ˆð �%Œ=ð 	1Ø$ð -ð -�ØÔ!×(Ò(¨Ñ,Ô,Ð,Ð,ð-ð -ð %ð 1ð 1�Ø˜Ô*Ð*Ð*ØÔ%×,Ò,¨RÑ0Ô0Ð0øð1ð 1r    c                 óŽ   •— t          t          | ¦  «                             |¦  «         | j        r| j        d         | _        d S d S r*   )r+   rX   r,   r-   r#   r.   s     €r   r,   z ProfileCreate.parse_command_lineí   sG   ø€ Ý�m˜TÑ"Ô"×5Ò5°dÑ;Ô;Ð;àŒ?ð 	.Øœ?¨1Ô-ˆDŒLˆLˆLð	.ð 	.r    c                 ó
  — d}|                      dd¦  «        d         }	 t          |¦  «        }nS# t          $ r | j                             d|¦  «         Y n,t
          $ r  | j                             d|d¬¦  «         Y nw xY w|S )	zimport an app classNú.r   r   z0Couldn't import %s, config file will be excludedzUnexpected error importing %sT)Úexc_info)Úrsplitr   ÚImportErrorÚlogÚinfoÚ	ExceptionÚwarning)r/   Úapp_pathÚappr   s       r   Ú_import_appzProfileCreate._import_app÷   s®   € àˆØ�Š˜s AÑ&Ô& rÔ*ˆð	SÝ˜hÑ'Ô'ˆCˆCøÝð 	Tð 	Tð 	TØŒH�MŠMÐLÈdÑSÔSÐSÐSÐSÝð 	Sð 	Sð 	SØŒH×ÒÐ<¸dÈTÐÑRÔRÐRÐRÐRð	Søøøàˆ
s    0 °%B Á&B Á?B c                 ó  •— t          t          | ¦  «                             ¦   «          ddlm} |g}dD ].}|                      |¦  «        }|�|                     |¦  «         Œ/| j        r*ddlm	} ddl
m} ddlm} |                     |||g¦  «         |D ]v} |¦   «         }|j                             | j        ¦  «         | j        |_        | j        |_        d|_        | j        |_        | j        |_        |                     ¦   «          Œwd S )Nr   )ÚTerminalIPythonApp)zipykernel.kernelapp.IPKernelApp)ÚIPControllerApp)ÚIPEngineApp)ÚIPClusterStartT)r+   rX   Úinit_config_filesÚIPython.terminal.ipapprw   ru   r   r[   Ú ipyparallel.apps.ipcontrollerapprx   Úipyparallel.apps.ipengineappry   Úipyparallel.apps.ipclusterapprz   ÚextendrG   Úupdatero   rY   Úcopy_config_filesrK   r5   )
r/   rw   Úappsrs   rt   rx   ry   rz   ÚAppr1   s
            €r   r{   zProfileCreate.init_config_files  s\  ø€ Ý�m˜TÑ"Ô"×4Ò4Ñ6Ô6Ð6à=Ð=Ð=Ð=Ð=Ð=Ø"Ð#ˆð
ð 	!ð 	!ˆHð ×"Ò" 8Ñ,Ô,ˆCØˆØ—’˜CÑ Ô Ð øØŒ=ð 	ØHÐHÐHÐHÐHÐHØ@Ð@Ð@Ð@Ð@Ð@ØDÐDÐDÐDÐDÐDØ�KŠKØØØðñ ô ð ð
 ð 	$ð 	$ˆCØ�#‘%”%ˆCØŒJ×Ò˜dœkÑ*Ô*Ð*Ø”hˆCŒGØ œNˆCŒMØ"&ˆCÔ!Ø Ô,ˆCŒOØ Ô,ˆCŒOØ×!Ò!Ñ#Ô#Ð#Ð#ð	$ð 	$r    c                 ó   — d S r3   rV   r7   s    r   Ústage_default_config_filez'ProfileCreate.stage_default_config_file!  s   € Øˆr    )r9   r:   r;   r   Úcreate_helpr<   Ú_create_examplesrQ   r   Úauto_creater^   r`   rU   r[   r   rh   r,   r   Úcreate_flagsrT   r   Úclassesru   r{   r†   r=   r>   s   @r   rX   rX   Ð   s  ø€ € € € € Ø€DØ€KØ€HØ�$�t‘*”*€Kð(ð (ð (ðð ð ð ˆt�EØAðñ ô ç	‚c�€cÑÔð ð €WˆZÑÔð1ð 1ñ Ôð1ð.ð .ð .ð .ð .ð ˆD�ÑÔ€Eàˆl€Gð
ð 
ð 
ð$ð $ð $ð $ð $ð<ð ð ð ð ð ð r    c            	       ó  — e Zd ZdZeZeZ e e	e
e
j                             ¦   «         d         feej                             ¦   «         d         feej                             ¦   «         d         f¬¦  «        ¦  «        Zd„ ZdS )Ú
ProfileAppzipython profiler   )ÚcreateÚlistÚlocatec                 ó.  — | j         €vt          d| j                             ¦   «         z  ¦  «         t          ¦   «          |                      ¦   «          |                      ¦   «          |                      d¦  «         d S | j                              ¦   «         S )Nz0No subcommand specified. Must specify one of: %sr   )Úsubappr4   ÚsubcommandsÚkeysÚprint_descriptionÚprint_subcommandsÚexitr8   r7   s    r   r8   zProfileApp.start0  s�   € ØŒ;ÐÝÐDÀdÔFV×F[ÒF[ÑF]ÔF]Ñ^Ñ_Ô_Ð_Ý‰GŒGˆGØ×"Ò"Ñ$Ô$Ð$Ø×"Ò"Ñ$Ô$Ð$Ø�IŠI�a‰LŒLˆLˆLˆLà”;×$Ò$Ñ&Ô&Ð&r    N)r9   r:   r;   r   Úprofile_helpr<   Ú_main_examplesrQ   r   rS   rX   Ú
splitlinesr@   r(   r“   r8   rV   r    r   r�   r�   %  sª   € € € € € Ø€DØ€KØ€Hà�$�t�tØ Ô!:×!EÒ!EÑ!GÔ!GÈÔ!JÐKØ˜[Ô4×?Ò?ÑAÔAÀ!ÔDÐEØ Ô!:×!EÒ!EÑ!GÔ!GÈÔ!JÐKðñ ô ñ ô €Kð'ð 'ð 'ð 'ð 'r    r�   )"Ú__doc__r   Útraitlets.config.applicationr   ÚIPython.core.applicationr   r   ÚIPython.core.profiledirr   ÚIPython.utils.importstringr   ÚIPython.pathsr   r	   Ú	traitletsr
   r   r   r   r‡   rO   r˜   rP   rˆ   r™   r   r&   r(   r@   rŠ   r�   ÚpoprX   r�   rV   r    r   ú<module>r£      s)  ðð	ð 	ð, 
€	€	€	à 4Ð 4Ð 4Ð 4Ð 4Ð 4ðð ð ð ð ð ð ð ð /Ð .Ð .Ð .Ð .Ð .Ø 2Ð 2Ð 2Ð 2Ð 2Ð 2Ø BÐ BÐ BÐ BÐ BÐ BÐ BÐ BØ 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2ð€ð€	ð€ð$ =€ðÐ ð€ð	ð 	ð 	ð
ð 
ð 
ð	)ð 	)ð 	)ð 	)ð 	)Ð*ñ 	)ô 	)ð 	)ð<!ð <!ð <!ð <!ð <!�+ñ <!ô <!ð <!ð~ €Ø × Ò �JÑ Ô Ð à × Ò �Ñ Ô Ð Ø)¨K¸$Ð+?Ð@ØMðO€ˆWÑ à,¨z¸DÐ.AÐBðHðI€ˆZÑ ð
Rð Rð Rð Rð RÐ*ñ Rô Rð Rðj'ð 'ð 'ð 'ð '�ñ 'ô 'ð 'ð 'ð 'r    