文件操作 - posix_utils.cpython-311.pyc
返回文件管理
返回主菜单
删除本文件
文件: /usr/lib/python3/dist-packages/prompt_toolkit/input/__pycache__/posix_utils.cpython-311.pyc
编辑文件内容
� �Ïca � �B � d dl Z d dlZd dlmZ dgZ G d� d� � ZdS )� N)�getincrementaldecoder�PosixStdinReaderc �@ � e Zd ZdZ d dedededdfd �Zddedefd�ZdS )r a� Wrapper around stdin which reads (nonblocking) the next available 1024 bytes and decodes it. Note that you can't be sure that the input file is closed if the ``read`` function returns an empty string. When ``errors=ignore`` is passed, ``read`` can return an empty string if all malformed input was replaced by an empty string. (We can't block here and wait for more input.) So, because of that, check the ``closed`` attribute, to be sure that the file has been closed. :param stdin_fd: File descriptor from which we read. :param errors: Can be 'ignore', 'strict' or 'replace'. On Python3, this can be 'surrogateescape', which is the default. 'surrogateescape' is preferred, because this allows us to transfer unrecognised bytes to the key bindings. Some terminals, like lxterminal and Guake, use the 'Mxx' notation to send mouse events, where each 'x' can be any possible byte. �surrogateescape�utf-8�stdin_fd�errors�encoding�returnNc � � || _ || _ t |� � | _ | � |�� � | _ d| _ d S )N)r F)r r r �_stdin_decoder_cls�_stdin_decoder�closed)�selfr r r s �B/usr/lib/python3/dist-packages/prompt_toolkit/input/posix_utils.py�__init__zPosixStdinReader.__init__$ sJ � � !�� ���� #8��"A�"A���"�5�5�V�5�D�D��� ����� � �countc �> � | j rdS t j | j gg g d� � d sdS n# t $ r d| _ Y nw xY w t j | j |� � }|dk r d| _ dS n# t $ r d}Y nw xY w| j � |� � S )z� Read the input and return it as a string. Return the text. Note that this can return an empty string, even when the input stream was not yet closed. This means that something went wrong during the decoding. � r Tr )r �selectr �OSError�os�readr �decode)r r �datas r r zPosixStdinReader.read3 s� � � �;� ��2� ��=�$�-��"�b�!�<�<�Q�?� ��r� ��� � � � �D�K�K�K� ���� ��7�4�=�%�0�0�D� �s�{�{�"����r� �� � � � ��D�D�D� ���� �"�)�)�$�/�/�/s! �#1 �A�A� 'A3 �3B�B)r r )r )�__name__� __module__�__qualname__�__doc__�int�strr r � r r r r s� � � � � � �� �4 OV� � �� �%(� �HK� � � � � � �,0� ,0�#� ,0�� ,0� ,0� ,0� ,0� ,0� ,0r )r r �codecsr �__all__r r$ r r �<module>r'