403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.52
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/IPython/core/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/IPython/core/__pycache__/profiledir.cpython-312.pyc
�

}�e]���dZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZddl
mZmZmZGd	�d
e�ZGd�de�Zy)
z3An object for managing IPython profile directories.�N)�Path)�LoggingConfigurable�)�get_ipython_package_dir)�expand_path�ensure_dir_exists)�Unicode�Bool�observec��eZdZy)�ProfileDirErrorN)�__name__�
__module__�__qualname__���9/usr/lib/python3/dist-packages/IPython/core/profiledir.pyr
r
s��rr
c���eZdZdZed�Zed�Zed�Zed�Zed�Z	ed�Z
ed�Zed�Zed�Z
ed�Zedd�	�jd
��Zed�Zed
�d��Zd"d�Zed�d"d��Zed�d"d��Zed�d"d��Zed�d"d��Zd�Zd#dededefd�Zed"d��Z ed$d��Z!ed$d ��Z"ed"d!��Z#y)%�
ProfileDira@An object to manage the profile directory and its resources.

    The profile directory is used by all IPython applications, to manage
    configuration, logging and security.

    This object knows how to find, create and manage these directories. This
    should be used by any code that wants to handle profiles.
    �security�log�startup�pid�static�zaSet the profile location directly. This overrides the logic used by the
        `profile` option.)�helpT)�configF�locationc�V�|jrtd��d|_|d}t|�tjj||j�|_tjj||j�|_	tjj||j�|_tjj||j�|_
tjj||j�|_|j!�y)Nz+Cannot set profile location more than once.T�new)�_location_isset�RuntimeErrorr�os�path�join�security_dir_name�security_dir�log_dir_name�log_dir�startup_dir_name�startup_dir�pid_dir_name�pid_dir�static_dir_name�
static_dir�
check_dirs)�self�changer s   r�_location_changedzProfileDir._location_changed8s�������L�M�M�#����U�m���#���G�G�L�L��d�.D�.D�E����w�w�|�|�C��):�):�;����7�7�<�<��T�-B�-B�C����w�w�|�|�C��):�):�;����'�'�,�,�s�D�,@�,@�A������rNc���tjj|�r=|r:tj|�j|k7r	tj
||�yy	|rtj||�ytj|�	y#t$r|jjd|�YywxYw#t$r(}|jtjk(rYd}~y�d}~wwxYw)a�ensure a directory exists at a given path

        This is a version of os.mkdir, with the following differences:

        - returns True if it created the directory, False otherwise
        - ignores EEXIST, protecting against race conditions where
          the dir may have been created in between the check and
          the creation
        - sets permissions if requested and the dir already exists
        zCould not set permissions on %sFNT)r#r$�exists�stat�st_mode�chmod�OSErrorr�warning�mkdir�errno�EEXIST)r1r$�mode�es    r�_mkdirzProfileDir._mkdirHs����7�7�>�>�$�������
�-�-��5���H�H�T�4�(��		������t�$���������#���H�H�$�$�9�������	��w�w�%�,�,�&����		�s6�B�B9�7B9�%B6�5B6�9	C*�C%�$C%�%C*r)c�:�|j|j�y�N)r@r)�r1r2s  r�
check_log_dirzProfileDir.check_log_dirjs�����D�L�L�!rr+c��|j|j�tjj	|jd�}tjj	t�ddd�}tjj
|�s|jjd|�tjj
|�r7tjj
|�stj||�yyy)N�README�core�profile�README_STARTUPzLCould not copy README_STARTUP to startup dir. Source file %s does not exist.)r@r+r#r$r%rr5rr:�shutil�copy)r1r2�readme�srcs    r�check_startup_dirzProfileDir.check_startup_dirns������D�$�$�%������d�.�.��9���g�g�l�l�2�4�g�z�K\�]���w�w�~�~�c�"��H�H���k�mp�q�
�7�7�>�>�#��r�w�w�~�~�f�'=��K�K��V�$�(>�rr'c�<�|j|jd�y�Ni�A)r@r'rCs  r�check_security_dirzProfileDir.check_security_dir{s�����D�%�%�w�/rr-c�<�|j|jd�yrP)r@r-rCs  r�
check_pid_dirzProfileDir.check_pid_dirs�����D�L�L�'�*rc��|j�|j�|j�|j�yrB)rQrDrSrN)r1s rr0zProfileDir.check_dirs�s2�����!������������ r�config_filer$�returnc�B�ttjj|j|��}|j�r|sy|�*tjjt
�ddd�}t|t�sJ�||z}tj||�y)z�Copy a default config file into the active profile directory.

        Default configuration files are kept in :mod:`IPython.core.profile`.
        This function moves these from that location to the working profile
        directory.
        FrGrH�defaultT)
rr#r$r%rr5r�
isinstancerJrK)r1rUr$�	overwrite�dstrMs      r�copy_config_filezProfileDir.copy_config_file�s|���2�7�7�<�<��
�
�{�;�<���:�:�<�	���<��7�7�<�<� 7� 9�7�J�PZ�[�D��$��%�%�%��[� �����C���rc��|||��S)z�Create a new profile directory given a full path.

        Parameters
        ----------
        profile_dir : str
            The full path to the profile directory.  If it does exist, it will
            be used.  If not, it will be created.
        �rrr��cls�profile_dirrs   r�create_profile_dirzProfileDir.create_profile_dir�s���K��7�7rc��tjj|�std|z��tjj	|d|z�}|||��S)a?Create a profile dir by profile name and path.

        Parameters
        ----------
        path : unicode
            The path (directory) to put the profile directory in.
        name : unicode
            The name of the profile.  The name of the profile directory will
            be "profile_<profile>".
        zDirectory not found: %s�profile_r^)r#r$�isdirr
r%)r`r$�namerras     r�create_profile_dir_by_namez%ProfileDir.create_profile_dir_by_name�sK���w�w�}�}�T�"�!�";�d�"B�C�C��g�g�l�l�4��t�);�<���K��7�7rc���d|z}|g}|D]M}tjj||�}tjj|�s�C|||��cSt	d|z��)afFind an existing profile dir by profile name, return its ProfileDir.

        This searches through a sequence of paths for a profile dir.  If it
        is not found, a :class:`ProfileDirError` exception will be raised.

        The search path algorithm is:
        1. ``os.getcwd()`` # removed for security reason.
        2. ``ipython_dir``

        Parameters
        ----------
        ipython_dir : unicode or str
            The IPython directory to use.
        name : unicode or str
            The name of the profile.  The name of the profile directory
            will be "profile_<profile>".
        rdr^z(Profile directory not found in paths: %s)r#r$r%rer
)r`�ipython_dirrfr�dirname�paths�pras        r�find_profile_dir_by_namez#ProfileDir.find_profile_dir_by_name�sj��&��$���
���	X�A��'�'�,�,�q�'�2�K��w�w�}�}�[�)��K��?�?�	X�
"�"L�w�"V�W�Wrc��t|�}tjj|�st	d|z��|||��S)z�Find/create a profile dir and return its ProfileDir.

        This will create the profile directory if it doesn't exist.

        Parameters
        ----------
        profile_dir : unicode or str
            The path of the profile directory.
        zProfile directory not found: %sr^)rr#r$rer
r_s   r�find_profile_dirzProfileDir.find_profile_dir�s<��"�+�.���w�w�}�}�[�)�!�"C�k�"Q�R�R��K��7�7rrB)F)rXN)$rrr�__doc__r	r&r(r*r,r.r'r)r+r-r/�tagrr
r!rr3r@rDrNrQrSr0�strr�boolr\�classmethodrbrgrmrorrrrrs���� �
�+���5�>�L��y�)���5�>�L��h�'�O��3�<�L��c�l�G��#�,�K��c�l�G����J��s��
��#�T�#�
�
�
�5�k�O��Z��
��
� �D
�Y��"��"�
�]��
%��
%�
�^��0��0�
�Y��+��+�!��C��t��QU��"�	8��	8��8��8� �X��X�6�
8��
8rr)rpr#rJr<�pathlibr�traitlets.config.configurablerrkr�
utils.pathrr�	traitletsr	r
r�	Exceptionr
rrrr�<module>rzs@��9�

�
���=�+�7�,�,�	�i�	�D8�$�D8r

Youez - 2016 - github.com/yon3zu
LinuXploit