Your IP : 216.73.216.172


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/ssa/modules/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/ssa/modules/__pycache__/common.cpython-311.pyc

�

t��g���P�dZddlZddlmZddlmZddlmZGd�d��ZdS)	zn
This module contains a base class including methods, common for
SSA Request Processor and SSA Decision Maker
�N)�Tuple)�date���load_configurationc��eZdZdZd�Zd�Zedefd���Zede	fd���Z
dedefd�Z
edefd	���Zd
S)�Commonz
    Base SSA module class
    c�8�|���|_dS)N)�	load_conf�config��selfs �I/opt/cloudlinux/venv/lib64/python3.11/site-packages/ssa/modules/common.py�__init__zCommon.__init__s���n�n�&�&�����c�N�t|d��}|�|d��S)a
        All undefined attributes, e.g.
            - domains_number
            - urls_number
            - correlation_coefficient
            - correlation
            - request_number
            - time
        are queried in config.
        Others would be empty
        r�)�getattr�get)r�item�confs   r�__getattr__zCommon.__getattr__s'���t�X�&�&���x�x��b�!�!�!r�returnc�
�ddhS)N�domain_total_reqs�is_a_wordpress_domain�r
s r�non_url_fieldszCommon.non_url_fields*s��#�%<�=�=rc�N�|j�d��}d�|D��S)z/
        Render configured ignore list
        �,c�^�g|]*}|����|�����+Sr)�strip)�.0�is  r�
<listcomp>z-Common.configured_ignores.<locals>.<listcomp>4s-��9�9�9�a�q�w�w�y�y�9����	�	�9�9�9r)�ignore_list�split)r�elementss  r�configured_ignoreszCommon.configured_ignores.s.��
�#�)�)�#�.�.��9�9�8�9�9�9�9r�_urlc��|jD]@}d|vr3|�d��sd|��}tj||��rdS�9||vrdS�AdS)z8
        Check if given URL matches ignore list
        �*TF)r)�
startswith�fnmatch)rr*�patterns   r�
is_ignoredzCommon.is_ignored6s|���.�		 �		 �G��g�~�~��)�)�#�.�.�,�+�'�m�m�G��?�4��1�1� ��4�4� ��d�?�?��4�4�#��urc��t��S)z$
        Load configuration
        rrrrrzCommon.load_confFs��
"�#�#�#rN)�__name__�
__module__�__qualname__�__doc__rr�property�setr�listr)�str�boolr0�staticmethod�dictrrrrr	r	s���������'�'�'�
"�
"�
"��>��>�>�>��X�>��:�D�:�:�:��X�:��s��t����� �$�t�$�$�$��\�$�$�$rr	)	r5r.�typingr�datetimer�
configurationrr	rrr�<module>r@s���������������������.�.�.�.�.�.�8$�8$�8$�8$�8$�8$�8$�8$�8$�8$r

?>