HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/twisted/logger/__pycache__/_io.cpython-38.pyc
U


W[k�@s,dZddlZddlmZGdd�de�ZdS)z
File-like object that logs.
�N�)�LogLevelc@s�eZdZdZdZejdfdd�Zedd��Z	edd	��Z
ed
d��Zedd
��Zedd��Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZeZeZeZeZeZeZeZeZdS)�LoggingFilean
    File-like object that turns C{write()} calls into logging events.

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

    @ivar softspace: File-like L{'softspace' attribute <file.softspace>}; zero
        or one.
    @type softspace: L{int}
    rNcCs6||_||_|dkr t��|_n||_d|_d|_dS)at
        @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()}.
        @type encoding: L{str}

        @param log: The logger to send events to.
        @type log: L{Logger}
        N�F)�level�log�sys�getdefaultencoding�	_encoding�_buffer�_closed)�selfZloggerr�encoding�r�4/usr/lib/python3/dist-packages/twisted/logger/_io.py�__init__s
zLoggingFile.__init__cCs|jS)z�
        Read-only property.  Is the file closed?

        @return: true if closed, otherwise false.
        @rtype: L{bool}
        �r�r
rrr�closed8szLoggingFile.closedcCs|jS)zl
        Read-only property.   File encoding.

        @return: an encoding.
        @rtype: L{str}
        )r
rrrrrCszLoggingFile.encodingcCsdS)z^
        Read-only property.  File mode.

        @return: "w"
        @rtype: L{str}
        �wrrrrr�modeNszLoggingFile.modecCsdS)zw
        Read-only property.  Types of newlines encountered.

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

        @return: A file name.
        @rtype: L{str}
        z
<{0} {1}#{2}>)�format�	__class__�__name__r�	namespacer�namerrrrrds
��zLoggingFile.namecCs
d|_dS)zD
        Close this file so it can no longer be written to.
        TNrrrrr�closevszLoggingFile.closecCsdS)z3
        No-op; this file does not buffer.
        Nrrrrr�flush}szLoggingFile.flushcCsdS)z�
        Returns an invalid file descriptor, since this is not backed by an FD.

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

        @return: C{False}
        @rtype: L{bool}
        Frrrrr�isatty�szLoggingFile.isattycCsl|jrtd��t|t�r$|�|j�}|j|�d�}|d|_|dd�}|D]}|jj	|j
d|d�qNdS)z�
        Log the given message.

        @param string: Data to write.
        @type string: L{bytes} in this file's preferred encoding or L{unicode}
        zI/O operation on closed file�
rrz{log_io})rZlog_ioN)r�
ValueError�
isinstance�bytes�decoder
r�splitr�emitr)r
�string�lines�linerrr�write�s

zLoggingFile.writecCs|D]}|�|�qdS)z�
        Log each of the given lines as a separate message.

        @param lines: Data to write.
        @type lines: iterable of L{unicode} or L{bytes} in this file's
            declared encoding
        N)r,)r
r*r+rrr�
writelines�szLoggingFile.writelinescGstd��dS)z~
        Template for unsupported operations.

        @param args: Arguments.
        @type args: tuple of L{object}
        zunsupported operationN)�IOError)r
�argsrrr�_unsupported�szLoggingFile._unsupported)r�
__module__�__qualname__�__doc__Z	softspacer�infor�propertyrrrrrrrr r!r,r-r0�read�next�readline�	readlinesZ
xreadlines�seek�tell�truncaterrrrrs8











r)r3rZ_levelsr�objectrrrrr�<module>s