← Back
Editing: path.cpython-311.pyc
� �@�c�. � �6 � d Z ddlZddlZddlZddlZddlZddlZddlmZ ddl m Z ddlmZ ej � � Zd� Zej dk rd� Znd � Zd � Zd� Zd� Zd d edefd�Z G d� de� � Zd!defd�Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z dZ!d� Z"d� Z#d"d�Z$dS )#z Utilities for path handling. � N)�warn)�system)�undocc �~ � t j � | � � ot j | t j � � S )zBWhether `path` is a directory, to which the user has write access.)�os�path�isdir�access�W_OK�r s �4/usr/lib/python3/dist-packages/IPython/utils/path.py� _writable_dirr s) � � �7�=�=����;�2�9�T�2�7�#;�#;�;� �win32c � � ddl }n"# t $ r}t d� � |�d}~ww xY w|j j j }|j |j |j g|_ |� d� � } || |d� � }|dk s|dk r| S |j S )z�Get a long path name (expand ~) on Windows using ctypes. Examples -------- >>> get_long_path_name('c:\\docume~1') 'c:\\Documents and Settings' r Nz2you need to have ctypes installed for this to worki ) �ctypes�ImportError�windll�kernel32�GetLongPathNameW� c_wchar_p�c_uint�argtypes�create_unicode_buffer�value)r r �e�_GetLongPathName�buf�rvs r �_get_long_path_namer s� � � [��M�M�M�M��� [� [� [��R�S�S�YZ�Z����� [����!�=�1�B��%+�%5�v�7G��M�%��!� �*�*�3�/�/�� � �d�C�� -� -�� ��7�7�b�3�h�h��K��9�s � � &�!�&c � � | S )zDummy no-op.� r s r r r 7 s � ��r c � � t | � � S )z�Expand a path into its long form. On Windows this expands any ~ in the paths. On other platforms, it is a null operation. )r r s r �get_long_path_namer$ = s � � �t�$�$�$r c � � t j � d� � }| � |� � rd| t |� � d� z } | S )z*Reverse of :func:`os.path.expanduser` �~N)r r � expanduser� startswith�len)r �homes r � compress_userr+ F sK � � �7���c�"�"�D����t��� '��d�3�t�9�9�:�:�&�&���Kr c � � t j � | � � } t j � | � � r| S | � d� � s&| dz }t j � |� � r|S t d| z � � �)z�Return a valid python filename in the current directory. If the given name is not a file, it adds '.py' and searches again. Raises IOError with an informative message if the file isn't found. z.pyzFile `%r` not found.)r r r'