OwlCyberSecurity - MANAGER
Edit File: configuration.cpython-311.pyc
� �������h�6����������������������������d�Z�ddlZddlZddlZddlZddlmZmZmZm Z m Z mZmZ�ddl mZmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZmZ�ej��������Z�e d e������������Zerd ndZdZ�ed dddd�������������Zej��������ej ��������ej!��������ej"��������ej#��������fZ$ej ��������ej��������ej!��������fZ%�ee&������������Z'dedefd�Z(dede e���������fd�Z)deee e���������f���������fd�Z*�G�d��d������������Z+dS�)a��Configuration management setup Some terminology: - name As written in config files. - value Value associated with a name - key Name combined with it's section (section.name) - variant A single word describing where the configuration key-value pair came from �����N)�Any�Dict�Iterable�List�NewType�Optional�Tuple)�ConfigurationError�!ConfigurationFileCouldNotBeLoaded)�appdirs)�WINDOWS)� getLogger)� ensure_dir�enum�Kindzpip.inizpip.conf)�version�help�user�global�site�envzenv-var)�USER�GLOBAL�SITE�ENV�ENV_VAR�name�returnc�����������������������|����������������������������������������������������������dd������������}�|����������������������d������������r |�dd����������}�|�S�)zAMake a name consistent regardless of source (environment or file)�_�-z--����N)�lower�replace� startswith)r���s��� �{/builddir/build/BUILD/imunify360-venv-2.5.2/opt/imunify360/venv/lib/python3.11/site-packages/pip/_internal/configuration.py�_normalize_namer'���2���sE�������:�:�<�<����S�)�)�D����t������A�B�B�x���K�����c������������������`�����d|�vrd|���d�}t����������|�������������|����������������������dd������������S�)N�.zVKey does not contain dot separated section and key. Perhaps you wanted to use 'global.z ' instead?����)r ����split)r���� error_messages��� r&����_disassemble_keyr.���:���sO������ �$��� B�15� B�� B�� B�� ��!��/�/�/��:�:�c�1���r(���c������������������������d��t����������j��������d������������D���������������}�t����������j�����������������������������t ����������j��������t����������������������}t����������j�����������������������������t����������j�����������������������������d������������t����������rdndt����������������������}t����������j�����������������������������t����������j ��������d������������t����������������������}t����������j��������|�t����������j ��������|gt����������j��������||giS�)Nc������������������X�����g�|�]'}t�����������j�����������������������������|t������������������������(S���)�os�path�join�CONFIG_BASENAME)�.0r3���s��� r&���� <listcomp>z+get_configuration_files.<locals>.<listcomp>E���s5������������04�����T�?�+�+�����r(����pip�~z.pip)r����site_config_dirsr2���r3���r4����sys�prefixr5���� expanduserr ����user_config_dir�kindsr���r���r���)�global_config_files�site_config_file�legacy_config_file�new_config_files��� r&����get_configuration_filesrD���D���s����������8?�8P�QV�8W�8W���������w�|�|�C�J��@�@������ ����3����$���f������ ��g�l�l�7�#:�5�#A�#A�?�S�S�O� ��)� � �%�&� � �'��9���r(���c��������������������"������e�Zd�ZdZd"dedee���������ddf��fd� Zd#d�Zdee ���������fd�Z deee e f������������������fd �Zd e de fd�Zd e de ddfd �Zd e ddfd�Zd#d�Zd#d�Zedee e f���������fd���������������Zd#d�Zdede defd�Zde defd�Zd#d�Zde deee e f������������������dee e f���������fd�Zdeee e f������������������fd�Zdeeeee ���������f������������������fd�Zdedee e f���������fd�Z dee ef���������fd�Z!de deddfd �Z"de fd!�Z#��xZ$S�)$� Configurationa���Handles management of configuration. Provides an interface to accessing and managing configuration files. This class converts provides an API that takes "section.key-name" style keys and stores the value associated with it as "key-name" under the section "section". This allows for a clean interface wherein the both the section and the key-name are preserved in an easy to manage form in the configuration files and the data stored is also nice. N�isolated� load_onlyr���c����������� �������z�����t������������������������������������������������������������|�V|t����������vrMt����������d���������������������d���������������������t ����������t����������t�����������������������������������������������������������||�_��������||�_ ��������d��t����������D���������������|�_��������d��t����������D���������������|�_��������g�|�_ ��������d�S�)Nz5Got invalid value for load_only - should be one of {}z, c�����������������������i�|�]}|g���S�r1���r1����r6����variants��� r&���� <dictcomp>z*Configuration.__init__.<locals>.<dictcomp>r���s-�������H ��H ��H �#�G�R�H ��H ��H r(���c�����������������������i�|�]}|i���S�r1���r1���rK���s��� r&���rM���z*Configuration.__init__.<locals>.<dictcomp>u���s'�������4 ��4 ��4 �#�G�R�4 ��4 ��4 r(���)�super�__init__�VALID_LOAD_ONLYr ����formatr4����map�reprrG���rH����OVERRIDE_ORDER�_parsers�_config�_modified_parsers)�selfrG���rH���� __class__s��� �r&���rP���zConfiguration.__init__e���s�������� ��������� �Y�o�%E�%E�$�G�N�N��I�I�c�$��8�8�9�9�������� � �!�� �"���H ��H �'5�H ��H ��H �� �4 ��4 �'5�4 ��4 ��4 ����EG����r(���c������������������h�����|��������������������������������������|�j��������s|�������������������������������������dS�dS�)z<Loads configuration from configuration files and environmentN)�_load_config_filesrG����_load_environment_vars�rY���s��� r&����loadzConfiguration.loadz���s@���������!�!�!��}�� *��'�'�)�)�)�)�)� *�� *r(���c������������������|�����|�j���������� J�d��������������� �|������������������������������������d���������S�#�t����������$�r�Y�dS�w�xY�w)z7Returns the file with highest priority in configurationNz)Need to be specified a file to be editingr���)rH����_get_parser_to_modify� IndexErrorr^���s��� r&����get_file_to_editzConfiguration.get_file_to_edit����sW�������~�)�)�+V�)�)�)� ��-�-�/�/��2�2���� �� �� ��4�4� ���s����-�� ;�;c������������������4�����|�j��������������������������������������������S�)z`Returns key-value pairs like dict.items() representing the loaded configuration )�_dictionary�itemsr^���s��� r&���rf���zConfiguration.items����s���������%�%�'�'�'r(����keyc�����������������������|}t����������|������������} �|�j��������|���������S�#�t����������$�r"�t����������|�������������t ����������d|����������������w�xY�w)z#Get a value from the configuration.�No such key - )r'���re����KeyErrorr.���r ���)rY���rg����orig_keys��� r&���� get_valuezConfiguration.get_value����sn���������c�"�"�� B��#�C�(�(���� B�� B�� B�� �S�!�!�!�$�%@�h�%@�%@�A�A�A� B���s ���� ��,A�valuec����������������������t����������|������������}|�������������������������������������|�j��������sJ��|������������������������������������\��}}|�St ����������|������������\��}}|���������������������|������������s|���������������������|�������������|���������������������|||�������������||�j��������|�j�����������������|<���|�� ��������������������||�������������dS�)z$Modify a value in the configuration.N) r'����_ensure_have_load_onlyrH���ra���r.����has_section�add_section�setrW����_mark_as_modified)rY���rg���rm����fname�parser�sectionr���s��� r&���� set_valuezConfiguration.set_value����s��������c�"�"���#�#�%�%�%��~���~��2�2�4�4� ��v���,�S�1�1�M�G�T���%�%�g�.�.�� ,��"�"�7�+�+�+��J�J�w��e�,�,�,�,1���T�^�$�S�)����u�f�-�-�-�-�-r(���c����������������������|}t����������|������������}|�������������������������������������|�j��������sJ��||�j��������|�j�����������������vrt ����������d|����������������|������������������������������������\��}}|��t ����������|������������\��}}|���������������������|������������r|���������������������||������������st ����������d�������������|� ��������������������|������������s|� ��������������������|�������������|����������������������||�������������|�j��������|�j�����������������|=�dS�)z#Unset a value in the configuration.ri���Nz4Fatal Internal error [id=1]. Please report as a bug.)r'���ro���rH���rW���r ���ra���r.���rp���� remove_optionrf����remove_sectionrs���)rY���rg���rk���rt���ru���rv���r���s��� r&����unset_valuezConfiguration.unset_value����s&��������c�"�"���#�#�%�%�%��~���~��d�l�4�>�2�2�2�$�%@�h�%@�%@�A�A�A��2�2�4�4� ��v���,�S�1�1�M�G�T��"�"�7�+�+� �06�0D�0D�W�d�0S�0S� ��)�J������ ��<�<��(�(�� /��%�%�g�.�.�.��"�"�5�&�1�1�1��L���(��-�-�-r(���c����������������������|��������������������������������������|�j��������D�]�\��}}t�������������������������������d|�������������t ����������t ����������j�����������������������������|������������������������� �t����������|d������������5�}|� ��������������������|�������������ddd�������������n#�1�swxY�w�Y�����#�t����������$�r}t����������d|��d|����������������d}~ww�xY�wdS�)z!Save the current in-memory state.z Writing to %s�wNz:An error occurred while writing to the configuration file z: )ro���rX����logger�infor���r2���r3����dirname�open�write�OSErrorr ���)rY���rt���ru����f�errors��� r&����savezConfiguration.save����s-������#�#�%�%�%�!�3�� �� �M�E�6��K�K���/�/�/�� �r�w���u�-�-�.�.�.� ��%��%�%��$���L�L��O�O�O�$��$��$��$��$��$��$��$��$��$��$�����$��$��$��$����� �� �� �(�(��(��(� %�(��(���������� ���� �� s<����)B'�9B�B'�B �B'�"B �#B'�' C�1C�Cc������������������r�����|�j����������t����������d�������������t�������������������������������d|�j����������������������d�S�)Nz'Needed a specific file to be modifying.z$Will be working with %s variant only)rH���r ���r~����debugr^���s��� r&���ro���z$Configuration._ensure_have_load_only����s6�������>�!�$�%N�O�O�O����;�T�^�L�L�L�L�Lr(���c������������������^�����i�}t�����������D�]"}|���������������������|�j��������|�����������������������#|S�)z3A dictionary representing the loaded configuration.)rU����updaterW���)rY����retvalrL���s��� r&���re���zConfiguration._dictionary����s9������ ���%�� 1�� 1�G��M�M�$�,�w�/�0�0�0�0�� r(���c�����������������������t����������|������������������������������������������������}|t����������j�����������������dd����������t����������j��������gk����rt�������������������������������d�������������dS�|�����������������������������������D�]q\��}}|D�]i}|�j ���������(||�j ��������k����rt�������������������������������d||��������������1|�� ��������������������||������������}|�j��������|������������������������������||f��������������j�rdS�)z,Loads configuration from configuration filesr���r+���zZSkipping loading configuration files due to environment's PIP_CONFIG_FILE being os.devnullNz Skipping file '%s' (variant: %s)) �dict�iter_config_filesr?���r���r2����devnullr~���r����rf���rH���� _load_filerV����append)rY����config_filesrL����filesrt���ru���s��� r&���r\���z Configuration._load_config_files����s������D�2�2�4�4�5�5���� �"�1�Q�3�'�B�J�<�7�7��L�L�A� �� �� �� �F�*�0�0�2�2�� ?�� ?�N�G�U��� ?�� ?����>�-�'�T�^�2K�2K��L�L�!C�U�G�T�T�T������%�8�8���� �g�&�-�-�u�f�o�>�>�>�>� ?� ?�� ?r(���rL���rt���c������������������(����t��������������������������������d||�������������|����������������������|������������}|�����������������������������������D�]K}|���������������������|������������}|�j��������|������������������������������|����������������������||��������������������������L|S�)Nz'For variant '%s', will try loading '%s')r~����verbose�_construct_parser�sectionsrf���rW���r�����_normalized_keys)rY���rL���rt���ru���rv���rf���s��� r&���r����zConfiguration._load_file��s����������@�'�5�Q�Q�Q��'�'��.�.�����(�(�� P�� P�G��L�L��)�)�E��L��!�(�(��)>�)>�w��)N�)N�O�O�O�O�� r(���c������������������N����t����������j����������������������}t����������j�����������������������������|������������rrt����������j��������d������������} �|���������������������||��������������nE#�t����������$�r�t����������d|��d�|��������������t�����������j ��������$�r}t����������|��������������d�}~ww�xY�w|S�)NF)�encodingzcontains invalid z characters)�reasonrt���)r����)�configparser�RawConfigParserr2���r3����exists�locale�getpreferredencoding�read�UnicodeDecodeErrorr����Error)rY���rt���ru����locale_encodingr����s��� r&���r����zConfiguration._construct_parser��s��������-�/�/�� ��7�>�>�%� � �� E�$�9�%�@�@�O� E����E�O��<�<�<�<��%�� �� �� �7�K��K�K�K���������� �%�� E�� E�� E�7�e�D�D�D�D����� E������ s����A �� -B"� B�B"c�����������������������|�j���������t����������j��������������������������������������|����������������������d|�������������������������������������������������������������dS�)z.Loads configuration from environment variablesz:env:N)rW���r?���r���r����r�����get_environ_varsr^���s��� r&���r]���z$Configuration._load_environment_vars*��sL��������U�]�#�*�*��!�!�'�4�+@�+@�+B�+B�C�C� �� �� �� �� r(���rv���rf���c������������������N�����i�}|D�]\��}}|dz���t����������|������������z���}|||<���� |S�)z�Normalizes items to construct a dictionary with normalized keys. This routine is where the names become keys and are made the same regardless of source - configuration files or environment. r*���)r'���)rY���rv���rf���� normalizedr����valrg���s��� r&���r����zConfiguration._normalized_keys0��sC�������� ��� "�� "�I�D�#��C�-�/�$�"7�"7�7�C�!�J�s�O�O��r(���c��������������#��������K����t�����������j�������������������������������������������D�]E\��}}|���������������������d������������r+|dd���������������������������������������������}|t ����������vr||fV����FdS�)z@Returns a generator with all environmental vars with prefix PIP_�PIP_����N)r2����environrf���r%���r#����ENV_NAMES_IGNORED)rY���rg���r����r���s��� r&���r����zConfiguration.get_environ_vars>��st����������� �(�(�*�*�� $�� $�H�C���~�~�f�%�%�� $��1�2�2�w�}�}�����0�0�0���)�O�O�O�� $�� $r(���c��������������#�������K����t�����������j�����������������������������dd������������}t������������������������}t����������j��������|t����������j�����������������fV���|�j���������o!|ot�����������j�����������������������������|�������������}|r t����������j ��������|t����������j �����������������fV���t����������j ��������|t����������j �����������������fV���|�t����������j��������|gfV���dS�t����������j��������g�fV���dS�)a���Yields variant and configuration files associated with it. This should be treated like items of a dictionary. The order here doesn't affect what gets overridden. That is controlled by OVERRIDE_ORDER. However this does control the order they are displayed to the user. It's probably most ergonomic to display things in the same order as OVERRIDE_ORDER �PIP_CONFIG_FILEN)r2���r�����getrD���r?���r���rG���r3���r����r���r���r���)rY����env_config_filer�����should_load_user_configs��� r&���r����zConfiguration.iter_config_filesG��s�������������*�.�.�):�D�A�A��.�0�0���l�L���6�6�6�6�6��'+�m�"3��# ��?������ ?� ?�9 ���#�� 7��*�l�5�:�6�6�6�6�6���j�,�u�z�2�2�2�2�2��&��)�o�.�.�.�.�.�.�.��)�R�-�����r(���c�����������������������|�j���������|���������S�)z#Get values present in a config file)rW���)rY���rL���s��� r&����get_values_in_configz"Configuration.get_values_in_configg��s�������|�G�$�$r(���c������������������j�����|�j���������sJ��|�j��������|�j������������������}|st����������d�������������|d���������S�)Nz4Fatal Internal error [id=2]. Please report as a bug.���)rH���rV���r ���)rY����parserss��� r&���ra���z#Configuration._get_parser_to_modifyk��sF�������~���~��-���/���� �$�F����� � ��r�{�r(���ru���c������������������X�����||f}||�j���������vr|�j������������������������������|�������������d�S�d�S��N)rX���r����)rY���rt���ru����file_parser_tuples��� r&���rs���zConfiguration._mark_as_modifiedy��s@������"�F�O���D�$:�:�:��"�)�)�*;�<�<�<�<�<��;�:r(���c������������������0�����|�j���������j����������d|�j���������d�S�)N�(�))rZ����__name__re���r^���s��� r&����__repr__zConfiguration.__repr__~��s!�������.�)�A�A�D�,<�A�A�A�Ar(���r����)r���N)%r����� __module__�__qualname__�__doc__�boolr���r���rP���r_����strrc���r���r ���r���rf���rl���rw���r{���r����ro����propertyr���re���r\���r����r����r����r]���r����r����r���r����r����ra���rs���r����� __classcell__)rZ���s���@r&���rF���rF���W���s>�����������������G��G���G�(�4�.��G�D��G��G��G��G��G��G�**��*��*��*��(�3�-���������(�x��c�3�h��0��(��(��(��(� B�S�� B�S�� B�� B�� B�� B�.�S��.���.���.��.��.��.�&.�s��.�t��.��.��.��.�:�������0M��M��M��M� �� �T�#�s�(�^�� �� �� ���X� �?��?��?��?�.�$���s�������������s������������* �� �� �� ����#+�E�#�s�(�O�#<�� �c�3�h���������$�(�5��c��?�";��$��$��$��$� �8�E�$��S� �/�,B�#C�� �� �� �� �@%�D��%�T�#�s�(�^��%��%��%��%��u�S�/�-A�'B���������=�s��=�O��=���=��=��=��=� B�#��B��B��B��B��B��B��B��Br(���rF���),r����r����r����r2���r;����typingr���r���r���r���r���r���r ����pip._internal.exceptionsr ���r����pip._internal.utilsr����pip._internal.utils.compatr ����pip._internal.utils.loggingr����pip._internal.utils.miscr���r���r����r����r���r5���r����r?���r���r���r���r���r���rU���rQ���r����r~���r'���r.���rD���rF���r1���r(���r&����<module>r�������s-���������������� � � � �� � � � �� � � � ��F��F��F��F��F��F��F��F��F��F��F��F��F��F��F��F��F��F�����������������(��'��'��'��'��'��.��.��.��.��.��.��1��1��1��1��1��1��5��5��5��5��5��5��5��5��.���w�v�s����&�6�)�)�J��%���� �� �� � �� �� �� �����u�z�5�:�u�y�%�-�O���*�e�l�E�J�6�� ��8� � ���#���#����������3���4��9�����������d�D��I�o�!6���������&hB��hB��hB��hB��hB��hB��hB��hB��hB��hBr(���