OwlCyberSecurity - MANAGER
Edit File: fake_path.cpython-311.pyc
� ������h�E����������������������������d�Z�ddlZddlZddlZddlmZmZ�ddlmZ�ddl m Z mZmZm Z mZmZmZmZmZmZ�ddlmZmZmZ�erddlmZ�ddlmZ�d ed efd�Z�G�d��d ������������Zej��������dk����r�G�d��d������������ZdS�dS�)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�����������������������t�����������j�����������������������������|�j��������d������������}t ����������|�j��������������������}|�|t�����������j��������|�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.8/venv/lib/python3.11/site-packages/pyfakefs/fake_path.py�_copy_moduler ���1���sA�������K�O�O�C�L�$�/�/�E� �S�\� "� "�C���$)���C�L�!��J�����c�������������������������e�Zd�ZU�dZ�eej��������������������Zee d<���dZ ee���������e d<���dZ ee���������e d<���dZeee������������������e d<���dZee���������e d<���dZee���������e d <���ed ee���������fd���������������Zd9d�Zed:d���������������Zded efd�Zded efd�Zdefd�Zded efd�Zded efd�Zded efd�Zded efd�Z e!j"��������dk����rded 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+eef���������fd#�Z,ded e+eef���������fd$�Z-ded efd%�Z.ded efd&�Z/d;ded'ee���������d efd(�Z0d;d)ed*ee���������d efd+�Z1d,ed-ed efd.�Z2e3ded/ed0e4eee���������f���������d e+eef���������fd1���������������Z5e3de6d/e6d0e4e6ee6���������f���������d e+e6ef���������fd2���������������Z5ded/ed0e4eee���������f���������d e+eef���������fd3�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�pathsepr���c�������������������<�����g�d�}�t�����������j��������dk����r|�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.dirI���s7������ �� �� ��0���w�&�&���{�3�3�H��r!���� filesystemr���� os_moduler���c������������������|�����||�_���������|�j��������|�_��������|x|�j��������_��������|�_��������|����������������������|�������������dS�)zlInit. Args: filesystem: FakeFilesystem used to provide file system information N)rK���r$����_os_path�os�reset)�selfrK���rL���s��� r����__init__zFakePathModule.__init__j���s>�������%����*�� �%.�.�� ��4�7�� � �:�����r!���c�����������������������|j���������|�_��������|j��������|�_��������|�����������������������������������|�_��������|j��������rdnd|�_��������|j��������rdnd|�_��������d�S�)N�nulz /dev/null�;�:) �path_separatorr'����alternative_path_separatorr(����line_separatorr)���� is_windows_fsr&���r*���)�clsrK���s��� r���rP���zFakePathModule.resetu���sS�������+����:�� � �/�/�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. �rK���r.����rQ���r\���s��� r���r.���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��� r���r:���zFakePathModule.lexists����s���������%�%�d�t�%�<�<�<r!���c������������������0����|�j������������������������������|������������}|�j������������������������������|������������r\t����������|j��������������������t ����������k����r?|�j���������j��������rt����������j��������nt����������j ��������}|�j���������� ��������������������||�������������|j��������S�)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_moder���rZ����errno�EINVAL�ENOTDIR�raise_os_error�st_size)rQ���r\����file_obj�error_nrs��� r���r3���zFakePathModule.getsize����s��������?�*�*�4�0�0���O�4�4�T�:�:� ;��x�'�(�(�G�3�3�'+��'D�W�u�|�|�%�-�H��O�*�*�8�T�:�:�:���r!���c�����������������������|�j���������j��������r|����������������������|������������d���������}t����������|������������}|�j������������������������������|������������S�)z,Return True if path is an absolute pathname.����)rK���rZ���r@���r����starts_with_sepr_���s��� r���r4���zFakePathModule.isabs����sH�������?�(�� ,��?�?�4�(�(��+�D���%�%����.�.�t�4�4�4r!���c������������������6�����|�j������������������������������|������������S�)z)Determine if path identifies a directory.�rK���r5���r_���s��� r���r5���zFakePathModule.isdir����s��������$�$�T�*�*�*r!���c������������������6�����|�j������������������������������|������������S�)z,Determine if path identifies a regular file.�rK���r6���r_���s��� r���r6���zFakePathModule.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. �rK���r7���r_���s��� r���r7���zFakePathModule.islink����s���������%�%�d�+�+�+r!���rB���c������������������6�����|�j������������������������������|������������S�)z)Returns False. Junctions are never faked.)rK���rE���r_���s��� r���rE���zFakePathModule.isjunction����s�������?�-�-�d�3�3�3r!���c������������������6�����|�j������������������������������|������������S�)ztSplit a pathname into drive, root and tail. Implementation taken from ntpath and posixpath. )rK���rF���r_���s��� r���rF���zFakePathModule.splitroot����s��������?�,�,�T�2�2�2r!���c����������������������� �|�j������������������������������|������������}|j��������S�#�t����������$�r*�|�j������������������������������t ����������j��������d��������������Y�dS�w�xY�w)aC��Returns 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)rK���rc����st_mtime�OSErrorri���rf����ENOENT�rQ���r\���rk���s��� r���r2���zFakePathModule.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������������������������������t����������j���������������������Y�nw�xY�w|j��������S�)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. )rK���rc���r{���ri���rf���r|����st_atimer}���s��� r���r0���zFakePathModule.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������������������������������t����������j���������������������Y�nw�xY�w|j��������S�)a2��Returns 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. )rK���rc���r{���ri���rf���r|����st_ctimer}���s��� r���r1���zFakePathModule.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��j��������j��������r\��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\���rQ���s�����r���r����z&FakePathModule.abspath.<locals>.getcwd ��s;���������$��&�&�� (��w���(�(�(��w�~�~�'�'�'r!���N����)r���r4���r9���rK���rZ���ro����starts_with_drive_letterr<���)rQ���r\���r�����cwds���`` r���r,���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������������������ ������|�j���������j��������|��S�)z8Return the completed path with a separator of the parts.)rK���� joinpaths)rQ���r����s��� r���r9���zFakePathModule.join��s������(�t��(�!�,�,r!���c������������������6�����|�j������������������������������|������������S�)z?Split the path into the directory and the filename of the path.)rK���� splitpathr_���s��� r���r?���zFakePathModule.split"��s��������(�(��.�.�.r!���c������������������6�����|�j������������������������������|������������S�)zRSplit the path into the drive part and the rest of the path, if supported.)rK���r@���r_���s��� r���r@���zFakePathModule.splitdrive&��s���������)�)�$�/�/�/r!���c������������������6�����|�j������������������������������|������������S�)z0Normalize path, eliminating double slashes, etc.)rK���r<���r_���s��� r���r<���zFakePathModule.normpath+��s��������'�'��-�-�-r!���c������������������z�����|�j������������������������������|������������}|�j���������j��������r|�����������������������������������}|S�)zPConvert to lower case under windows, replaces additional path separator.)rK���r;���rZ����lowerr_���s��� r���r;���zFakePathModule.normcase/��s8���������'�'��-�-���?�(�� ��:�:�<�<�D��r!����startc�����������������������|st����������d�������������t����������|������������}|�j�����������������������������|������������}t ����������||�j��������j��������������������}|�t����������|������������}nt ����������||�j��������j��������������������}|�j�����������������������������|������������}t ����������||�j��������j��������������������}|�j��������j ���������Ft ����������||�j��������j ��������������������}|� ��������������������||������������}|� ��������������������||������������}|� ��������������������||������������}|� ��������������������||������������}|�j�����������������������������||������������}|� ��������������������||������������S�)zQWe mostly rely on the native implementation and adapt the path separator.zno path specified)� ValueErrorr���rK����replace_windows_rootr���rW���r����rN���r'���rX����replacer>���)rQ���r\���r����r'���� system_sepr(���s��� r���r>���zFakePathModule.relpath7��s9�������� 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����|�t�����������j��������dk�����rt����������d�������������|r|�j�����������������������������|�������������|�j��������j��������r|����������������������|������������S�t����������|������������}|����������������������|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���) r���rH���� TypeErrorrK���rc���rZ���r,���r����_join_real_path)rQ���r����r����r\����oks��� r���r=���zFakePathModule.realpathN��s����������#�"2�W�"<�"<��W�X�X�X��� .��O�#�#�H�-�-�-��?�(�� *��<�<��)�)�)�#�H�-�-���'�'���!���h��C�C���b��|�|�D�!�!���r!����path1�path2c�����������������������|�j������������������������������|������������}|�j������������������������������|������������}|j��������|j��������k����o|j��������|j��������k����S�)aM��Return 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)rQ���r����r�����stat1�stat2s��� r���rA���zFakePathModule.samefile^��sK���������$�$�U�+�+����$�$�U�+�+���|�u�|�+�L�����0L�Lr!����rest�seenc�����������������������d�S��N���rQ���r\���r����r����s��� r���r����zFakePathModule._join_real_pathm��� ������� �r!���c�����������������������d�S�r����r����r����s��� r���r����zFakePathModule._join_real_paths��r����r!���c����������� �������D����t����������|d������������}t����������|d������������}|�j�����������������������������|������������}|����������������������|������������r|dd����������}|}|�r?|���������������������|������������\��}}}|r||k����r�%||k����rE|r@|�j�����������������������������|������������\��}}||k����r|�j�����������������������������|||������������}n|}�p|�j�����������������������������||������������} |�j�����������������������������| ������������s| }��| |v�r*|| ���������} | �| }��|�j�����������������������������| |������������dfS�d|| <���|����������������������|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..rn���NFT) r���rK����get_path_separatorr4���� partitionr����r����r7���r�����readlink)rQ���r\���r����r�����curdir�pardirr'����name�_�newpath� seen_pathr����s��� r���r����zFakePathModule._join_real_pathy��s�������!��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�����|�����������������������|������������d���������S�)z2Returns the first part of the result of `split()`.r���)r?���r_���s��� r���r-���zFakePathModule.dirname���s�������z�z�$����"�"r!���c�����������������������|�j������������������������������|������������}|���������������������t����������||�j���������j��������������������t����������||�j��������������������������������S�)ztReturn the argument with an initial component of ~ or ~user replaced by that user's home directory. )rN���r/���r����r���r'���r_���s��� r���r/���zFakePathModule.expanduser���sP��������}�'�'��-�-���|�|��D�$�-�"3�4�4��D�$�(�+�+� �� �� r!���c����������������������|sdS�t����������t����������|������������������������}|�j�����������������������������|������������}|�j��������j��������}|�j��������j��������rV|�j��������j���������||�j��������j��������f}n|f}|�j�����������������������������|������������\��}}|r|dd����������|v�r|�p||v�S�||v�rdS�|�j��������j��������D�]K}t����������|������������� ��������������������|������������t����������|������������� ��������������������|������������k����r�dS��LdS�)aP��Return 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). FNrn���T) r���r���rK����absnormpathrW���rZ���rX���r@����mount_points�rstrip) rQ���r\����path_str�normed_pathr'���� path_seps�driver�����mount_points ��� r���r8���zFakePathModule.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����rQ���r����s��� r����__getattr__zFakePathModule.__getattr__���s�������t�}�d�+�+�+r!���)rK���r���rL���r���)rK���r���r���Nr����);r���� __module__�__qualname__�__doc__r ���rO���r\���r$���r ����__annotations__r&���r����strr'���r(���r���r)���r*����staticmethodr���rJ���rR����classmethodrP���r����boolr.���r:���r3���r4���r5���r6���r7���r���rH���rE���rF����floatr2���r0���r1���r,���r9���r���r?���r@���r<���r;���r>���r=���rA���r ���r ���r����r����r-���r/���r8���r����r����r!���r���r#���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�������������������������e�Zd�ZdZed����������������Zdd�Zej��������dk����r!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�����t�����������j��������dk����rg�d�S�dgS�)NrB���)�_path_exists�_path_isfile�_path_isdir�_path_islink�_isdirrG���r����r!���r���rJ���zFakeNtModule.dir���s$��������7�*�*�V�V�V�V� �z�!r!���rK���r���c������������������*�����ddl�}||�_��������||�_��������dS�)zxInit. Args: filesystem: FakeFilesystem used to provide file system information r���N)�ntrK���� nt_module)rQ���rK���r����s��� r���rR���zFakeNtModule.__init__���s������� �I�I�I�(�D�O�"$�D�N�N�Nr!���rB���r\���r���c������������������6�����|�j������������������������������|������������S�r����rq���r_���s��� r���r����zFakeNtModule._path_isdir������������,�,�T�2�2�2r!���c������������������6�����|�j������������������������������|������������S�r����rs���r_���s��� r���r����zFakeNtModule._path_isfile�����������-�-�d�3�3�3r!���c������������������6�����|�j������������������������������|������������S�r����ru���r_���s��� r���r����zFakeNtModule._path_islink��r����r!���c������������������6�����|�j������������������������������|������������S�r����r^���r_���s��� r���r����zFakeNtModule._path_exists��r����r!���c������������������6�����|�j������������������������������|������������S�r����rq���r_���s��� r���r����zFakeNtModule._isdir��r����r!���r����c������������������,�����t����������|�j��������|������������S�)z3Forwards any non-faked calls to the real nt module.)r����r����r����s��� r���r����zFakeNtModule.__getattr__��s�������4�>�4�0�0�0r!���N)rK���r���)r���r����r����r����r����rJ���rR���r���rH���r���r����r����r����r����r����r����r����r ���r����r����r!���r���r����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����rf���rO���r���r����r���r����typesr����typingr���r���r���r ���r ���r���r���r ���r���r����pyfakefs.helpersr���r���r����pyfakefs.fake_filesystemr����pyfakefs.fake_osr���r ���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!���