관리-도구
편집 파일: parser.cpython-311.pyc
� 9�1g � � � d Z ddlZddlZddlZddlmZmZ ddlmZm Z ddl mZ dZ ej d� � Z G d � d e� � ZdS )a� This module contains SSA specific config parser: - has defaults - adds default values for ones missing in config file - allows duplicates, the latest value is loaded - performs value normalization during loading items: - to int - to float - to bool - 'correlation' is case-insensitive and allowed to be on, off, 1, 0, yes, no, true, false - loads default configuration in case of missing config file � N)�ConfigParser�NoSectionError)�Callable�List� )�config_file�ssa_conf�ssa_configuration_parserc �� � � e Zd ZdZ� fd�Zedefd�� � Zedefd�� � Zedefd�� � Z de ded edefd �Ze ddfded ededee fd�Zd� Zdd�Zdeddfd�Zdd�Zd� Zd� Z� xZS )�SSAConfigParserz2 SSA specific configparser implementation c � �� dddddddddd� }d d ddd ddddd� | _ |� � � | _ t � � � |d�� � d S )N� � g @� Tg�������?� ) �domains_number�urls_number�request_number�requests_duration�time�correlation�correlation_coefficient�ignore_list�summary_notification_enabledz!Size of TOP list for slow domainszSize of TOP list for slow urlsz[The threshold value of slow requests number in the period of time to mark URL as a slow onez2The threshold value of request duration in secondsz:Period of time in hours required to analyze these requestsz.Flag to enable or disable correlation (On/Off)z.The threshold value of correlation coefficientzEList of URLs or domains that should not be included in a daily reportzBFlag to enable or disable sending daily reports by e-mail (On/Off)F)�strict)� _comments�copy�ssa_defaults�super�__init__)�self�defaults� __class__s ��O/opt/cloudlinux/venv/lib64/python3.11/site-packages/ssa/configuration/parser.pyr zSSAConfigParser.__init__( s� �� � �� �!$���'*��,0� � �� B�;�{�!U�P�K�'W�b�,p� � ��� %�M�M�O�O��� ������%��0�0�0�0�0� �returnc � � dS )N)r r r r � �r! s r$ �int_optionszSSAConfigParser.int_optionsB s � �H�Hr% c � � dS )N)r r r( r) s r$ � float_optionszSSAConfigParser.float_optionsF s � �=�=r% c � � dS )N)r r r( r) s r$ �bool_optionszSSAConfigParser.bool_optionsJ s � �<�<r% �meth�section�optionc � � |||� � }nC# t t f$ r/ |||| � � � | j | �� � }Y nw xY w|S )z` If the value is missing in config file, e.g. time= set the default one )�vars�fallback)� ValueErrorr r"