Your IP : 3.14.249.191
�
��bgn� � �( � d Z ddlZddlZddlZddlZddlZddlZddlmZ ddl m
Z
mZ ddlm
Z
mZmZmZmZmZmZmZmZmZ ddlmZ ddlmZmZmZmZmZmZm Z ddl!m"Z"m#Z# dd l$m%Z% dd
l&m'Z'm(Z(m)Z) ddl*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8 erddl9m:Z: d
Z; G d� d� � Z<ej= dk rTdedefd�Z> ej? e<ej@ � � D ]5\ ZAZBeBjC �D d� � s eEe<eA e>eB� � � � �6ed� � � ZFdS )zV Uses :py:class:`FakeOsModule` to provide a
fake :py:mod:`os` module replacement.
� N)�contextmanager)�S_IFREG�S_IFSOCK)
�List�Optional�Callable�Union�Any�Tuple�cast�AnyStr�
TYPE_CHECKING�Set)�use_scandir)�
FakeDirectory�FakeDirWrapper�StandardStreamWrapper�FakeFileWrapper�FakePipeWrapper�FakeFile�AnyFileWrapper)�FakeFileOpen�
_OpenModes)�FakePathModule)�scandir�walk�ScanDirIter)�FakeStatResult�is_int_type�is_byte_string�make_string_path�IS_PYPY� to_string�matching_string� AnyString�to_bytes�PERM_EXE�PERM_DEF�is_root�get_uid�get_gid)�FakeFilesystem� c � � e Zd ZdZdZedee fd�� � Zdsd�Z e
defd�� � Ze
defd �� � Ze
de
e fd
�� � Ze
defd�� � Ze
defd�� � Zd
edededefd�Zdefd�Z dtdd�dedede
e de
e def
d�Zd
eddfd�Zd
ededefd�Zd
ededefd�Zdeeef fd�Zd
edefd�Zd edefd!�Z deddfd"�Z!defd#�Z"defd$�Z#dedee fd%�Z$d&Z%d'Z&d(d)�ded*e'd+e(de
e fd,�Z) dtd(d)�de
e d+e(dee fd-�Z*d(d)�ded*e'd+e(ddfd.�Z+ dud(d)�ded*e'd0eded+e(ddfd1�Z,dvdede-fd3�Z. dwd4ed5e(d6e
e( d7e(fd8�Z/dtdede
e defd9�Z0dd(d:�dede
e d+e(defd;�Z1dd�dede
e defd<�Z2dtdede
e ddfd=�Z3dd�dede
e ddfd>�Z4ddd?�d@edAedBe
e dCe
e ddf
dD�Z5dEedFefdG�Z6ddd?�d@edAedBe
e dCe
e ddf
dH�Z7dd�dede
e ddfdI�Z8dJeddfdK�Z9e:fdd�dedede
e ddfdL�Z;e:dfdJededMe
e( ddfdN�Z<dedOe=de
e defdP�Z>dedQeddfdR�Z?d
edQeddfdS�Z@ddd(dT�dedede
e dUe(d+e(de(fdV�ZAdd(d:�dedede
e d+e(ddf
dW�ZBdededdfdX�ZC dxdedYe
eeDeeEf eDeeEf f dZe
eeef de
e d+e(ddfd[�ZFdd(d:�ded\ed]ede
e d+e(ddfd^�ZG dydd�dede
e d_ede
e ddf
d`�ZH dzdd�d@edAedae(de
e ddf
db�ZIddd?�d@edAedBe
e dCe
e ddf
dc�ZJd
eddfdd�ZKd
eddfde�ZLdfedgedhediedef
dj�ZMdefdk�ZNdefdl�ZOdePfdm�ZQe
dePe= fdn�� � ZRe
dePe= fdo�� � ZSe
dePe= fdp�� � ZTe
dePe= fdq�� � ZUdJedefdr�ZVdS ){�FakeOsModulea� Uses FakeFilesystem to provide a fake os module replacement.
Do not create os.path separately from os, as there is a necessary circular
dependency between os and os.path to replicate the behavior of the standard
Python modules. What you want to do is to just let FakeOsModule take care
of `os.path` setup itself.
# You always want to do this.
filesystem = fake_filesystem.FakeFilesystem()
my_os_module = fake_os.FakeOsModule(filesystem)
F�returnc � � g d�} t j � d� � r| g d�z
} t j dk r| ddgz
} t r| dgz
} | S )zqReturn the list of patched function names. Used for patching
functions imported from the module.
)�access�chdir�chmod�chown�close�fstat�fsync�getcwd�lchmod�link�listdir�lstat�makedirs�mkdir�mknod�open�read�readlink�remove�
removedirs�rename�rmdir�stat�symlink�umask�unlink�utimer �write�getcwdb�replace�linux)� fdatasync�getxattr� listxattr�removexattr�setxattr�win32�getgid�getuidr )�sys�platform�
startswithr )�_dirs �a/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/pyfakefs/fake_os.py�dirzFakeOsModule.dir] s� � �
�
�
��B �<�"�"�7�+�+� �� � � �
�D� �<�7�"�"�����
�D� � ��Y�K��D��� �
filesystemr, c � � || _ t | _ t | j | � � | _ d| _ d| _ d| _ d| _ dS )z�Also exposes self.path (to fake os.path).
Args:
filesystem: FakeFilesystem used to provide file system information
N) r` �os� os_moduler �path�_supports_follow_symlinks�_supports_dir_fd�_supports_effective_ids�_supports_fd)�selfr` s r] �__init__zFakeOsModule.__init__� sK � � %��� ���"�4�?�D�9�9�� �8<��&�/3���6:��$�+/����r_ c � � | j j S �N)rd �devnull�ri s r] rm zFakeOsModule.devnull� �
� ��y� � r_ c � � | j j S rl )rd �seprn s r] rq zFakeOsModule.sep� s � ��y�}�r_ c � � | j j S rl )rd �altseprn s r] rs zFakeOsModule.altsep� s
� ��y��r_ c � � | j j S rl )rd �lineseprn s r] ru zFakeOsModule.linesep� ro r_ c � � | j j S rl )rd �pathseprn s r] rw zFakeOsModule.pathsep� ro r_ �fd�args�kwargsc �z � t |� � st d� � � t | j � � |g|�R i |��S )a[ Redirector to open() builtin function.
Args:
fd: The file descriptor of the file to open.
*args: Pass through args.
**kwargs: Pass through kwargs.
Returns:
File object corresponding to file_des.
Raises:
TypeError: if file descriptor is not an integer.
�an integer is required)r � TypeErrorr r` )ri rx ry rz s r] �fdopenzFakeOsModule.fdopen� sK � � �2��� 6��4�5�5�5�,�|�D�O�,�,�R�A�$�A�A�A�&�A�A�Ar_ c � � | j j rdS t j dk rdS t j d� � }t j |� � |S )zReturn the current umask.r rV � )r` �
is_windows_fsrY rZ rb rJ )ri �masks r] �_umaskzFakeOsModule._umask� sG � ��?�(� ��1��<�7�"�"��5�
�8�A�;�;�D��H�T�N�N�N��Kr_ N)�dir_fdrd �flags�moder� c
� � | � || j |� � }|�'| j j rd}nd| � � � z }t t d� � o|t j z t j k }t |t j z o| |t j
z |t j t j
z z dk |t j z dk |t j
z dk |t j z dk �� � }|j r|j rt# d� � �|rG| j � |t'