OwlCyberSecurity - MANAGER
Edit File: configuration.cpython-312.pyc
� ����S;0h&&�����������������������������d�dl�Z�d�dlZd�dlZd�dlmZ�d�dlmZmZmZ�d�dl m Z �d�dlmZm Z �d�dlmZmZmZmZ�d�dlmZ�d�dlmZ�d�d lmZmZ��e�j4������������������e�������Z�G�d ��de �������Zy)�����N)�Values)�Any�List�Optional)�Command)�ERROR�SUCCESS)� Configuration�Kind�get_configuration_files�kinds)�PipError)� indent_log)�get_prog�write_outputc��������������������>����e�Zd�ZdZdZdZdd�Zdedee ���de fd �Zded ede e���fd�Zdedee ���ddfd�Zdedee ���ddfd �Zdedee ���ddfd�Zdedee ���ddfd�Zdedee ���ddfd�Zdeddfd�Zdd�Zdedee ���ddfd�Zdee ���de de defd�Zdd�Zdede fd�Zy)�ConfigurationCommanda��� Manage local and global configuration. Subcommands: - list: List the active configuration (or from the file specified) - edit: Edit the configuration file in an editor - get: Get the value associated with command.option - set: Set the command.option=value - unset: Unset the value associated with command.option - debug: List the configuration files and values defined under them Configuration keys should be dot separated command and option name, with the special prefix "global" affecting any command. For example, "pip config set global.index-url https://example.org/" would configure the index url for all commands, but "pip config set download.timeout 10" would configure a 10 second timeout only for "pip download" commands. If none of --user, --global and --site are passed, a virtual environment configuration file is used if one is active and the file exists. Otherwise, all modifications happen to the user file by default. Ta$�� %prog [<file-option>] list %prog [<file-option>] [--editor <editor-path>] edit %prog [<file-option>] get command.option %prog [<file-option>] set command.option value %prog [<file-option>] unset command.option %prog [<file-option>] debug �returnNc������������������P����|�j�������������������j������������������dddd�d���������|�j�������������������j������������������dddd d ���������|�j�������������������j������������������dddd d ���������|�j�������������������j������������������dddd d���������|�j������������������j������������������d|�j���������������������������y�)Nz--editor�editor�storez\Editor to use to edit the file. Uses VISUAL or EDITOR environment variables if not provided.)�dest�action�default�helpz--global�global_file� store_trueFz+Use the system-wide configuration file onlyz--user� user_filez$Use the user configuration file onlyz--site� site_filez3Use the current environment configuration file onlyr���)�cmd_opts� add_option�parser�insert_option_group��selfs��� �S/opt/hc_python/lib/python3.12/site-packages/pip/_internal/commands/configuration.py�add_optionsz ConfigurationCommand.add_options:���s�������� � � � �����9� � !�� �� � � � � �����>�� !�� �� � � � � �����7�� !�� �� � � � � �����F�� !�� �� ���'�'��4�=�=�9������options�argsc�����������������������|�j�������������������|�j������������������|�j������������������|�j������������������|�j������������������|�j ������������������d�}|r|d���|vr4t��������j������������������ddj������������������t��������|����������������������t��������S�|d���} �|�j������������������||dv���������}t��������|j������������������|��������|�_��������|�j ������������������j#��������������������������� ��||���||dd����������t$��������S�#�t��������$�r2}t��������j������������������|j������������������d�����������t��������cY�d�}~S�d�}~ww�xY�w#�t��������$�r2}t��������j������������������|j������������������d�����������t��������cY�d�}~S�d�}~ww�xY�w) N)�list�edit�get�set�unset�debugr���zNeed an action (%s) to perform.z, )r.���r/���r0���r-���)� need_value)�isolated� load_only����)�list_values�open_in_editor�get_name�set_name_value� unset_name�list_config_values�logger�error�join�sortedr����_determine_filer���r*���r ���� isolated_mode� configuration�loadr ���)r%���r)���r*����handlersr���r4����es��� r&����runzConfigurationCommand.run`���sF������$�$��'�'��=�=��&�&��_�_��,�,� ����t�A�w�h�.��L�L�1�� � �&��*�+� ���L��a��� ��,�,��V�/N�%N��-���I��+��*�*�i� ���� �����!� ��H�V��W�d�1�2�h�/� ����#��� ��L�L������#��L�� ����� ��L�L������#��L�� �s<���� C*��D(��* D%�3'D �D%� D%�( E#�1'E�E#�E#r2���c����������������������t���������j������������������|j������������������ft���������j������������������|j������������������ft���������j ������������������|j������������������ffD���cg�c] ��\��}}|r|���}}}|sN|sy�t��������d��t����������������t���������j ���������������������D����������������rt���������j ������������������S�t���������j������������������S�t��������|�������dk(��r|d���S�t��������d��������c�c}}w�)Nc��������������3����Z���K����|�]#��}t���������j������������������j������������������|�����������%�y��w)N)�os�path�exists)�.0�site_config_files��� r&���� <genexpr>z7ConfigurationCommand._determine_file.<locals>.<genexpr>����s'�����������(M�$�������/�0�(M�s����)+r5���r���zLNeed exactly one file to operate upon (--user, --site, --global) to perform.)r ����USERr����GLOBALr����SITEr����anyr����lenr���)r%���r)���r2����key�value�file_optionss��� r&���r@���z$ConfigurationCommand._determine_file����s�����������W�.�.�/����w�2�2�3����W�.�.�/�� �� ��U� �� � ��� �� ��������(?�(A�%�*�*�(M������z�z�!��z�z�!� �� �!� #���?�"�� 5� �� ��1 s����Cc�����������������������|�j������������������|dd���������t��������|�j������������������j���������������������������������D�]��\��}}t ��������d||����������y�)Nr,���r�����n�%s=%r)�_get_n_argsr?���rB����itemsr����r%���r)���r*���rT���rU���s��� r&���r6���z ConfigurationCommand.list_values����sE����������v���+� ��!3�!3�!9�!9�!;�<�J�C����#�u�-��=r(���c������������������z�����|�j������������������|dd��������}|�j������������������j������������������|�������}t��������d|��������y�)Nz get [name]r5���rX���z%s)r[���rB���� get_valuer���r]���s��� r&���r8���zConfigurationCommand.get_name����s9���������t�\�Q��7���"�"�,�,�S�1���T�5�!r(���c�����������������������|�j������������������|dd��������\��}}|�j������������������j������������������||��������|�j���������������������������y�)Nzset [name] [value]����rX���)r[���rB���� set_value�_save_configurationr]���s��� r&���r9���z#ConfigurationCommand.set_name_value����s@�������%�%�d�,@�A�%�F� ��U����$�$�S�%�0�� � �"r(���c�����������������������|�j������������������|dd��������}|�j������������������j������������������|��������|�j���������������������������y�)Nzunset [name]r5���rX���)r[���rB����unset_valuerc���)r%���r)���r*���rT���s��� r&���r:���zConfigurationCommand.unset_name����s9���������t�^�q��9�����&�&�s�+�� � �"r(���c����������������������|�j������������������|dd���������|�j���������������������������t��������|�j������������������j ���������������������������������D�]j��\��}}t��������d|��������|D�]T��}t ����������������5��t��������j������������������j������������������|�������}t��������d||��������|r|�j������������������|��������ddd���������V��l�y#�1�sw�Y����cxY�w)z9List config key-value pairs across different config filesr1���r���rX����%s:z%s, exists: %rN)r[����print_env_var_valuesr?���rB����iter_config_filesr���r���rI���rJ���rK����print_config_file_values)r%���r)���r*����variant�files�fname�file_existss��� r&���r;���z'ConfigurationCommand.list_config_values����s�����������w�!��,��!�!�#��%�T�%7�%7�%I�%I�%K�L�N�G�U����(����\�"$�'�'�.�.��"7�K� �!1�5�+�F�"��5�5�g�>� �"�\����M��"�\�s ����)A�B6�6B?rk���c�����������������������|�j�������������������j������������������|�������j��������������������������D�]%��\��}}t����������������5��t ��������d||��������ddd���������'�y#�1�sw�Y����2xY�w)z.Get key-value pairs from the file of a variantz%s: %sN)rB����get_values_in_configr\���r���r���)r%���rk����namerU���s��� r&���rj���z-ConfigurationCommand.print_config_file_values����sI�������-�-�B�B�7�K�Q�Q�S�K�D�%����X�t�U�3�����T���s����A�A c������������������������t��������dd��������t����������������5��t��������|�j������������������j ���������������������������������D�]%��\��}}d|j�����������������������������}t��������d||���������'� �ddd��������y#�1�sw�Y���yxY�w)z5Get key-values pairs present as environment variablesrg����env_var�PIP_rZ���N)r���r���r?���rB����get_environ_vars�upper)r%���rT���rU���rs���s��� r&���rh���z)ConfigurationCommand.print_env_var_values����s\�������U�I�&� �\�$�T�%7�%7�%H�%H�%J�K� ��U� ����� �.���W�g�u�5��L���\�\�s����AA-�-A6c������������������z����|�j������������������|�������}|�j������������������j��������������������������}|�t��������d��������d|v�rt��������d|����������� �t ��������j ������������������|��d|��d�d���������y�#�t��������$�r}|j������������������s||_����������d�}~wt��������j������������������$�r}t��������d|j�����������������������������d�}~ww�xY�w)Nz%Could not determine appropriate file.�"z4Can not open an editor for a file name containing " z "T)�shellz(Editor Subprocess exited with exit code ) �_determine_editorrB����get_file_to_editr���� subprocess� check_call�FileNotFoundError�filename�CalledProcessError� returncode)r%���r)���r*���r���rm���rE���s��� r&���r7���z#ConfigurationCommand.open_in_editor����s��������'�'��0���"�"�3�3�5���=��B�C�C� �E�\���G��w�O��� � V��!�!�V�H�B�u�g�Q�"7�t�D�� �� ��:�:�#�� ����,�,�� V��E�a�l�l�^�T�U�U�� V�s$����A*��* B:�3B�B:�B5�5B:�examplerY���c������������������t�����t��������|�������|k7��rd|��dt������������������d|��d�}t��������|��������|dk(��r|d���S�|S�)zAHelper to make sure the command got the right number of argumentsz-Got unexpected number of arguments, expected z . (example: "z config z")r5���r���)rS���r���r���)r%���r*���r����rY����msgs��� r&���r[���z ConfigurationCommand._get_n_args����sT�������t�9��>�?��s��C�&�j�\��'��"�>�� ���3�-����6���7�N��Kr(���c����������������������� �|�j�������������������j���������������������������y�#�t��������$�r!�t��������j ������������������d��������t��������d��������w�xY�w)Nz:Unable to save configuration. Please report this as a bug.zInternal Error.)rB����save� Exceptionr<���� exceptionr���r$���s��� r&���rc���z(ConfigurationCommand._save_configuration��sG������ .����#�#�%���� .����L� ���,�-�-� .�s ������*Ac������������������������|j��������������������|j�������������������S�dt��������j������������������v�rt��������j������������������d���S�dt��������j������������������v�rt��������j������������������d���S�t��������d��������)N�VISUAL�EDITORz"Could not determine editor to use.)r���rI����environr���)r%���r)���s��� r&���rz���z&ConfigurationCommand._determine_editor��sX�������>�>�%��>�>�!� ���� #��:�:�h�'�'� ���� #��:�:�h�'�'��?�@�@r(���)r���N)�__name__� __module__�__qualname__�__doc__�ignore_require_venv�usager'���r���r����str�intrF����boolr���r���r@���r6���r8���r9���r:���r;���rj���rh���r7���r���r[���rc���rz�����r(���r&���r���r������si������0��� �E�$:�L+�6��+��c���+�s��+�Z �v�� �4�� �H�T�N�� �<.�6��.��c���.�t��.�"���"�d�3�i��"�D��"�#�f��#�D��I��#�$��#�#�&��#��S� ��#�d��#�?�&��?��S� ��?�d��?� 4���4���4�6�V�f��V�D��I��V�$��V�,��S� ���C���C���C��� .�A���A�C��Ar(���r���)�loggingrI���r|����optparser����typingr���r���r����pip._internal.cli.base_commandr����pip._internal.cli.status_codesr���r ����pip._internal.configurationr ���r���r���r ����pip._internal.exceptionsr����pip._internal.utils.loggingr����pip._internal.utils.miscr���r���� getLoggerr����r<���r���r����r(���r&����<module>r�������sT�������� ������&��&��2��9�����.��2��;� �� � �8� $��BA�7��BAr(���