관리-도구
편집 파일: validation.cpython-37.pyc
B � d2 � @ s d Z ddlmZmZmZmZmZ ddlmZ eed�ee dd� dd �ed �ee dd� dd �ed �eedd� �dd� dd �ed�ee dd� dd �ed�ee dd� dd �ed�ee dd �ed�eedd� �dd� dd �ed�edd� �ed�ee d d �i �Zefeeed!�d"d#�Z d$S )%zF This module contains validation schema for config file loaded values � )�Schema�And�Optional�Use�SchemaError� )�SSAError�domains_numberc C s | dkS )Nr � )�nr r �M/opt/alt/python37/lib/python3.7/site-packages/ssa/configuration/validation.py�<lambda> � r z.number of domains should be a positive integer)�error�urls_numberc C s | dkS )Nr r )r r r r r r z+number of URLs should be a positive integer�requests_durationc C s t | �S )N)�float)r r r r r r c C s | dkS )Ng r )r r r r r r z#request duration should be positive�request_numberc C s | dkS )Nr r )r r r r r r z/number of requests should be a positive integer�timec C s d| kodkS S )Nr � r )r r r r r r z8time should be a positive integer between 1 and 12, or 0�correlationz*bad correlation value, should be On or Off�correlation_coefficientc C s t | �S )N)r )r r r r r r c C s d| k odkS S )Ng g �?r )r r r r r r z?correlation coefficient could not be negative or greater than 1�ignore_listc C s t | �S )N)�str)�sr r r r ! r �summary_notification_enabledz+bad notification value, should be On or Off)�data�scheme�returnc C sD y |� | �S tk r> } ztdt|�� ���W dd}~X Y nX dS )z9 Validate given data. Returns validated data zInvalid configuration: N)�validater r r )r r �er r r r '