Ë
    ojÀ  ã                   ót   — d Z ddlZddlmZmZmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ dd	lmZ  G d
„ d«      Zy)z
File-like object that logs.
é    N)ÚAnyStrÚIterableÚOptional)ÚNamedConstant)ÚVersion)ÚdeprecatedPropertyé   )ÚLogLevel)ÚLoggerc            	       ó†  — e Zd ZdZdZ e edddd«      «      d„ «       Zej                  d„ «       Ze	j                  dfd	ed
edee   ddfd„Zedefd„«       Zedefd„«       Zedefd„«       Zedd„«       Zedefd„«       Zdd„Zdd„Zdefd„Zdefd„Zdeddfd„Zdee   ddfd„Zde ddfd„Z!e!Z"e!Z#e!Z$e!Z%e!Z&e!Z'e!Z(e!Z)y)Ú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é   é   c                 ó   — | j                   S ©N©Ú
_softspace©Úselfs    ú4/usr/lib/python3/dist-packages/twisted/logger/_io.pyÚ	softspacezLoggingFile.softspace!   s   € à�‰Ðó    c                 ó   — || _         y r   r   )r   Úvalues     r   r   zLoggingFile.softspace%   s	   € àˆ�r   NÚloggerÚlevelÚencodingÚreturnc                 ó‚   — || _         || _        |€t        j                  «       | _        n|| _        d| _        d| _        y)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)r   r   r   r   s       r   Ú__init__zLoggingFile.__init__)   s=   € ð ˆŒ
ØˆŒàÐÜ ×3Ñ3Ó5ˆD�Nà%ˆDŒNàˆŒØˆ�r   c                 ó   — | j                   S )zm
        Read-only property.  Is the file closed?

        @return: true if closed, otherwise false.
        ©r'   r   s    r   ÚclosedzLoggingFile.closed@   s   € ð �|‰|Ðr   c                 ó   — | j                   S )zU
        Read-only property.   File encoding.

        @return: an encoding.
        )r%   r   s    r   r   zLoggingFile.encodingI   s   € ð �~‰~Ðr   c                  ó   — y)zG
        Read-only property.  File mode.

        @return: "w"
        Úw© r   s    r   ÚmodezLoggingFile.modeR   s   € ð r   c                  ó   — y)z_
        Read-only property.  Types of newlines encountered.

        @return: L{None}
        Nr/   r   s    r   ÚnewlineszLoggingFile.newlines[   s   € ð r   c                 ó    — dj                  | j                  j                  | j                  j                  | j
                  j                  «      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   Únamer   s    r   r8   zLoggingFile.named   s<   € ð ×"Ñ"Ø�N‰N×#Ñ#Ø�H‰H×ÑØ�J‰J�O‰Oó
ð 	
r   c                 ó   — d| _         y)zD
        Close this file so it can no longer be written to.
        TNr*   r   s    r   ÚclosezLoggingFile.closer   s   € ð ˆ�r   c                  ó   — y)z3
        No-op; this file does not buffer.
        Nr/   r   s    r   ÚflushzLoggingFile.flushx   s   € ð 	r   c                  ó   — y)zp
        Returns an invalid file descriptor, since this is not backed by an FD.

        @return: C{-1}
        éÿÿÿÿr/   r   s    r   ÚfilenozLoggingFile.fileno~   s   € ð r   c                  ó   — y)zK
        A L{LoggingFile} is not a TTY.

        @return: C{False}
        Fr/   r   s    r   ÚisattyzLoggingFile.isatty†   s   € ð r   Úmessagec                 óF  — | j                   rt        d«      ‚t        |t        «      r|j	                  | j
                  «      }n|}| j                  |z   j                  d«      }|d   | _        |dd }|D ]*  }| j                  j                  | j                  d|¬«       Œ, y)zW
        Log the given message.

        @param message: The message to write.
        zI/O operation on closed fileú
r>   r   z{log_io})r4   Úlog_ioN)r'   Ú
ValueErrorÚ
isinstanceÚbytesÚdecoder%   r&   Úsplitr"   Úemitr   )r   rB   ÚtextÚlinesÚlines        r   ÚwritezLoggingFile.writeŽ   s’   € ð �<Š<ÜÐ;Ó<Ð<ä�gœuÔ%Ø—>‘> $§.¡.Ó1‰DàˆDà—‘ Ñ$×+Ñ+¨DÓ1ˆØ˜R‘yˆŒØ�a˜�ˆàò 	FˆDØ�H‰H�M‰M˜$Ÿ*™*¨ZÀˆMÕEñ	Fr   rM   c                 ó4   — |D ]  }| j                  |«       Œ y)zj
        Log each of the given lines as a separate message.

        @param lines: Data to write.
        N)rO   )r   rM   rN   s      r   Ú
writelineszLoggingFile.writelines£   s   € ð ò 	ˆDØ�J‰J�tÕñ	r   Úargsc                 ó   — t        d«      ‚)zW
        Template for unsupported operations.

        @param args: Arguments.
        zunsupported operation)ÚOSError)r   rR   s     r   Ú_unsupportedzLoggingFile._unsupported¬   s   € ô Ð-Ó.Ð.r   )r   N)*r6   Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   Úsetterr
   Úinfor   r   r   Ústrr(   ÚpropertyÚboolr+   r   r0   r2   r8   r:   r<   Úintr?   rA   r   rO   r   rQ   ÚobjectrU   ÚreadÚnextÚreadlineÚ	readlinesÚ
xreadlinesÚseekÚtellÚtruncater/   r   r   r   r      s’  „ ñð €Já™ 	¨2¨q°!Ó4Ó5ñó 6ðð ×Ññ ó ð ð  (Ÿ}™}Ø"&ñ	àðð ðð ˜3‘-ð	ð
 
óð. ð˜ò ó ðð ð˜#ò ó ðð ð�cò ó ðð òó ðð ð
�cò 
ó ð
óóð˜ó ð˜ó ðF˜Vð F¨ó Fð* ¨Ñ 0ð °Tó ð/ &ð /¨Tó /ð €DØ€DØ€HØ€IØ€JØ€DØ€DØ�Hr   r   )rX   r#   Útypingr   r   r   Ú
constantlyr   Úincrementalr   Útwisted.python.deprecater   Ú_levelsr
   Ú_loggerr   r   r/   r   r   ú<module>rn      s0   ðñ
ó ß -Ñ -å $Ý å 7Ý Ý ÷gò gr   