관리-도구
편집 파일: pathlib.cpython-311.pyc
� �܋f�d � �x � d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl Z d dl Z d dlZd dlm Z d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d d lmZ d d lmZ d dlmZ d dlmZ d d lmZ d dlmZ d dl mZ d dl m!Z! d dl m"Z" d dl m#Z# d dl m$Z$ d dl m%Z% d dl m&Z& d dl m'Z' d dl m(Z( d dl m)Z) d dl m*Z* d dl m+Z+ d dl,m-Z- d dl.m/Z/ d dl0m1Z1 dZ2 e*de�� � Z3eeeefZ4d Z5d!� Z6d"e3d#e3fd$�Z7d"e8d%e+e9e(e)e9 e9e&e j: f f d&ed#e;fd'�Z<d"ed#efd(�Z=d"e8d#e8fd)�Z>d"ed#dfd*�Z?d+ed,e8d#e$e fd-�Z@d.e#e d,e8d#e$e8 fd/�ZAd+ed,e8d#e$e8 fd0�ZBd#eCfd1�ZDd+ed2e+e8ef d3e+e8ef d#dfd4�ZEdld+ed,e8d6eCd#efd7�ZFd8ed#efd9�ZGe jH fd:efd;�ZId"ed#dfd<�ZJd"ed=eKd#e;fd>�ZLd"ed=eKd#dfd?�ZMd+ed,e8d@eCd#e$e fdA�ZNd+efdB�ZOd+ed,e8d@eCd=eKd#df dC�ZPd+ed,e8d@eCdDeKd6eCd#efdE�ZQdFe8dGed#efdH�ZRdIe8d"e+e8dJf d#e;fdK�ZSdLe8d#e'e8 fdM�ZTdN� ZU G dO� dPe � � ZV G dQ� dReW� � ZXeVjY dS�d8e+e8dJf d6e+e8eVf d+ed#efdT�ZZej[ �\ dU� � rdVe8dWe8d#e;fdX�Z]n dVe8dWe8d#e;fdY�Z]d"ed+ed#e8fdZ�Z^d[e"e8ef d\e8d#dfd]�Z_d"ed#e&e fd^�Z`d"e+e8dJf d#e%d_ fd`�Zad"e+e8dJf dae!d_ge;f d#e$d_ fdb�Zbd"e+ee8f d#efdc�Zcddedeed#e&e fdf�Zddgedhed#e8fdi�Zedjed2ed#dfdk�ZfdS )m� N)�Enum)�EBADF)�ELOOP)�ENOENT)�ENOTDIR)�partial)� expanduser)� expandvars)�isabs)�sep)�Path)�PurePath)� ModuleType)�Callable)�Dict)�Iterable)�Iterator)�List)�Optional)�Set)�Tuple)�Type)�TypeVar)�Union)�assert_never)�skip)� PytestWarningi�� �_AnyPurePath)�bound)� i� c �b � t | dd � � t v pt | dd � � t v S )N�errno�winerror)�getattr�_IGNORED_ERRORS�_IGNORED_WINERRORS)� exceptions �`/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/_pytest/pathlib.py� _ignore_errorr) ; s6 � �� �7�D�)�)�_�<� F��9�j�$�/�/�3E�E�� �path�returnc �, � | � d� � S )Nz.lock)�joinpath�r+ s r( � get_lock_pathr0 B s � ��=�=��!�!�!r* �excinfo� start_pathc � �� t |t � � r|}n|d }t |t � � rdS t |t � � s9t j t d|� dt |� � � d|� �� � � � dS | t j t j t j fvrU| t j fvrDt j t d� | |t |� � |� � � � � � dS ddl�d t d df�fd�}t! |� � }|� � � r*|j D ]"} |t |� � � � ||k r n�# |t |� � � � | |� � dS ) zhHandle known read-only errors during rmtree. The returned value is used only by our own tests. � Fz(rm_rf) error removing � z: z4(rm_rf) unknown function {} when removing {}: {}: {}r N�pr, c � �� t j | � � j }t j | |�j z �j z � � d S �N)�os�stat�st_mode�chmod�S_IRUSR�S_IWUSR)r6 �moder: s �r( �chmod_rwz on_rm_rf_error.<locals>.chmod_rwr s9 �� ��w�q�z�z�!�� ���D�4�<�'�$�,�6�7�7�7�7�7r* T)� isinstance� BaseException�FileNotFoundError�PermissionError�warnings�warnr �typer9 �rmdir�remove�unlink�open�formatr: �strr �is_file�parents) �funcr+ r1 r2 �excr@ r6 �parentr: s @r( �on_rm_rf_errorrS F s� �� � �'�=�)�)� �����a�j�� �#�(�)�)� ��u��c�?�+�+� �� ��N�D�N�N�D��I�I�N�N��N�N�O�O� � � � �u��B�H�b�i���3�3�3����z�!�!��M��K�R�R��d�D��I�I�s�� �� � � � � �u� �K�K�K�8�C� 8�D� 8� 8� 8� 8� 8� 8� �T� � �A��y�y�{�{� ��i� � �F��H�S��[�[�!�!�!���#�#��� $��H�S��Y�Y�����D��J�J�J��4r* c � � t j � d� � r=| � � � } t t t | � � � � � � } | S )a0 Get the extended-length version of a path (Windows). On Windows, by default, the maximum length of a path (MAX_PATH) is 260 characters, and operations on paths longer than that fail. But it is possible to overcome this by converting the path to "extended-length" form before performing the operation: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation On Windows, this function returns the extended-length absolute version of path. On other platforms it returns path unchanged. �win32)�sys�platform� startswith�resolver �get_extended_length_path_strrM r/ s r( �ensure_extended_length_pathr[ � sJ � � �|���w�'�'� =��|�|�~�~���0��T���;�;�<�<���Kr* c � � d}d}| � ||f� � r| S | � d� � r || dd� z S || z S )z1Convert a path to a Windows extended length path.z\\?\z\\?\UNC\z\\� N)rX )r+ �long_path_prefix�unc_long_path_prefixs r( rZ rZ � s` � � ��)�����(�*>�?�@�@� ������v��� /�#�d�1�2�2�h�.�.��d�"�"r* c � � t | � � } t t | �� � }t j dk r%t j t | � � |�� � dS t j t | � � |�� � dS )zNRemove the path contents recursively, even if some elements are read-only.)r2 )� � )�onexc)�onerrorN)r[ r rS rV �version_info�shutil�rmtreerM )r+ rd s r( �rm_rfrh � ss � � '�t�,�,�D��n��6�6�6�G� ��7�"�"�� �c�$�i�i�w�/�/�/�/�/�/�� �c�$�i�i��1�1�1�1�1�1r* �root�prefixc # � K � |� � � }| � � � D ]2}|j � � � � |� � r|V � �3dS )zGFind all elements in root that begin with the prefix, case insensitive.N)�lower�iterdir�namerX )ri rj �l_prefix�xs r( � find_prefixedrq � s^ � � � ��|�|�~�~�H� �\�\�^�^� � ���6�<�<�>�>�$�$�X�.�.� ��G�G�G��� r* �iterc # �T K � t |� � }| D ]}|j |d� V � �dS )z�Return the parts of the paths following the prefix. :param iter: Iterator over path names. :param prefix: Expected prefix of the path names. N)�lenrn )rr rj �p_lenr6 s r( �extract_suffixesrv � sE � � � � ��K�K�E� � � ���f�U�V�V�n������ r* c �>