HEX
Server: Apache
System: Linux sg2plmcpnl492417.prod.sin2.secureserver.net 4.18.0-553.58.1.lve.el8.x86_64 #1 SMP Fri Jul 4 12:07:06 UTC 2025 x86_64
User: nyiet8349bzl (9207396)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cloudlinux/venv/lib64/python3.11/site-packages/pyfakefs/__pycache__/fake_io.cpython-311.pyc
�

�|oi9���dZddlZddlZddlZddlmZddlmZmZm	Z	m
Z
mZmZm
Z
mZddlmZddlmZddlmZmZerddlmZGd	�d
e��ZGd�d��ZGd
�de��ZejdkrddlZGd�d��ZdSdS)zKUses :py:class:`FakeIoModule` to provide a
fake ``io`` module replacement.
�N)�Enum)�List�Optional�Callable�Union�Any�AnyStr�IO�
TYPE_CHECKING)�AnyFileWrapper)�	fake_open)�IS_PYPY�is_called_from_skipped_module)�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���b/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pyfakefs/fake_io.pyrr*s)���������C��D�	
�B�B�Brrc��eZdZdZedeefd���Zdd�Z								dde	e
efd
ededeedeedeede
deede
de	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__Gs��
%���%'�������r�r���NTF�file�mode�	buffering�encoding�errors�newline�closefd�opener�is_fake_open_codec

�H�t|j|j|||||||||	��S)z\Redirect the call to FakeFileOpen.
        See FakeFileOpen.call() for description.
        )r
r-r0)
r4r8r9r:r;r<r=r>r?r@s
          rr$zFakeIoModule.openPs;����O��O����������
�
�	
rr%c�H�t|t��ststd���|jj}|tjkr|j�|��s|tj	kr|�
|dd���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�rbT)r9r@)
�
isinstance�strr�	TypeErrorr-�patch_open_coderr�existsrr$r2r')r4�path�
patch_modes   rr'zFakeIoModule.open_codeos���
�d�C�(�(�
T��
T�� R�S�S�S���8�J��i�n�,�,��O�*�*�4�0�0�-����-�-��y�y��D�D�y�I�I�I��?�,�,�T�2�2�2rc�,�t|j|��S)z5Forwards any unfaked calls to the standard io module.)�getattrr2�r4�names  r�__getattr__zFakeIoModule.__getattr__�s���t���-�-�-r�r-r)r6r7NNNTNF)rrrr�staticmethodrrEr,r5rr	�intr�boolrrr
rr$r(r)r'rOrrrr!r!4sH�����������c������\��������"&� $�!%��%)�"'�
�
��F�C�K� �
��
��	
�
�3�-�
���
�

��#��
��
���"�
� �
�
�~�r�#�w�&�	'�
�
�
�
�:��6�!�!�	3�	3�	3�$.�.�.�.�.rr!c�$��eZdZdZd�fd�Z�xZS)�
FakeIoModule2z=Similar to ``FakeIoModule``, but fakes `_io` instead of `io`.r-rc�b��t���|��t|_dSr/)�superr5�_ior2)r4r-�	__class__s  �rr5zFakeIoModule2.__init__�s(���
	������$�$�$�����rrP)rrrrr5�
__classcell__)rYs@rrUrU�sC�������G�G����������rrU�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�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-r_�
_fcntl_moduler3s  rr5zFakeFcntlModule.__init__�s��)�D�O�!&�D���rr�fd�cmd�argc�4�t|t��rdn|S�Nr�rDrR)r4rerfrgs    rr_zFakeFcntlModule.fcntl�s��"�3��,�,�5�1�1�#�5rT�request�mutate_flagc�4�t|t��rdn|Srirj)r4rerkrgrls     rr`zFakeFcntlModule.ioctl�s��#�3��,�,�5�1�1�#�5r�	operationNc��dS�Nr)r4rerns   rrazFakeFcntlModule.flock�s���Dr�len�startc��dSrpr)r4rerfrqrr�whences      rrbzFakeFcntlModule.lockf�s	��
�Drc��t�|d��}t�|d��}|jr0t|jj|j���rt
||��St�||��S)z%Prevents patching of skipped modules.r-rd)r0�case_sensitive)�object�__getattribute__�patcherrr0�is_case_sensitiverL)r4rN�fs�fnctl_modules    rrxz FakeFcntlModule.__getattribute__�s���!'�!8�!8��|�!L�!L�B�!�2�2�4��I�I�L��z�
7�0�!�z�4�#%�#7����7�
#�<��6�6�6��*�*�4��6�6�6rc�,�t|j|��S)z8Forwards any unfaked calls to the standard fcntl module.)rLrdrMs  rrOzFakeFcntlModule.__getattr__�s���4�-�t�4�4�4rrP)r)rT)rrr)rrrrrQrrEr,r5rRr�bytesr_rSr`rarrbrxrOrrrr]r]�s{������	�	�
�	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�	�	��	� #�	�*-�	�:=�	�
�	�	�	�	�
	7�	7�	7�	5�	5�	5�	5�	5rr])rrXr1r(�enumr�typingrrrrrr	r
r�pyfakefs.fake_filer�pyfakefs.fake_openr
�pyfakefs.helpersrr�pyfakefs.fake_filesystemrrr!rU�platformr_r]rrr�<module>r�s������
�
�
�	�	�	�	�
�
�
�
�������	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�.�-�-�-�-�-�(�(�(�(�(�(�C�C�C�C�C�C�C�C��8�7�7�7�7�7�7����������O.�O.�O.�O.�O.�O.�O.�O.�d	�	�	�	�	�L�	�	�	��<�7����L�L�L�55�55�55�55�55�55�55�55�55�55��r