OwlCyberSecurity - MANAGER
Edit File: configuration.cpython-312.pyc
� ����S;0h�6���������������������������d�Z�ddlZddlZddlZddlZddlmZmZmZm Z m Z mZmZ�ddl mZmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZmZ�ej2������������������Z�e d e�������Zerd ndZdZ�ed dddd��������Zej>������������������ej@������������������ejB������������������ejD������������������ejF������������������fZ$ej@������������������ej>������������������ejB������������������fZ%�ee&�������Z'dedefd�Z(dede e���fd�Z)deee e���f���fd�Z*�G�d��d�������Z+y)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������������������r�����|�j��������������������������j������������������dd�������}�|�j������������������d�������r|�dd�}�|�S�)zAMake a name consistent regardless of source (environment or file)�_�-z--����N)�lower�replace� startswith)r���s��� �J/opt/hc_python/lib/python3.12/site-packages/pip/_internal/configuration.py�_normalize_namer'���2���s6�������:�:�<����S�)�D����t���A�B�x���K�����c������������������P�����d|�vrd|���d�}t��������|��������|�j������������������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.���:���s>������ �$�� 1�15��j� B�� ��!��/�/��:�:�c�1��r(���c�������������������d����t��������j������������������d�������D���cg�c]&��}�t��������j������������������j ������������������|�t �����������������(�}}�t��������j������������������j ������������������t��������j������������������t ���������������}t��������j������������������j ������������������t��������j������������������j������������������d�������t��������rdndt ���������������}t��������j������������������j ������������������t��������j������������������d�������t ���������������}t��������j������������������|t��������j������������������|gt��������j������������������||giS�c�c}�w�)N�pip�~z.pip)r����site_config_dirs�os�path�join�CONFIG_BASENAME�sys�prefix� expanduserr ����user_config_dir�kindsr���r���r���)r4����global_config_files�site_config_file�legacy_config_file�new_config_files��� r&����get_configuration_filesr@���D���s�������8?�8P�8P�QV�8W��8W�������T�?�+�8W�������w�w�|�|�C�J�J��@������� �����3����f���� ��g�g�l�l�7�#:�#:�5�#A�?�S�O� ���)� � � �%�&� � � �'��9�����s����+D-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����������� �������R�����t����������|�������������|�C|t��������vr;t��������dj ������������������dj������������������t ��������t��������t�������������������������������������||�_��������||�_ ��������t��������D��ci�c]��}|g����c}|�_��������t��������D��ci�c]��}|i����c}|�_��������g�|�_ ��������y�c�c}w�c�c}w�)Nz5Got invalid value for load_only - should be one of {}z, )�super�__init__�VALID_LOAD_ONLYr ����formatr5����map�reprrC���rD����OVERRIDE_ORDER�_parsers�_config�_modified_parsers)�selfrC���rD����variant� __class__s��� �r&���rG���zConfiguration.__init__e���s�������� ����� �Y�o�%E�$�G�N�N��I�I�c�$��8�9���� � �!�� �"����(6�H �'5�G�G�R�K�~�H �� ��(6�4 �'5�G�G�R�K�~�4 ����EG���� H ��4 s����+ B� B$c������������������^�����|�j���������������������������|�j������������������s|�j���������������������������yy)z<Loads configuration from configuration files and environmentN)�_load_config_filesrC����_load_environment_vars�rP���s��� r&����loadzConfiguration.loadz���s&���������!��}�}��'�'�)��r(���c������������������n�����|�j��������������������J�d��������� �|�j��������������������������d���S�#�t��������$�r�Y�yw�xY�w)z7Returns the file with highest priority in configurationNz)Need to be specified a file to be editingr���)rD����_get_parser_to_modify� IndexErrorrV���s��� r&����get_file_to_editzConfiguration.get_file_to_edit����sC�������~�~�)�V�+V�V�)� ��-�-�/��2�2���� �� �s����(�� 4�4c������������������6�����|�j�������������������j��������������������������S�)z`Returns key-value pairs like dict.items() representing the loaded configuration )�_dictionary�itemsrV���s��� r&���r^���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'���r]����KeyErrorr.���r ���)rP���r_����orig_keys��� r&���� get_valuezConfiguration.get_value����sU���������c�"�� B��#�#�C�(�(���� B�� �S�!�$�~�h�Z�%@�A�A� B�s ������#A�valuec������������������b����t��������|�������}|�j���������������������������|�j������������������sJ��|�j��������������������������\��}}|�Ct ��������|�������\��}}|j������������������|�������s|j ������������������|��������|j������������������|||��������||�j������������������|�j���������������������|<���|�j������������������||��������y)z$Modify a value in the configuration.N) r'����_ensure_have_load_onlyrD���rY���r.����has_section�add_section�setrN����_mark_as_modified)rP���r_���re����fname�parser�sectionr���s��� r&���� set_valuezConfiguration.set_value����s��������c�"���#�#�%��~�~��~��2�2�4� ��v���,�S�1�M�G�T���%�%�g�.��"�"�7�+��J�J�w��e�,�,1����T�^�^�$�S�)����u�f�-r(���c�����������������������|}t��������|�������}|�j���������������������������|�j������������������sJ��||�j������������������|�j���������������������vrt ��������d|�����������|�j��������������������������\��}}|�pt ��������|�������\��}}|j������������������|�������r|j������������������||�������st ��������d��������|j������������������|�������s|j������������������|��������|�j������������������||��������|�j������������������|�j���������������������|=�y)z#Unset a value in the configuration.ra���Nz4Fatal Internal error [id=1]. Please report as a bug.)r'���rg���rD���rN���r ���rY���r.���rh���� remove_optionr^����remove_sectionrk���)rP���r_���rc���rl���rm���rn���r���s��� r&����unset_valuezConfiguration.unset_value����s����������c�"���#�#�%��~�~��~��d�l�l�4�>�>�2�2�$�~�h�Z�%@�A�A��2�2�4� ��v���,�S�1�M�G�T��"�"�7�+��0D�0D�W�d�0S��)�J���� ��<�<��(��%�%�g�.��"�"�5�&�1��L�L����(��-r(���c������������������r����|�j���������������������������|�j������������������D�]j��\��}}t��������j������������������d|��������t ��������t ��������j������������������j������������������|��������������� �t��������|d�������5�}|j������������������|��������ddd���������l�y#�1�sw�Y����xY�w#�t��������$�r}t��������d|��d|�����������d}~ww�xY�w)z!Save the current in-memory state.z Writing to %s�wNz:An error occurred while writing to the configuration file z: )rg���rO����logger�infor���r3���r4����dirname�open�write�OSErrorr ���)rP���rl���rm����f�errors��� r&����savezConfiguration.save����s��������#�#�%�!�3�3�M�E�6��K�K���/�� �r�w�w���u�-�.� ��%��%���L�L��O��&���4��&�%���� �(�P��g�R��w�(����� �s0����"B�.B��B�B �B� B6� B1�1B6c������������������r�����|�j��������������������t��������d��������t��������j������������������d|�j���������������������������y�)Nz'Needed a specific file to be modifying.z$Will be working with %s variant only)rD���r ���rv����debugrV���s��� r&���rg���z$Configuration._ensure_have_load_only����s+�������>�>�!�$�%N�O�O����;�T�^�^�Lr(���c������������������\�����i�}t���������D�] ��}|j������������������|�j������������������|������������"�|S�)z3A dictionary representing the loaded configuration.)rL����updaterN���)rP����retvalrQ���s��� r&���r]���zConfiguration._dictionary����s/������ ���%�G��M�M�$�,�,�w�/�0��&��� r(���c����������������������t��������|�j���������������������������������}|t��������j���������������������dd�t��������j ������������������gk(��rt��������j������������������d��������y|j��������������������������D�]q��\��}}|D�]g��}|�j�������������������'||�j������������������k7��rt��������j������������������d||���������6|�j������������������||�������}|�j������������������|���j������������������||f���������i��s�y)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���r3����devnullrv���r����r^���rD���� _load_filerM����append)rP����config_filesrQ����filesrl���rm���s��� r&���rT���z Configuration._load_config_files����s��������D�2�2�4�5���� � �"�1�Q�'�B�J�J�<�7��L�L�A� �� �*�0�0�2�N�G�U�����>�>�-�'�T�^�^�2K��L�L�!C�U�G�T������%�8���� � �g�&�-�-�u�f�o�>����3r(���rQ���rl���c�����������������������t���������j������������������d||��������|�j������������������|�������}|j��������������������������D�]A��}|j ������������������|�������}|�j ������������������|���j ������������������|�j������������������||����������������C�|S�)Nz'For variant '%s', will try loading '%s')rv����verbose�_construct_parser�sectionsr^���rN���r�����_normalized_keys)rP���rQ���rl���rm���rn���r^���s��� r&���r����zConfiguration._load_file��sm���������@�'�5�Q��'�'��.�����(�G��L�L��)�E��L�L��!�(�(��)>�)>�w��)N�O��)��� r(���c������������������B����t��������j��������������������������}t��������j������������������j ������������������|�������r+t��������j������������������d�������} �|j������������������||���������|S�|S�#�t��������$�r�t��������d|��d�|���������t���������j������������������$�r}t��������|���������d�}~ww�xY�w)NF)�encodingzcontains invalid z characters)�reasonrl���)r}���)�configparser�RawConfigParserr3���r4����exists�locale�getpreferredencoding�read�UnicodeDecodeErrorr����Error)rP���rl���rm����locale_encodingr}���s��� r&���r����zConfiguration._construct_parser��s��������-�-�/�� ��7�7�>�>�%� �$�9�9�%�@�O� E����E�O��<��� �v� ���&�� �7�.��.?�{�K������ �%�%�� E�7�e�D�D�� E�s���� A!��!,B� B�Bc�����������������������|�j�������������������t��������j���������������������j������������������|�j ������������������d|�j�����������������������������������������y)z.Loads configuration from environment variablesz:env:N)rN���r;���r���r����r�����get_environ_varsrV���s��� r&���rU���z$Configuration._load_environment_vars*��s6���������U�]�]�#�*�*��!�!�'�4�+@�+@�+B�C� r(���rn���r^���c������������������J�����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'���)rP���rn���r^���� normalizedr����valr_���s��� r&���r����zConfiguration._normalized_keys0��s;�������� ��I�D�#��C�-�/�$�"7�7�C�!�J�s�O�����r(���c��������������#�������K����t���������j������������������j��������������������������D�]9��\��}}|j������������������d�������s�|dd�j ��������������������������}|t ��������vs�4||f����;�y�w)z@Returns a generator with all environmental vars with prefix PIP_�PIP_����N)r3����environr^���r%���r#����ENV_NAMES_IGNORED)rP���r_���r����r���s��� r&���r����zConfiguration.get_environ_vars>��sP���������� � �(�(�*�H�C���~�~�f�%��1�2�w�}�}����0�0���)�O� �+�s����6A�A� Ac��������������#�������K����t���������j������������������j������������������dd�������}t����������������}t��������j ������������������|t��������j ���������������������f���|�j�������������������xr$�|xr�t���������j������������������j������������������|��������}|r%t��������j������������������|t��������j���������������������f���t��������j������������������|t��������j���������������������f���|�t��������j������������������|gf���yt��������j������������������g�f���y�w)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)r3���r�����getr@���r;���r���rC���r4���r����r���r���r���)rP����env_config_filer�����should_load_user_configs��� r&���r����zConfiguration.iter_config_filesG��s������������*�*�.�.�):�D�A��.�0���l�l�L����6�6�6��'+�m�m�"3��# ��?������� ?�9 ���#��*�*�l�5�:�:�6�6�6���j�j�,�u�z�z�2�2�2��&��)�)�o�.�.�.��)�)�R�-��s����C<C>c������������������ �����|�j�������������������|���S�)z#Get values present in a config file)rN���)rP���rQ���s��� r&����get_values_in_configz"Configuration.get_values_in_configg��s�������|�|�G�$�$r(���c������������������t�����|�j�������������������sJ��|�j������������������|�j����������������������}|st��������d��������|d���S�)Nz4Fatal Internal error [id=2]. Please report as a bug.���)rD���rM���r ���)rP����parserss��� r&���rY���z#Configuration._get_parser_to_modifyk��s?�������~�~��~��-�-����/���$�F��� � ��r�{�r(���rm���c������������������`�����||f}||�j�������������������vr|�j�������������������j������������������|��������y�y��N)rO���r����)rP���rl���rm����file_parser_tuples��� r&���rk���zConfiguration._mark_as_modifiedy��s4������"�F�O���D�$:�$:�:��"�"�)�)�*;�<��;r(���c������������������N�����|�j�������������������j��������������������d|�j�������������������d�S�)N�(�))rR����__name__r]���rV���s��� r&����__repr__zConfiguration.__repr__~��s'�������.�.�)�)�*�!�D�,<�,<�+?�q�A�Ar(���r����)r���N)%r����� __module__�__qualname__�__doc__�boolr���r���rG���rW����strr[���r���r ���r���r^���rd���ro���rs���r~���rg����propertyr���r]���rT���r����r����r����rU���r����r����r���r����r����rY���rk���r����� __classcell__)rR���s���@r&���rB���rB���W���s��������G���G�(�4�.��G�D��G�**��(�3�-���(�x��c�3�h��0��(� B�S�� B�S�� B�.�S��.���.���.�&.�s��.�t��.�:�0M� �� �T�#�s�(�^�� ��� �?�.�$���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�#��Br(���rB���),r����r����r����r3���r7����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���r6���r����r;���r���r���r���r���r���rL���rH���r����rv���r'���r.���r@���rB�����r(���r&����<module>r�������s�������� �� �� ��F��F��F���(��.��1��5��.�.���v�s���&�)�J��%���� � �� � �� ������u�z�z�5�:�:�u�y�y�%�-�-�O���*�*�e�l�l�E�J�J�6�� �8� ���#���#����3���4��9�����d�D��I�o�!6���&hB��hBr(���