/usr/lib/python3/dist-packages/twisted/python/__pycache__
Edit: /usr/lib/python3/dist-packages/twisted/python/__pycache__/logfile.cpython-310.pyc (10459B)
o
¯b‡' ã @ s˜ d Z ddlZddlZddlZddlZddlmZmZmZ ddl m
Z
G dd„ dƒZG dd„ deƒZe
e¡ G d d
„ d
eƒZe
e¡ G dd„ dƒZdS )
z!
A rotating, browsable log file.
é N)ÚBinaryIOÚOptionalÚcast)Ú
threadablec @ s~ e Zd ZdZddgZ ddededee ddfd d
„Ze dd„ ƒZ
d
d„ Zdd„ Zdd„ Z
dd„ Zdd„ Zdd„ Zdd„ ZdS )ÚBaseLogFilez<
The base class for a log file that can be rotated.
ÚwriteÚrotateNÚnameÚ directoryÚdefaultModeÚreturnc C s` || _ || _tj ||¡| _|du r'tj | j¡r't t | j¡tj ¡| _ n|| _ |
¡ dS )a
Create a log file.
@param name: name of the file
@param directory: directory holding the file
@param defaultMode: permissions used to create the file. Default to
current permissions of the file if the file exists.
N)r
r ÚosÚpathÚjoinÚexistsÚstatÚS_IMODEÚST_MODEr Ú _openFile)Úselfr r
r © r ú8/usr/lib/python3/dist-packages/twisted/python/logfile.pyÚ__init__ s ÿzBaseLogFile.__init__c O s4 t j |¡}| t j |¡t j |¡g|¢R i |¤ŽS )z=
Construct a log file from a full file path.
)r
r ÚabspathÚbasenameÚdirname)ÚclsÚfilenameÚargsÚkwargsÚlogPathr r r ÚfromFullPath2 s (zBaseLogFile.fromFullPathc C s t ‚)zc
Override with a method to that returns true if the log
should be rotated.
)ÚNotImplementedError©r r r r ÚshouldRotate: s zBaseLogFile.shouldRotatec C sÐ d| _ tj | j¡rttt| jddƒƒ| _| j dd¡ n.| j dur@t
d¡}zttt| jddƒƒ| _W t
|¡ nt
|¡ w ttt| jddƒƒ| _| j durfzt | j| j ¡ W dS tye Y dS w dS )z[
Open the log file.
The log file is always opened in binary mode.
Fzrb+r é Niÿ zwb+)
Úclosedr
r r r r ÚopenÚ_fileÚseekr ÚumaskÚchmodÚOSError)r ÚoldUmaskr r r r A s"
þýzBaseLogFile._openFilec C s<