Your IP : 18.226.4.107
�
��bg����dZddlZddlZddlZddlZddlmZddlmZm Z m
Z
mZmZm
Z
mZmZddlmZddlmZddlmZerddlmZGd �d
e��ZGd�d��Zejd
krddlZGd�d��ZdSdS)zP Uses :py:class:`FakeIoModule` to provide a
fake ``io`` module replacement.
�N)�Enum)�List�Optional�Callable�Union�Any�AnyStr�IO�
TYPE_CHECKING)�AnyFileWrapper)�FakeFileOpen)�IS_PYPY)�FakeFilesystemc��eZdZdZdZdZdZdS)� PatchModezvDefines if patching shall be on, off, or in automatic mode.
Currently only used for `patch_open_code` option.
���N)�__name__�
__module__�__qualname__�__doc__�OFF�AUTO�ON���a/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/pyfakefs/fake_io.pyrr*s)���������C��D�
�B�B�Brrc��eZdZdZedeefd���Zdd�Z dde e
efded
edeedeedeede
deede eeeffd�Zejdkrd�Zd�Zd S)�FakeIoModulez�Uses FakeFilesystem to provide a fake io module replacement.
You need a fake_filesystem to use this:
filesystem = fake_filesystem.FakeFilesystem()
my_io_module = fake_io.FakeIoModule(filesystem)
�returnc�V�dg}tjdkr|�d��|S)zqReturn the list of patched function names. Used for patching
functions imported from the module.
�open�r�� open_code)�sys�version_info�append)�_dirs r�dirzFakeIoModule.dir<s0��
�x����v�%�%��K�K��$�$�$��r�
filesystemrc�:�||_g|_t|_dS)zg
Args:
filesystem: FakeFilesystem used to provide file system information.
N)r,�
skip_names�io�
_io_module��selfr,s r�__init__zFakeIoModule.__init__Fs��
%���%'�������r�r���NT�file�mode� buffering�encoding�errors�newline�closefd�openerc
���tjd���} tj�| dj��d���tjd���t�fd�|j D����rtj||||||||��St|j
��}
|
||||||||��S)z\Redirect the call to FakeFileOpen.
See FakeFileOpen.call() for description.
r)�limitr�.c�L��g|] }�|kp��d|z����!S)r@)�endswith)�.0�sn�module_names �r�
<listcomp>z%FakeIoModule.open.<locals>.<listcomp>esE���
�
�
���r�!�C�[�%9�%9�#��(�%C�%C�
�
�
r)� traceback�
extract_stack�os�path�splitext�filename�replace�sep�anyr.r/r#r
r,)r2r6r7r8r9r:r;r<r=�stack� fake_openrEs @rr#zFakeIoModule.openOs����$�'�a�0�0�0���g�&�&�u�Q�x�'8�9�9�!�<��!�)�)�"�&�#�6�6���
�
�
�
��/�
�
�
�
�
� ��7��������� � �
�!���1�1� ��y��$� �8�V�W�g�v�
�
�
rr$c�F�t|t��ststd���|jj}|tjkr|j�|��s|tj kr|�
|d���S|j�|��S)z�Redirect the call to open. Note that the behavior of the real
function may be overridden by an earlier call to the
PyFile_SetOpenCodeHook(). This behavior is not reproduced here.
z0open_code() argument 'path' must be str, not int�rb)r7)
�
isinstance�strr� TypeErrorr,�patch_open_coderr�existsrr#r0r&)r2rJ�
patch_modes rr&zFakeIoModule.open_code{s���
�d�C�(�(�
T��
T�� R�S�S�S���8�J��i�n�,�,��O�*�*�4�0�0�-����-�-��y�y��D�y�1�1�1��?�,�,�T�2�2�2rc�,�t|j|��S)z5Forwards any unfaked calls to the standard io module.)�getattrr0�r2�names r�__getattr__zFakeIoModule.__getattr__�s���t���-�-�-r�r,r)r4r5NNNTN)rrrr�staticmethodrrUr+r3rr �intr�boolrrr
rr#r'r(r&r^rrrr r 4s<�����������c������\��������"&� $�!%��%)�(
�(
��F�C�K� �(
��(
�� (
�
�3�-�(
���
�
(
��#��(
��(
���"�(
�
�~�r�#�w�&� '�(
�(
�(
�(
�T��6�!�!� 3� 3� 3�$.�.�.�.�.rr �win32c
���eZdZdZedeefd���Zdd�Zdde d e d
e de
e effd�Z dde d
e d
e de
de
e eff
d�Zde de ddfd�Z dde d e de de def
d�Zd�ZdS)�FakeFcntlModulezvReplaces the fcntl module. Only valid under Linux/MacOS,
currently just mocks the functionality away.
r!c�
�gd�S)zyReturn the list of patched function names. Used for patching
functions imported from the module.
)�fcntl�ioctl�flock�lockfrrrrr+zFakeFcntlModule.dir�s��
8�7�7�7rr,rc�,�||_t|_dS)z�
Args:
filesystem: FakeFilesystem used to provide file system
information (currently not used).
N)r,rg�
_fcntl_moduler1s rr3zFakeFcntlModule.__init__�s��)�D�O�!&�D���rr�fd�cmd�argc�4�t|t��rdn|S�Nr�rTra)r2rmrnros rrgzFakeFcntlModule.fcntl�s��"�3��,�,�5�1�1�#�5rT�request�mutate_flagc�4�t|t��rdn|Srqrr)r2rmrsrorts rrhzFakeFcntlModule.ioctl�s��#�3��,�,�5�1�1�#�5r� operationNc��dS�Nr)r2rmrvs rrizFakeFcntlModule.flock�s���Dr�len�startc��dSrxr)r2rmrnryrz�whences rrjzFakeFcntlModule.lockf�s ��
�Drc�,�t|j|��S)z8Forwards any unfaked calls to the standard fcntl module.)r[rlr\s rr^zFakeFcntlModule.__getattr__�s���4�-�t�4�4�4rr_)r)rT)rrr)rrrrr`rrUr+r3rar�bytesrgrbrhrirrjr^rrrrere�sl������ � �
� 8�T�#�Y� 8� 8� 8�
�� 8� '� '� '� '� 6� 6�C� 6�c� 6�� 6�E�#�u�*�<M� 6� 6� 6� 6�LP� 6� 6�� 6�$'� 6�.1� 6�DH� 6�
�3��:�
� 6� 6� 6� 6�
�C� �C� �D� � � � �KL� � �� � #� �*-� �:=� �
� � � � �
5� 5� 5� 5� 5rre)rr/rIr'rG�enumr�typingrrrrrr r
r�pyfakefs.fake_filer�pyfakefs.fake_openr
�pyfakefs.helpersr�pyfakefs.fake_filesystemrrr �platformrgrerrr�<module>r�s�����
� � � � � � � �
�
�
�
����������� � � � � � � � � � � � � � � � � � � � �.�-�-�-�-�-�+�+�+�+�+�+�$�$�$�$�$�$��8�7�7�7�7�7�7����������[.�[.�[.�[.�[.�[.�[.�[.�|�<�7����L�L�L�'5�'5�'5�'5�'5�'5�'5�'5�'5�'5��r
?>