Viewing File: /opt/hc_python/lib/python3.12/site-packages/pre_commit/__pycache__/main.cpython-312.pyc

�

i0i.>��.�ddlmZddlZddlZddlZddlZddlmZddlm	Z
ddlmZddlm
Z
ddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddl m!Z!ddl"m#Z#ddl$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1ejdd�Z3ejhjkdd�ejhjkdd�hd�Z6d#d�Z7d#d�Z8d#d�Z9d$d �Z:d%d&d!�Z;e<d"k(r
e=e;���y)'�)�annotationsN)�Sequence)�	clientlib)�git)�add_color_option)�hazmat)�
autoupdate)�clean)�gc)�	hook_impl)�init_templatedir)�install)�
install_hooks)�	uninstall)�migrate_config)�run)�
sample_config)�try_repo)�validate_config)�validate_manifest)�
error_handler)�logging_handler)�Store�
pre_commit�__PYVENV_LAUNCHER__�PYTHONEXECUTABLE>rr
r�
sample-config�validate-config�init-templatedir�validate-manifestc�J�|jddtjd��y)Nz-cz--configzPath to alternate config file)�default�help)�add_argument�C�CONFIG_FILE��parsers �>/opt/hc_python/lib/python3.12/site-packages/pre_commit/main.py�_add_config_optionr*2s#��
����j�!�-�-�
,���c�L�|jddtjdd��y)Nz-t�--hook-type�append�
hook_types)�choices�action�dest)r$r�
HOOK_TYPESr's r)�_add_hook_type_optionr49s'��
����m��$�$�X�L��r+c��|jddd��|jddd��|jd	�
�}|jdddd
��|jddgd��|jddd��|jddd��|jdtjtjdd��|jdd��|jdd��|jd d!d"d#��|jd$d%d&d'��|jd(d)��|jd*d+��|jd,d-��|jd.d/��|jd0d1��|jd2d3��|jd4d5��|jd6d7��|jd8d9��|jd:d;��y)<N�hook�?zA single hook-id to run��nargsr#z	--verbosez-v�
store_true�r1F)�requiredz--all-filesz-az!Run on all the files in the repo.�r1r#z--files�*z#Specific filenames to run hooks on.)r9r"r#z--show-diff-on-failurez3When hooks fail, run `git diff` directly afterward.z--fail-fastz"Stop after the first failing hook.z--hook-stage�
pre-commitz=The stage during which the hook is fired.  One of %(choices)s)r0�typer"r#z--remote-branchz%Remote branch ref used by `git push`.�r#z--local-branchz$Local branch ref used by `git push`.z
--from-refz--sourcez-sa(for usage with `--to-ref`) -- this option represents the original ref in a `from_ref...to_ref` diff expression.  For `pre-push` hooks, this represents the branch you are pushing to.  For `post-checkout` hooks, this represents the branch that was previously checked out.z--to-refz--originz-oa(for usage with `--from-ref`) -- this option represents the destination ref in a `from_ref...to_ref` diff expression.  For `pre-push` hooks, this represents the branch being pushed.  For `post-checkout` hooks, this represents the branch that is now checked out.z--pre-rebase-upstreamz.The upstream from which the series was forked.z--pre-rebase-branchzKThe branch being rebased, and is not set when  rebasing the current branch.z--commit-msg-filenamez2Filename to check when running during `commit-msg`z--prepare-commit-message-sourcez]Source of the commit message (typically the second argument to .git/hooks/prepare-commit-msg)z--commit-object-namezRCommit object name (typically the third argument to .git/hooks/prepare-commit-msg)z
--remote-namezRemote name used by `git push`.z--remote-urlzRemote url used by `git push`.z--checkout-typez�Indicates whether the checkout was a branch checkout (changing branches, flag=1) or a file checkout (retrieving a file from the index, flag=0).z--is-squash-mergezHDuring a post-merge hook, indicates whether the merge was a squash mergez--rewrite-commandzJDuring a post-rewrite hook, specifies the command that invoked the rewrite)r$�add_mutually_exclusive_groupr�STAGES�transform_stage)r(�mutex_groups  r)�_add_run_optionsrF@ss��
����c�0I��J�
����T�,��?��5�5�u�5�E�K�����t�L�
0��������b�
2������ ��
B�������l�
1�������� � �
�
&�
&��
L������� G�������E�������j�$�
&��
�����J��
��	�����<���
����
+�������
A������)�
O�������
N�������?�������-M��N�
����
,�������
�������
��r+c� �tjj|j�r.tjj	|j�|_|j
dvrv|jD�cgc]!}tjj	|���#c}|_|j�.tjj	|j�|_|j
dk(rWtjj|j�r.tjj	|j�|_tj�}tj|�tjj|j�|_|j
dvrv|jD�cgc]!}tjj|���#c}|_|j�.tjj|j�|_|j
dk(rYtjj|j�r/tjj|j�|_yyycc}wcc}w)N>r�try-reporH)
�os�path�exists�config�abspath�command�files�commit_msg_filename�repor�get_root�chdir�relpath)�args�filename�toplevels   r)�_adjust_args_and_chdirrX�s���	�w�w�~�~�d�k�k�"��g�g�o�o�d�k�k�2����|�|�*�*�@D�
�
�K�
�H�b�g�g�o�o�h�/�
�K��
��#�#�/�')�w�w����(�(�(�D�$��|�|�z�!�b�g�g�n�n�T�Y�Y�&?��G�G�O�O�D�I�I�.��	��|�|�~�H��H�H�X���'�'�/�/�$�+�+�.�D�K��|�|�*�*�@D�
�
�K�
�H�b�g�g�o�o�h�/�
�K��
��#�#�/�')�w�w����(�(�(�D�$��|�|�z�!�b�g�g�n�n�T�Y�Y�&?��G�G�O�O�D�I�I�.��	�'@�!��%L��Ls�4&J�5&Jc
���|�|ntjdd}tjd��}|j	ddddt
j����|jd	�
��df�fd�}|d
d��}t|�|j	ddd��|j	ddd��|j	ddddgd��|j	ddtdd��|d d!��|d"d#��|d$d%��}tj|�|d&d'��}t|�|j	d(d)��|j	d*d+d,d-�.�t|�|d/d0��}t|�|j	d1d2dd3��|j	d4dd5��t|�|j	d6dd7��|d8d9��}t|�|d:d;��}t|�|d<d=��}	t|	�t|	�|d>d?t
j�d@���|dAdB��}
t|
�|
j	dCdD��|
j	dEdFdG��t|
�|dHdI��}t|�t|�|dJdK��}|j	dLdM�N�|dOdP��}
|
j	dLdM�N��jddQ��}|j	dRdSdT�U��jdV�}t!|�t|�|j	dW�|j	dX�|j	dYd�Z�|j	d[tj"�\�t%|�d]k(rd<g}|j'|�}|j(dk(r*|j*r|j'|j*d^g�n!|j(dk(r|j'd^g�t-�5t/|j0�5t3j4�t7�}|j(t8vr&t;|�|j=|j>�|j(d
k(rUtA|j>|jB|jD|jF|jH�_�cddd�cddd�S|j(d k(rtK|�cddd�cddd�S|j(d"k(rtM|�cddd�cddd�S|j(d$k(r'tjN|�cddd�cddd�S|j(dVk(rctQ||j>|j0|jR|jT|jV|jXdd�`�cddd�cddd�S|j(d/k(rUt[|j>||j\|j^|j`|jb�a�cddd�cddd�S|j(d&k(rJte|j>||jf|j\|jb�b�cddd�cddd�S|j(d8k(r(ta|j>|�cddd�cddd�S|j(d:k(r'ti|j>�cddd�cddd�S|j(d<k(r)tk|j>||�cddd�cddd�S|j(d>k(rtm�cddd�cddd�S|j(dAk(rto|�cddd�cddd�S|j(dHk(r3tq|j>|j\�c�cddd�cddd�S|j(dJk(r'ts|jt�cddd�cddd�S|j(dOk(r'tw|jt�cddd�cddd�Stydd|j(�de���#1swYnxYwddd�y#1swYyxYw)gN�r?)�progz-Vz	--version�versionz	%(prog)s )r1r\rN)r2r#c�D���j||��}t|�|S)NrA)�
add_parserr)�namer#r(�
subparserss   �r)�_add_cmdzmain.<locals>._add_cmd�s%����&�&�t�$�&�7���� ��
r+r	z<Auto-update pre-commit config to the latest repos' versions.rAz--bleeding-edger:zbUpdate to the bleeding edge of `HEAD` instead of the latest tagged version (the default behavior).r=z--freezez3Store "frozen" hashes in `rev` instead of tag namesz--repo�reposr.�REPOz?Only update this repository -- may be specified multiple times.)r2r1�metavarr"r#z-jz--jobsz1Number of threads to use.  (default %(default)s).)r@r"r#r
zClean out pre-commit files.rzClean unused cached repos.rz.Composable tools for rare use in hook `entry`.rzWInstall hook script in a directory intended for use with `git config init.templateDir`.�	directoryz0The directory in which to write the hook script.z--no-allow-missing-config�store_false�allow_missing_configz6Assume cloned repos should have a `pre-commit` config.)r1r2r#rzInstall the pre-commit script.z-fz--overwritez1Overwrite existing hooks / remove migration mode.z--install-hookszMWhether to install hook environments for all environments in the config file.z--allow-missing-configzWWhether to allow a missing `pre-commit` configuration file or exit with a failure code.z
install-hooksz�Install hook environments for all environments in the config file.  You may find `pre-commit install --install-hooks` more useful.zmigrate-configz4Migrate list configuration to new map configuration.rz
Run hooks.rzProduce a sample z filerHz?Try the hooks in a repository, useful for developing new hooks.rQz Repository to source hooks from.z--refz--revzQManually select a rev to run against, otherwise the `HEAD` revision will be used.rz Uninstall the pre-commit script.rz&Validate .pre-commit-config.yaml files�	filenamesr>)r9r z%Validate .pre-commit-hooks.yaml filesz!Show help for a specific command.�help_cmdr7zCommand to show help for.r8z	hook-implr-z
--hook-dirz--skip-on-missing-configr;�rest)r2r9rz--help)�	tags_only�freezerb�jobs)rL�color�	hook_type�hook_dir�skip_on_missing_configrU)r/�	overwrite�hooksrq)r/rq)�config_filer/zCommand z not implemented.)r_�strr#ru�return�argparse.ArgumentParser)>�sys�argv�argparse�ArgumentParserr$r%�VERSION�add_subparsersr*�intr�add_parsersr4rFr&r^r�	REMAINDER�len�
parse_argsrNrirrrnr�check_for_cygwin_mismatchr�COMMANDS_NO_GITrX�mark_config_usedrLr	�
bleeding_edgerlrbrmr
r�implrrorprqrjrr/rrrrgr
rerrrrrrrhr�NotImplementedError�AssertionError)ryr(ra�autoupdate_parser�
hazmat_parser�init_templatedir_parser�install_parser�install_hooks_parser�migrate_config_parser�
run_parser�try_repo_parser�uninstall_parser�validate_config_parser�validate_manifest_parserr#�hook_impl_parserrU�storer`s                  @r)�mainr��s�����#�4����!�"��D�
�
$�
$�,�
7�F�����k���A�I�I�;�'����&�&�I�&�6�J��
!��
K����(�)��"�"��,�
5�#���"�"��<�
B�#���"�"��w�x���
N�#���"�"��h�S�!�
@�#��

�W�8�9��T�4�5���G��M����}�%�&��
-����.�/��(�(��L�)���(�(�#��
#�
E�	)���1�2��i�.N�O�N��~�&�����m�L�
@� ������,�
"� ���.�)���� ��
+� ��$��
����+�,�$��
C����,�-��%�l�3�J��z�"��Z� ��_�%6�q�}�}�o�U�#K�L���
N��O���'�� � ��7�!��� � ���
%�!���_�%���<����'�(��*�+�%�� H����'�'��3�'�?�'��"I� ���)�)�+�S�)�A�� � ��8�!��D�	���j��2M��N�"�,�,�[�9���%�&��'�(��!�!�-�0��!�!�,�/��!�!�"�<�"���!�!�v�X�5G�5G�!�H��4�y�A�~��w�����T�"�D��|�|�v��$�-�-����4�=�=�(�3�4�	
����	����8�*�%�	��/�$�*�*�5��%�%�'�����<�<��.�"�4�(��"�"�4�;�;�/��<�<�<�'�����"�0�0�0��{�{��j�j��Y�Y��6�5���"�\�\�W�
$���<�%6�5���&�\�\�T�
!��e�9�)6�5���*�\�\�X�
%��;�;�t�$�-6�5���.�\�\�[�
(����{�{��j�j��.�.����'+�'B�'B��Y�Y�q�r�]��16�5���B�\�\�Y�
&�����U��?�?��.�.��(�(�'+�'@�'@��E6�5���R�\�\�/�
/�#����U�D�N�N��?�?�'+�'@�'@��U6�5���^�\�\�_�
,� ����e�4�a6�5���b�\�\�-�
-�!�$�+�+�.�e6�5���f�\�\�U�
"��t�{�{�E�4�0�i6�5���j�\�\�_�
,� �?�m6�5���n�\�\�Z�
'��D�>�q6�5���r�\�\�[�
(�� �K�K��?�?��u6�5���|�\�\�.�
.�"�4�>�>�2�6�5���@�\�\�0�
0�$�T�^�^�4�C6�5���F&��4�<�<�.�(9�:��
�G6�5�����s��$a
�:B(`5�"	a
�5`5�	a
�!`5�:	a
�
#`5�0	a
�A`5�"	a
�5A`5�	a
�A`5�	a
�2$`5�	a
�)#`5�	a
�%`5�	a
�`5�/	a
�`5�	a
�./`5�	a
�0#`5�	a
�&#`5�		a
�`5�5`>	�:a
�
a�__main__)r(rwrv�None)rUzargparse.Namespacervr�)N)ryzSequence[str] | Nonervr~)>�
__future__rrz�loggingrIrx�collections.abcr�pre_commit.constants�	constantsr%rrr�pre_commit.colorr�pre_commit.commandsr�pre_commit.commands.autoupdater	�pre_commit.commands.cleanr
�pre_commit.commands.gcr�pre_commit.commands.hook_implr�$pre_commit.commands.init_templatedirr
�%pre_commit.commands.install_uninstallrrr�"pre_commit.commands.migrate_configr�pre_commit.commands.runr�!pre_commit.commands.sample_configr�pre_commit.commands.try_repor�#pre_commit.commands.validate_configr�%pre_commit.commands.validate_manifestr�pre_commit.error_handlerr�pre_commit.logging_handlerr�pre_commit.storer�	getLogger�logger�environ�popr�r*r4rFrXr��__name__�
SystemExit�r+r)�<module>r�s���"���	�
�$� � ��-�&�5�+�%�3�A�9�?�;�=�'�;�1�?�C�2�6�"�
��	�	�<�	(���
�
���$�d�+��
�
���!�4�(�����l�^/�6x
�v�z��
�T�V�
��r+
Back to Directory File Manager