HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/twisted/logger/__pycache__/_io.cpython-38.pyc
U

�b��@sndZddlZddlmZmZmZddlmZddlm	Z	ddl
mZddlm
Z
dd	lmZGd
d�d�ZdS)z
File-like object that logs.
�N)�AnyStr�Iterable�Optional)�
NamedConstant)�Version)�deprecatedProperty�)�LogLevel)�Loggerc@sBeZdZdZdZeedddd��dd��Zejdd��Ze	j
d	feee
ed	d
�dd�Zeed
�dd��Zeed
�dd��Zeed
�dd��Zed	d
�dd��Zeed
�dd��Zd	d
�dd�Zd	d
�dd�Zed
�dd�Zed
�dd�Zed	d �d!d"�Zeed	d#�d$d%�Ze d	d&�d'd(�Z!e!Z"e!Z#e!Z$e!Z%e!Z&e!Z'e!Z(e!Z)d	S))�LoggingFileac
    File-like object that turns C{write()} calls into logging events.

    Note that because event formats are L{str}, C{bytes} received via C{write()}
    are converted to C{str}, which is the opposite of what C{file} does.

    @ivar softspace: Attribute to make this class more file-like under Python 2;
        value is zero or one.  Do not use.
    r�Twisted��cCs|jS�N��
_softspace��self�r�4/usr/lib/python3/dist-packages/twisted/logger/_io.py�	softspace!szLoggingFile.softspacecCs
||_dSrr)r�valuerrrr%sN)�logger�level�encoding�returncCs6||_||_|dkr t��|_n||_d|_d|_dS)a
        @param logger: the logger to log through.
        @param level: the log level to emit events with.
        @param encoding: The encoding to expect when receiving bytes via
            C{write()}.  If L{None}, use C{sys.getdefaultencoding()}.
        N�F)r�log�sys�getdefaultencoding�	_encoding�_buffer�_closed)rrrrrrr�__init__)szLoggingFile.__init__)rcCs|jS)zm
        Read-only property.  Is the file closed?

        @return: true if closed, otherwise false.
        �r"rrrr�closed@szLoggingFile.closedcCs|jS)zU
        Read-only property.   File encoding.

        @return: an encoding.
        )r rrrrrIszLoggingFile.encodingcCsdS)zG
        Read-only property.  File mode.

        @return: "w"
        �wrrrrr�modeRszLoggingFile.modecCsdS)z_
        Read-only property.  Types of newlines encountered.

        @return: L{None}
        Nrrrrr�newlines[szLoggingFile.newlinescCsd�|jj|jj|jj�S)z�
        The name of this file; a repr-style string giving information about its
        namespace.

        @return: A file name.
        z
<{} {}#{}>)�format�	__class__�__name__r�	namespacer�namerrrrr-ds
�zLoggingFile.namecCs
d|_dS)zD
        Close this file so it can no longer be written to.
        TNr$rrrr�closerszLoggingFile.closecCsdS)z3
        No-op; this file does not buffer.
        Nrrrrr�flushxszLoggingFile.flushcCsdS)zp
        Returns an invalid file descriptor, since this is not backed by an FD.

        @return: C{-1}
        ���rrrrr�fileno~szLoggingFile.filenocCsdS)zK
        A L{LoggingFile} is not a TTY.

        @return: C{False}
        Frrrrr�isatty�szLoggingFile.isatty)�messagercCsr|jrtd��t|t�r&|�|j�}n|}|j|�d�}|d|_|dd�}|D]}|jj	|j
d|d�qTdS)zW
        Log the given message.

        @param message: The message to write.
        zI/O operation on closed file�
r0rz{log_io})r)Zlog_ioN)r"�
ValueError�
isinstance�bytes�decoder r!�splitr�emitr)rr3�text�lines�linerrr�write�s

zLoggingFile.write)r<rcCs|D]}|�|�qdS)zj
        Log each of the given lines as a separate message.

        @param lines: Data to write.
        N)r>)rr<r=rrr�
writelines�szLoggingFile.writelines)�argsrcGstd��dS)zW
        Template for unsupported operations.

        @param args: Arguments.
        zunsupported operationN)�OSError)rr@rrr�_unsupported�szLoggingFile._unsupported)*r+�
__module__�__qualname__�__doc__rrrr�setterr	�infor
rr�strr#�property�boolr%rr'r(r-r.r/�intr1r2rr>rr?�objectrB�read�next�readline�	readlinesZ
xreadlines�seek�tell�truncaterrrrrsN


��
	r)rEr�typingrrr�
constantlyr�incrementalrZtwisted.python.deprecater�_levelsr	�_loggerr
rrrrr�<module>s