HEX
Server: LiteSpeed
System: Linux br-asc-web1845.main-hosting.eu 5.14.0-611.42.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 24 05:30:20 EDT 2026 x86_64
User: u790421558 (790421558)
PHP: 8.2.30
Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python311/lib/python3.11/site-packages/loguru/__pycache__/_file_sink.cpython-311.pyc
�

a�ZgD8��
�ddlZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
mZddlm
ZddlmZmZddlmZd�ZGd	�d
��ZGd�d��ZGd
�d��ZGd�d��ZGd�d��ZdS)�N)�partial)�ST_DEV�ST_INO�)�_string_parsers)�	get_ctime�	set_ctime)�	aware_nowc�J�tj�|��}t|��}d�|||��}d}tj�|��r<|dz
}d�||||��}tj�|���<|S)Nz{}.{}{}rz
{}.{}.{}{})�datetime�
fromtimestamp�FileDateFormatter�format�os�path�exists)�root�ext�
creation_time�creation_datetime�date�renamed_path�counters       �D/opt/alt/python311/lib/python3.11/site-packages/loguru/_file_sink.py�generate_rename_pathrs��� �)�7�7�
�F�F���.�/�/�D��#�#�D�$��4�4�L��G�
�'�.�.��
&�
&�E��1���#�*�*�4��w��D�D��
�'�.�.��
&�
&�E���c��eZdZdd�Zd�ZdS)rNc�0�|p
t��|_dS�N)r
r)�selfrs  r�__init__zFileDateFormatter.__init__s�� �/�I�K�K��
�
�
rc�>�|sd}|j�|��S)Nz%Y-%m-%d_%H-%M-%S_%f)r�
__format__)r �specs  rr#zFileDateFormatter.__format__"s%���	*�)�D��}�'�'��-�-�-rr)�__name__�
__module__�__qualname__r!r#�rrrrs7������0�0�0�0�.�.�.�.�.rrc�f�eZdZed���Zed���Zed���Zed���ZdS)�Compressionc��||fi|��5}|�|tj�|����ddd��dS#1swxYwYdSr)�addrr�basename��path_in�path_out�opener�kwargs�f_comps     r�add_compresszCompression.add_compress)s���
�V�H�
'�
'��
'�
'�	;�6��J�J�w��� 0� 0�� 9� 9�:�:�:�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;����	;�	;�	;�	;�	;�	;��4A�A�Ac��||fi|��5}|�|tj�|����ddd��dS#1swxYwYdSr)�writerrr-r.s     r�write_compresszCompression.write_compress.s���
�V�H�
'�
'��
'�
'�	=�6��L�L��"�'�"2�"2�7�";�";�<�<�<�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=����	=�	=�	=�	=�	=�	=r5c���t|d��5}||fi|��5}tj||��ddd��n#1swxYwYddd��dS#1swxYwYdS)N�rb)�open�shutil�copyfileobj)r/r0r1r2�f_in�f_outs      r�
copy_compresszCompression.copy_compress3s���
�'�4�
 �
 �	0�D����+�+�F�+�+�
0�u��"�4��/�/�/�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0����
0�
0�
0�
0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0�	0�	0s1�
A�=�A�A	�A�A	�A�A�Ac�d�d�||��}tj�|��rZt	|��}tj�|��\}}t
|||z|��}tj||��|||��tj|��dS)Nz{}{})	rrrrr�splitextr�rename�remove)r/r�compress_functionr0rr�
ext_beforers        r�compressionzCompression.compression9s����=�=��#�.�.��
�7�>�>�(�#�#�	.�%�h�/�/�M�!�w�/�/��8�8��D�*�/��j�3�6F�
�V�V�L��I�h��-�-�-���'�8�,�,�,�
�	�'�����rN)r%r&r'�staticmethodr4r8r@rGr(rrr*r*(s~�������;�;��\�;��=�=��\�=��0�0��\�0�
�	�	��\�	�	�	rr*c�:�eZdZed���Zed���ZdS)�	Retentionc�l�d�}t||���|d�D]}tj|���dS)Nc�:�tj|��j|fSr)r�stat�st_mtime)�logs r�key_logz*Retention.retention_count.<locals>.key_logIs���W�S�\�\�*�*�C�0�0r)�key)�sortedrrD)�logs�numberrPrOs    r�retention_countzRetention.retention_countGsQ��	1�	1�	1��$�G�,�,�,�V�W�W�5�	�	�C��I�c�N�N�N�N�	�	rc���tj������}|D]6}tj|��j||z
krtj|���7dSr)r�now�	timestamprrMrNrD)rS�seconds�trOs    r�
retention_agezRetention.retention_ageOsc����!�!�#�#�-�-�/�/���	�	�C��w�s�|�|�$��G��3�3��	�#�����	�	rN)r%r&r'rHrUr[r(rrrJrJFsH����������\������\���rrJc��eZdZed���Zed���Zed���Zed���ZGd�d��ZdS)�Rotationc�2�|tjd���zS)Nr��days)r�	timedelta)rZs r�forward_dayzRotation.forward_dayXs���8�%�1�-�-�-�-�-rc�j�	|tjd���z
}|���|kr|S�3)NTrr_)rra�weekday)rZrds  r�forward_weekdayzRotation.forward_weekday\s<��	�
��#��+�+�+�+�A��y�y�{�{�g�%�%���	rc��||zSrr()rZ�intervals  r�forward_intervalzRotation.forward_intervalcs���8�|�rc�~�|�dd��|���t|��z|kS)Nr�)�seek�tell�len)�message�file�
size_limits   r�
rotation_sizezRotation.rotation_sizegs1���	�	�!�Q�����y�y�{�{�S��\�\�)�J�6�6rc��eZdZdd�Zd�ZdS)�Rotation.RotationTimeNc�0�||_||_d|_dSr)�
_step_forward�
_time_init�_limit)r �step_forward�	time_inits   rr!zRotation.RotationTime.__init__ms��!-�D��'�D�O��D�K�K�Krc��|jd}|j��Ttj�|j��}t
|��}t||��tj�	|tj
j���}|j}|�D|�
|j���d���}|�|��}n�|j�|jn|j}	|�
|	���|j|j|j|j���}||kr|�|��}|j�|�d���}||_|jj�|�d���}||jkr7|j|kr*|�|j��|_|j|k�*dSdS)N�time)�tz)�tzinfo)�hour�minute�second�microsecondTF)�recordrwrr�realpath�namerr	rr
�timezone�utcrv�
astimezoner}�replacerur~rr�r�)
r rnro�record_time�filepathr�
start_timery�limitr}s
          r�__call__zRotation.RotationTime.__call__rs���!�.��0�K��{�"��7�+�+�D�I�6�6�� )�(� 3� 3�
��(�M�2�2�2�%�.�<�<�!�h�&7�&;�=���
�!�O�	��$�&�1�1�+�2D�E�E�M�M�UY�M�Z�Z�E� �.�.�u�5�5�E�E�3<�3C�3K�[�/�/�QZ�Qa�F�&�1�1�&�9�9�A�A�&�^�(�/�(�/�$-�$9�	B���E��
�*�*� $� 2� 2�5� 9� 9�� �'�/� %�
�
�T�
� :� :��#����{�!�)�)�1�1��1�>�>���d�k�)�)��k�[�0�0�"&�"4�"4�T�[�"A�"A�D�K��k�[�0�0��t��5rr)r%r&r'r!r�r(rr�RotationTimersls7������	�	�	�	�
(	�(	�(	�(	�(	rr�N)	r%r&r'rHrbrerhrqr�r(rrr]r]Ws��������.�.��\�.�����\������\���7�7��\�7�.�.�.�.�.�.�.�.�.�.rr]c	��eZdZddddddddd�d�Zd�Zd	�Zd
�Zd�Zd�Zd
�Z	d�Z
d�Zdd�d�Ze
d���Ze
d���Ze
d���Ze
d���ZdS)�FileSinkNF�ar�utf8)�rotation�	retentionrG�delay�watch�mode�	buffering�encodingc��|	|_i|
�|||jd��|_t|��|_|�|j��|_|�|��|_|�|��|_	|�
|��|_d|_d|_
||_d|_d|_|s@|���}|�|��|�|��dSdS)N)r�r�r����)r��_kwargs�str�_path�_make_glob_patterns�_glob_patterns�_make_rotation_function�_rotation_function�_make_retention_function�_retention_function�_make_compression_function�_compression_function�_file�
_file_path�_watch�	_file_dev�	_file_ino�_create_path�_create_dirs�_create_file)r rr�r�rGr�r�r�r�r�r2s           rr!zFileSink.__init__�s��!��
�b�&�b�$�Y�TX�Ta�b�b�b�����Y�Y��
�"�6�6�t�z�B�B���"&�">�">�x�"H�"H���#'�#@�#@��#K�#K�� �%)�%D�%D�[�%Q�%Q��"���
��������������	$��$�$�&�&�D����d�#�#�#����d�#�#�#�#�#�	$�	$rc�j�|j�>|���}|�|��|�|��|jr|���|j�1|�||j��r|�d���|j�|��dS)NT��is_rotating)	r�r�r�r�r��_reopen_if_neededr��_terminate_filer7)r rnrs   rr7zFileSink.write�s����:���$�$�&�&�D����d�#�#�#����d�#�#�#��;�	%��"�"�$�$�$��"�.�4�3J�3J�7�TX�T^�3_�3_�.�� � �T� �2�2�2��
����!�!�!�!�!rc�h�|jr|���|�d���dS)NFr�)r�r�r��r s r�stopz
FileSink.stop�s;���;�	%��"�"�$�$�$������/�/�/�/�/rc��gSrr(r�s r�tasks_to_completezFileSink.tasks_to_complete�s���	rc��|j�dt��i��}tj�|��S)Nr{)r��
format_maprrr�abspath)r rs  rr�zFileSink._create_path�s7���z�$�$�f�.?�.A�.A�%B�C�C���w���t�$�$�$rc�p�tj�|��}tj|d���dS)NT)�exist_ok)rr�dirname�makedirs)r rr�s   rr�zFileSink._create_dirs�s0���'�/�/�$�'�'��
��G�d�+�+�+�+�+�+rc��t|fi|j��|_||_|jrS|j���}t
j|��}|t|_	|t|_dSdSr)r;r�r�r�r��filenor�fstatrr�rr�)r rr��results    rr�zFileSink._create_file�sr���$�/�/�$�,�/�/��
�����;�	,��Z�&�&�(�(�F��X�f�%�%�F�#�F�^�D�N�#�F�^�D�N�N�N�		,�	,rc��|j���|j���d|_d|_d|_d|_dS)Nr�)r��flush�closer�r�r�r�s r�_close_filezFileSink._close_file�sJ���
�������
��������
�����������rc�R�|jsdS|j}	tj|��}n#t$rd}YnwxYw|r,|t
|jks|t|jkr@|�	��|�
|��|�|��dSdSr)r�r�rrM�FileNotFoundErrorrr�rr�r�r�r�)r r�r�s   rr�zFileSink._reopen_if_needed�s����z�	��F��?��	��W�X�&�&�F�F�� �	�	�	��F�F�F�	�����	(����4�>�9�9�V�F�^�t�~�=]�=]����������h�'�'�'����h�'�'�'�'�'�>^�=]s�'�6�6r�c���|j}|j�|���|r�|���}|�|��||krYt|��}tj�|��\}}t|||��}t
j
||��|}|s|j�X|j�|�|�|��|j
�3d�|jD��}|�
t|����|rU|�|��t#|t$j��������dSdS)Nc�~�h|]:}tj|��D]#}tj�|���!|��$�;Sr()�globrr�isfile)�.0�patternros   r�	<setcomp>z+FileSink._terminate_file.<locals>.<setcomp>s]������ $�	�'� 2� 2�����w�~�~�d�+�+�	�����r)r�r�r�r�r�rrrrBrrCr�r�r�r��listr�r	rrWrX)	r r��old_path�new_pathrrrrrSs	         rr�zFileSink._terminate_files{���?���:�!��������		(��(�(�*�*�H����h�'�'�'��8�#�#� )�(� 3� 3�
��G�,�,�X�6�6�	��c�3�D�#�}�M�M���	�(�L�1�1�1�'���	5�$�1�9��)�5�(�:N��*�*�8�4�4�4��'�3���#'�#6������(�(��d���4�4�4��	E����h�'�'�'��h�� 1� 5� 5� 7� 7� A� A� C� C�D�D�D�D�D�	E�	Erc��tj��}|�|��}d�d�|D����}tj�|��\}}|s||dzgS||dz|dz|z|dz|zdzgS)N�c3�TK�|]#^}}}tj|��d|duzzV��$dS)�*N)r��escape)r��textr��_s    r�	<genexpr>z/FileSink._make_glob_patterns.<locals>.<genexpr>,sC����d�d�>�4�QU�XY�$�+�d�+�+�c�T��5E�.F�F�d�d�d�d�d�drz.*)�string�	Formatter�parse�joinrrrB)r�	formatter�tokens�escapedrrs      rr�zFileSink._make_glob_patterns(s����$�&�&�	�����&�&���'�'�d�d�]c�d�d�d�d�d���G�$�$�W�-�-�	��c��	-��W�t�^�,�,���4�����s�):�D�4�K�#�<M�PT�<T�U�Urc��|�dSt|t���r'tj|��}|�t�|��Stj|��}|�t�|��Stj|��}|�t�	|��Stj
|��}|�o|\}}|�t�|��S|�tjddd��}ttj|���}t�	||��Std|z���t|t jt$jf��rttj|���St|tj��r%t�	tj|��St|tj��r5ttj|���}t�	|��St1|��r|St3dt5|��jz���)Nr)rdz Cannot parse rotation from: '%s')rp)rgz/Cannot infer rotation for objects of type: '%s')�
isinstancer��string_parsers�
parse_sizer�r��parse_duration�parse_frequencyr]r��
parse_daytimerr{rre�
ValueError�numbers�Real�decimal�Decimalrqrbrarh�callable�	TypeError�typer%)r��sizerg�	frequency�daytime�dayr{rxs        rr�z FileSink._make_rotation_function5s������4��h��$�$�	L�!�,�X�6�6�D����7�7��=�=�=�%�4�X�>�>�H��#��7�7��A�A�A�&�6�x�@�@�I��$��,�,�Y�7�7�7�$�2�8�<�<�G��"�#�	��T��;�#�;�;�D�A�A�A��<�#�=��A�q�1�1�D�&�x�'?��M�M�M���,�,�\�4�@�@�@��?�(�J�K�K�K��h���w�� ?�@�@�	H��8�1�h�G�G�G�G��h��
�.�.�	I��(�(��)=�x�H�H�H��h�� 2�3�3�	7�"�8�#<�x�P�P�P�L��(�(��6�6�6��H���	��O��I�D�QY�N�N�Lc�c�d�d�drc��|�dSt|t��rBtj|��}|�t	d|z���t
�|��St|t��rttj
|���St|tj��r-ttj
|������St|��r|St!dt#|��jz���)Nz!Cannot parse retention from: '%s')rT)rYz0Cannot infer retention for objects of type: '%s')r�r�r�r�r�r�r��intrrJrUrrar[�
total_secondsr�r�r�r%)r�rgs  rr�z!FileSink._make_retention_functionXs������4��i��%�%�	?�%�4�Y�?�?�H��� �!D�y�!P�Q�Q�Q��4�4�X�>�>�>��i��%�%�	H��9�4�Y�G�G�G�G��i��!3�4�4�	W��9�2�I�<S�<S�<U�<U�V�V�V�V��I���	����>��i���AY�Y�
�
�	
rc��|�dSt|t���r|����d��}|dkr'ddl}ttj|jd���}�n�|dkr'ddl	}ttj|jd���}�nf|dkr-ddl
}ttj|jd|j���}�n3|d	kr-ddl
}ttj|jd|j���}�n|d
kr&ddl
}ttj|jd���}n�|dkr*ddl}ddl
}ttj|jd
���}n�|dkr*ddl	}ddl
}ttj|jd���}nt|dkr*ddl
}ddl
}ttj|jd���}nD|dkr,ddl}ttj|jd|j���}nt'd|z���ttjd|z|���St+|��r|St-dt/|��jz���)N�.�gzr�wb)r1r��bz2�xz)r1r�r�lzma�tarzw:ztar.gzzw:gzztar.bz2zw:bz2ztar.xzzw:xz�zip�w)r1r�rGz Invalid compression format: '%s')rrEz2Cannot infer compression for objects of type: '%s')r�r��strip�lstrip�gziprr*r@r;r�r��	FORMAT_XZ�FORMAT_ALONE�tarfiler4�zipfiler8�ZipFile�ZIP_DEFLATEDr�rGr�r�r�r%)rGrr�compressr�r�rr	s        rr�z#FileSink._make_compression_functionks������4��k�3�'�'�9	_��#�#�%�%�,�,�S�1�1�C��d�{�{�����"�;�#<�T�Y�UY�Z�Z�Z��������
�
�
�"�;�#<�S�X�TX�Y�Y�Y�����������"��-�d�i�d�SW�Sa��������������"��-�d�i�d�SW�Sd��������������"�;�#;�G�L�W[�\�\�\���������������"�;�#;�G�L�W]�^�^�^����	�!�!��
�
�
�����"�;�#;�G�L�W^�_�_�_���������������"�;�#;�G�L�W]�^�^�^�����������"��.�"�?�� '� 4�	�����!�!C�c�!I�J�J�J��;�2��c�	�U]�^�^�^�^��K� � �	����@�4��CT�CT�C]�]�
�
�	
r)r%r&r'r!r7r�r�r�r�r�r�r�r�rHr�r�r�r�r(rrr�r��s\������
�����
���"$�"$�"$�"$�"$�H"�"�"�0�0�0����%�%�%�,�,�,�,�,�,����(�(�(�$.3� E� E� E� E� E�D�
V�
V��\�
V�� e� e��\� e�D�
�
��\�
�$�A
�A
��\�A
�A
�A
rr�)rr�r�r�rr<r��	functoolsrrMrrr�rr��_ctime_functionsrr	�	_datetimer
rrr*rJr]r�r(rr�<module>rs�������������������	�	�	�	�
�
�
�
�
�
�
�
���������������/�/�/�/�/�/�2�2�2�2�2�2�2�2� � � � � � ����.�.�.�.�.�.�.�.���������<��������"C�C�C�C�C�C�C�C�LP
�P
�P
�P
�P
�P
�P
�P
�P
�P
r