Your IP : 18.191.4.164
�
��bg�E���dZddlZddlZddlZddlmZmZddlmZddl m
Z
mZmZm
Z
mZmZmZmZmZmZddlmZmZmZerddlmZddlmZd ed
efd�ZGd�d
��ZejdkrGd�d��ZdSdS)zJ Faked ``os.path`` module replacement. See ``fake_filesystem`` for usage.
�N)�S_IFDIR�S_IFMT)�
ModuleType)
�List�Optional�Union�Any�Dict�Tuple�AnyStr�overload�ClassVar�
TYPE_CHECKING)�make_string_path� to_string�matching_string)�FakeFilesystem)�FakeOsModule�old�returnc��tj�|jd��}t |j��}|�|tj|j<|S)z)Recompiles and creates new module object.N)�sys�modules�pop�__name__�
__import__)r�saved�news �c/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/pyfakefs/fake_path.py�_copy_moduler 1sA���K�O�O�C�L�$�/�/�E�
�S�\�
"�
"�C���$)���C�L�!��J�c���eZdZUdZeej��Zee d<dZ
eee d<dZ
eee d<dZeeee d<dZeee d<dZeee d <ed
eefd���Zd9d�Zed:d���Zded
efd�Zded
efd�Zdefd�Zded
efd�Zded
efd�Zded
efd�Zded
efd�Z e!j"dkrded
efd�Z#defd�Z$ded
e%fd�Z&ded
e%fd�Z'ded
e%fd�Z(ded
efd �Z)d!ed
efd"�Z*ded
e+eeffd#�Z,ded
e+eeffd$�Z-ded
efd%�Z.ded
efd&�Z/d;ded'eed
efd(�Z0d;d)ed*eed
efd+�Z1d,ed-ed
efd.�Z2e3ded/ed0e4eeefd
e+eeffd1���Z5e3de6d/e6d0e4e6ee6fd
e+e6effd2���Z5ded/ed0e4eeefd
e+eeffd3�Z5ded
efd4�Z7ded
efd5�Z8ded
efd6�Z9d7ed
efd8�Z:dS)<�FakePathModulez�Faked os.path module replacement.
FakePathModule should *only* be instantiated by FakeOsModule. See the
FakeOsModule docstring for details.
�
_OS_PATH_COPY��devnull�sepN�altsep�linesep�pathseprc�<�gd�}tjdkr|ddgz
}|S)zqReturn the list of patched function names. Used for patching
functions imported from the module.
)�abspath�dirname�exists�
expanduser�getatime�getctime�getmtime�getsize�isabs�isdir�isfile�islink�ismount�join�lexists�normcase�normpath�realpath�relpath�split�
splitdrive�samefile����
isjunction� splitroot�r�version_info)�dir_lists r�dirzFakePathModule.dirIs7��
�
�
��0��w�&�&���{�3�3�H��r!�
filesystemr� os_modulerc�|�||_|j|_|x|j_|_|�|��dS)zlInit.
Args:
filesystem: FakeFilesystem used to provide file system information
N)rKr$�_os_path�os�reset)�selfrKrLs r�__init__zFakePathModule.__init__js>��%����*��
�%.�.��
��4�7��
�
�:�����r!c��|j|_|j|_|���|_|jrdnd|_|jrdnd|_dS)N�nulz /dev/null�;�:) �path_separatorr'�alternative_path_separatorr(�line_separatorr)�
is_windows_fsr&r*)�clsrKs rrPzFakePathModule.resetusS���+����:��
� �/�/�1�1���)�7�H�e�e�[���'�5�>�c�c�3����r!�pathc�6�|j�|��S)z�Determine whether the file object exists within the fake filesystem.
Args:
path: The path to the file object.
Returns:
(bool) `True` if the file exists.
�rKr.�rQr\s rr.zFakePathModule.exists}s����%�%�d�+�+�+r!c�:�|j�|d���S)z�Test whether a path exists. Returns True for broken symbolic links.
Args:
path: path to the symlink object.
Returns:
bool (if file exists).
T)�
check_linkr^r_s rr:zFakePathModule.lexists�s����%�%�d�t�%�<�<�<r!c�0�|j�|��}|j�|��r\t|j��t
kr?|jjrtjntj }|j�
||��|jS)z�Return the file object size in bytes.
Args:
path: path to the file object.
Returns:
file size in bytes.
)rK�resolve�ends_with_path_separatorr�st_moderrZ�errno�EINVAL�ENOTDIR�raise_os_error�st_size)rQr\�file_obj�error_nrs rr3zFakePathModule.getsize�s���?�*�*�4�0�0���O�4�4�T�:�:� ;��x�'�(�(�G�3�3�'+��'D�W�u�|�|�%�-�H��O�*�*�8�T�:�:�:���r!c��|jjr|�|��d}t|��}|j�|��S)z,Return True if path is an absolute pathname.�)rKrZr@r�starts_with_sepr_s rr4zFakePathModule.isabs�sH���?�(� ,��?�?�4�(�(��+�D���%�%����.�.�t�4�4�4r!c�6�|j�|��S)z)Determine if path identifies a directory.�rKr5r_s rr5zFakePathModule.isdir�s����$�$�T�*�*�*r!c�6�|j�|��S)z,Determine if path identifies a regular file.�rKr6r_s rr6zFakePathModule.isfile�s����%�%�d�+�+�+r!c�6�|j�|��S)z�Determine if path identifies a symbolic link.
Args:
path: Path to filesystem object.
Returns:
`True` if path points to a symbolic link.
Raises:
TypeError: if path is None.
�rKr7r_s rr7zFakePathModule.islink�s����%�%�d�+�+�+r!rBc�6�|j�|��S)z)Returns False. Junctions are never faked.)rKrEr_s rrEzFakePathModule.isjunction�s���?�-�-�d�3�3�3r!c�6�|j�|��S)ztSplit a pathname into drive, root and tail.
Implementation taken from ntpath and posixpath.
)rKrFr_s rrFzFakePathModule.splitroot�s���?�,�,�T�2�2�2r!c�� |j�|��}|jS#t$r*|j�t
jd���YdSwxYw)aCReturns the modification time of the fake file.
Args:
path: the path to fake file.
Returns:
(int, float) the modification time of the fake file
in number of seconds since the epoch.
Raises:
OSError: if the file does not exist.
rC)�winerrorN)rKrc�st_mtime�OSErrorrirf�ENOENT�rQr\rks rr2zFakePathModule.getmtime�sk�� E���.�.�t�4�4�H��$�$��� E� E� E��O�*�*�5�<�!�*�D�D�D�D�D�D� E���s� #�0A�Ac�� |j�|��}n4#t$r'|j�tj��YnwxYw|jS)a�Returns the last access time of the fake file.
Note: Access time is not set automatically in fake filesystem
on access.
Args:
path: the path to fake file.
Returns:
(int, float) the access time of the fake file in number of seconds
since the epoch.
Raises:
OSError: if the file does not exist.
)rKrcr{rirfr|�st_atimer}s rr0zFakePathModule.getatime�s`�� 9���.�.�t�4�4�H�H��� 9� 9� 9��O�*�*�5�<�8�8�8�8�8� 9����� � ���.A�
Ac�� |j�|��}n4#t$r'|j�tj��YnwxYw|jS)a2Returns the creation time of the fake file.
Args:
path: the path to fake file.
Returns:
(int, float) the creation time of the fake file in number of
seconds since the epoch.
Raises:
OSError: if the file does not exist.
)rKrcr{rirfr|�st_ctimer}s rr1zFakePathModule.getctime�s`�� 9���.�.�t�4�4�H�H��� 9� 9� 9��O�*�*�5�<�8�8�8�8�8� 9����� � r�c������fd�}t���������s��|������nh�jjr\�j����rB|��}�j�|��r��|dd����������S)z&Return the absolute version of a path.c���t�t��r�j���S�j���S)z%Return the current working directory.)�
isinstance�bytesrO�getcwdb�getcwd)r\rQs��rr�z&FakePathModule.abspath.<locals>.getcwd
s;����$��&�&�
(��w���(�(�(��w�~�~�'�'�'r!N�)rr4r9rKrZro�starts_with_drive_letterr<)rQr\r��cwds`` rr,zFakePathModule.abspath
s����� (� (� (� (� (� (� ��%�%���z�z�$��� 0��9�9�V�V�X�X�t�,�,�D�D�
�_�
*� 0�t��/N�/N�t�/T�/T� 0��&�(�(�C���7�7��<�<�
0��y�y��R�a�R��$�/�/���}�}�T�"�"�"r!�pc� �|jj|�S)z8Return the completed path with a separator of the parts.)rK� joinpaths)rQr�s rr9zFakePathModule.joins��(�t��(�!�,�,r!c�6�|j�|��S)z?Split the path into the directory and the filename of the path.)rK� splitpathr_s rr?zFakePathModule.split"s����(�(��.�.�.r!c�6�|j�|��S)zRSplit the path into the drive part and the rest of the path, if
supported.)rKr@r_s rr@zFakePathModule.splitdrive&s����)�)�$�/�/�/r!c�6�|j�|��S)z0Normalize path, eliminating double slashes, etc.)rKr<r_s rr<zFakePathModule.normpath+s����'�'��-�-�-r!c�z�|j�|��}|jjr|���}|S)zPConvert to lower case under windows, replaces additional path
separator.)rKr;rZ�lowerr_s rr;zFakePathModule.normcase/s8����'�'��-�-���?�(� ��:�:�<�<�D��r!�startc���|std���t|��}|j�|��}t ||jj��}|�t|��}nt ||jj��}|j�|��}t ||jj��}|jj �Ft ||jj ��}|�
||��}|�
||��}|�
||��}|�
||��}|j�||��}|�
||��S)zQWe mostly rely on the native implementation and adapt the
path separator.zno path specified)�
ValueErrorrrK�replace_windows_rootrrWr�rNr'rX�replacer>)rQr\r�r'�
system_sepr(s rr>zFakePathModule.relpath7s9��� 2��0�1�1�1���%�%����3�3�D�9�9���d�D�O�$B�C�C����$�U�+�+�E�E�#�D�$�/�*=�>�>�E���4�4�U�;�;��$�T�4�=�+<�=�=�
��?�5�A�$�T�4�?�+U�V�V�F��<�<��
�3�3�D��M�M�&�*�5�5�E��|�|�C��,�,���
�
�c�:�.�.���}�$�$�T�5�1�1���|�|�J��,�,�,r!�filename�strictc�N�|�tjdkrtd���|r|j�|��|jjr|�|��St|��}|�|dd�|i��\}}|�|��}|S)z}Return the canonical path of the specified filename, eliminating any
symbolic links encountered in the path.
N)rC�
z6realpath() got an unexpected keyword argument 'strict'r) rrH� TypeErrorrKrcrZr,r�_join_real_path)rQr�r�r\�oks rr=zFakePathModule.realpathNs�����#�"2�W�"<�"<��W�X�X�X�� .��O�#�#�H�-�-�-��?�(� *��<�<��)�)�)�#�H�-�-���'�'���!���h��C�C���b��|�|�D�!�!���r!�path1�path2c��|j�|��}|j�|��}|j|jko|j|jkS)aMReturn whether path1 and path2 point to the same file.
Args:
path1: first file path or path object (Python >=3.6)
path2: second file path or path object (Python >=3.6)
Raises:
OSError: if one of the paths does not point to an existing
file system object.
)rK�stat�st_ino�st_dev)rQr�r��stat1�stat2s rrAzFakePathModule.samefile^sK����$�$�U�+�+����$�$�U�+�+���|�u�|�+�L�����0L�Lr!�rest�seenc��dS�N��rQr\r�r�s rr�zFakePathModule._join_real_pathm� �� �r!c��dSr�r�r�s rr�zFakePathModule._join_real_pathsr�r!c �D�t|d��}t|d��}|j�|��}|�|��r|dd�}|}|�r?|�|��\}}}|r||kr�%||krE|r@|j�|��\}}||kr|j�|||��}n|}�p|j�||��} |j�| ��s| }��| |vr*|| }
|
�|
}��|j�| |��dfSd|| <|�|t||j� | ����|��\}}|s|j�||��dfS||| <|��?|dfS)z�Join two paths, normalizing and eliminating any symbolic links
encountered in the second path.
Taken from Python source and adapted.
�.z..rnNFT)
rrK�get_path_separatorr4� partitionr�r�r7r��readlink)rQr\r�r��curdir�pardirr'�name�_�newpath� seen_pathr�s rr�zFakePathModule._join_real_pathys���!��s�+�+�� ��t�,�,���o�0�0��6�6���:�:�d��� �����8�D��D��% !� �N�N�3�/�/�M�D�!�T��
�4�6�>�>���v�~�~��"�!%��!:�!:�4�!@�!@�J�D�$��v�~�~�#��8�8��v�v�N�N���!�D���o�/�/��d�;�;�G��?�)�)�'�2�2�
�����$��� ��M� ��(�$�D����0�0��$�?�?��F�F� �D��M��+�+����d�o�&>�&>�w�&G�&G�H�H����H�D�"�
�
D���0�0��t�<�<�e�C�C� �D��M�K�% !�L�T�z�r!c�8�|�|��dS)z2Returns the first part of the result of `split()`.r)r?r_s rr-zFakePathModule.dirname�s���z�z�$����"�"r!c��|j�|��}|�t||jj��t||j����S)ztReturn the argument with an initial component of ~ or ~user
replaced by that user's home directory.
)rNr/r�rr'r_s rr/zFakePathModule.expanduser�sP���}�'�'��-�-���|�|��D�$�-�"3�4�4��D�$�(�+�+�
�
�
r!c��|sdStt|����}|j�|��}|jj}|jjrV|jj�||jjf}n|f}|j�|��\}}|r|dd�|vr|p||vS||vrdS|jjD]K}t|��� |��t|��� |��krdS�LdS)aPReturn true if the given path is a mount point.
Args:
path: Path to filesystem object to be checked
Returns:
`True` if path is a mount point added to the fake file system.
Under Windows also returns True for drive and UNC roots
(independent of their existence).
FNrnT)
rrrK�absnormpathrWrZrXr@�mount_points�rstrip) rQr\�path_str�normed_pathr'� path_seps�driver��mount_points rr8zFakePathModule.ismount�s)��� ��5��-�d�3�3�4�4���o�1�1�(�;�;���o�,���?�(�
���9�E� �$�/�"L�M� � � �F� ��/�4�4�[�A�A�K�E�4��
9��r��r��i�/�/� ��8�d�i�&7�8��y� � ��t��?�7� � �K���%�%�,�,�S�1�1�Y�{�5K�5K�5R�5R�SV�5W�5W�W�W��t�t�X��ur!r�c�,�t|j|��S)z1Forwards any non-faked calls to the real os.path.)�getattrrN�rQr�s r�__getattr__zFakePathModule.__getattr__�s���t�}�d�+�+�+r!)rKrrLr)rKrrNr�);r�
__module__�__qualname__�__doc__r rOr\r$r �__annotations__r&r�strr'r(rr)r*�staticmethodrrJrR�classmethodrPr�boolr.r:r3r4r5r6r7rrHrErF�floatr2r0r1r,r9rr?r@r<r;r>r=rAr
r
r�r�r-r/r8r�r�r!rr#r#:s����������&��b�g�.�.�M�3�.�.�.��G�X�c�]�����C��#�����&*�F�H�X�c�]�#�*�*�*��G�X�c�]�����G�X�c�]�������c������\��@ � � � ��?�?�?��[�?� ,�6� ,�d� ,� ,� ,� ,� =�F� =�t� =� =� =� =� �F� � � � �$5�&�5�T�5�5�5�5�+�&�+�T�+�+�+�+�,�6�,�d�,�,�,�,�,�6�,�d�,�,�,�,���7�"�"� 4�6� 4�d� 4� 4� 4� 4� 3�&� 3� 3� 3� 3�E�V�E��E�E�E�E�&!�V�!��!�!�!�!�,!�V�!��!�!�!�!�&#�F�#�v�#�#�#�#�(-�v�-�&�-�-�-�-�/�&�/�U�6�6�>�%:�/�/�/�/�0�v�0�%����*?�0�0�0�0�
.�V�.��.�.�.�.��V�������-�-�F�-�8�F�+;�-�v�-�-�-�-�.�����$���6�����
M�f�
M�V�
M��
M�
M�
M�
M�����"��*.�s�H�S�M�/A�*B�� �s�D�y� �����X��
����!&��.2�5�(�5�/�3I�.J�� �u�d�{� �����X��
5��5�"(�5�04�V�X�f�=M�5M�0N�5� �v�t�|� �5�5�5�5�n#�F�#�v�#�#�#�#�
�v�
�&�
�
�
�
��F��t�����@,��,��,�,�,�,�,�,r!r#�win32c��eZdZdZed���Zdd�Zejdkr!de de
fd �Zde de
fd
�Zde de
fd�Z
de de
fd�Znde de
fd
�Zdedefd�ZdS)�FakeNtModulez�Under windows, a few function of `os.path` are taken from the `nt` module
for performance reasons. These are patched here.
c�0�tjdkrgd�SdgS)NrB)�_path_exists�_path_isfile�_path_isdir�_path_islink�_isdirrGr�r!rrJzFakeNtModule.dir�s$����7�*�*�V�V�V�V� �z�!r!rKrc�*�ddl}||_||_dS)zxInit.
Args:
filesystem: FakeFilesystem used to provide file system information
rN)�ntrK� nt_module)rQrKr�s rrRzFakeNtModule.__init__�s��
�I�I�I�(�D�O�"$�D�N�N�Nr!rBr\rc�6�|j�|��Sr�rqr_s rr�zFakeNtModule._path_isdir������,�,�T�2�2�2r!c�6�|j�|��Sr�rsr_s rr�zFakeNtModule._path_isfile�����-�-�d�3�3�3r!c�6�|j�|��Sr�rur_s rr�zFakeNtModule._path_islinkr�r!c�6�|j�|��Sr�r^r_s rr�zFakeNtModule._path_existsr�r!c�6�|j�|��Sr�rqr_s rr�zFakeNtModule._isdirr�r!r�c�,�t|j|��S)z3Forwards any non-faked calls to the real nt module.)r�r�r�s rr�zFakeNtModule.__getattr__s���4�>�4�0�0�0r!N)rKr)rr�r�r�r�rJrRrrHrr�r�r�r�r�r�r�r r�r�r!rr�r��s.������ � �
� "� "�
�� "� %� %� %� %���w�&�&�
3��
3�4�
3�
3�
3�
3�
4��
4�D�
4�
4�
4�
4�
4��
4�D�
4�
4�
4�
4�
4��
4�D�
4�
4�
4�
4�
4�
3�6�
3�d�
3�
3�
3�
3� 1�C� 1�C� 1� 1� 1� 1� 1� 1r!r�) r�rfrOrr�rr�typesr�typingrrrr r
rrr
rr�pyfakefs.helpersrrr�pyfakefs.fake_filesystemr�pyfakefs.fake_osrr r#�platformr�r�r!r�<module>r�s��������� � � � �
�
�
�
��������������������������������������������������.�7�7�7�7�7�7�-�-�-�-�-�-��j��Z�����f,�f,�f,�f,�f,�f,�f,�f,�R
�<�7���,1�,1�,1�,1�,1�,1�,1�,1�,1�,1��r!
?>