Edit File: parser.cpython-37.pyc
B V�d� � @ sT d Z ddlmZmZ ddlmZmZ ddlmZ ddl m Z dZG dd � d e�Zd S )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 � )�ConfigParser�NoSectionError)�Callable�List)�is_cl_solo_edition� )�config_fileZssa_confc s� e Zd ZdZ� fdd�Zeed�dd��Zeed�dd��Zeed�d d ��Z e eeed�dd �Ze ddfeeeee d�dd�Zdd� Zdd�dd�Zedd�dd�Zddd�Zdd� Z� ZS ) �SSAConfigParserz2 SSA specific configparser implementation c sp t dd�}|rdndd|rdndd|r*dnd|r4dndd d dd� }dd dddddddd� | _t� j|dd� d S )NT)�skip_jwt_checkr � � � g @Fg�������?� ) �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))�strict)r � _comments�super�__init__)�selfZcl_solo�defaults)� __class__� �I/opt/alt/python37/lib/python3.7/site-packages/ssa/configuration/parser.pyr % s( zSSAConfigParser.__init__)�returnc C s dS )N)r r r r r )r r r r �int_options? s zSSAConfigParser.int_optionsc C s dS )N)r r r )r r r r � float_optionsC s zSSAConfigParser.float_optionsc C s dS )N)r r r )r r r r �bool_optionsG s zSSAConfigParser.bool_options)�meth�section�optionr! c C s: y|||�}W n& t k r4 |||| �� d�}Y nX |S )z` If the value is missing in config file, e.g. time= set the default one )�vars)� ValueErrorr )r r% r&