
    wi.>                    6   d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlm	Z
 d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dl m!Z! d dl"m#Z# d dl$m%Z% d dl&m'Z' d dl(m)Z) d dl*m+Z+ d dl,m-Z- d dl.m/Z/ d dl0m1Z1  ej2        d          Z3ej4        5                    dd           ej4        5                    dd           h dZ6d,d!Z7d,d"Z8d,d#Z9d-d&Z:d.d/d*Z;e<d+k    r e= e;                      dS )0    )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>   r   r
   r   sample-configvalidate-configinit-templatedirvalidate-manifestparserargparse.ArgumentParserreturnNonec                L    |                      ddt          j        d           d S )Nz-cz--configzPath to alternate config file)defaulthelp)add_argumentCCONFIG_FILEr!   s    _/root/.openclaw/workspace/chatterbox_venv_py311/lib/python3.11/site-packages/pre_commit/main.py_add_config_optionr-   2   s5    
j!-,          c                N    |                      ddt          j        dd           d S )Nz-t--hook-typeappend
hook_types)choicesactiondest)r(   r   
HOOK_TYPESr+   s    r,   _add_hook_type_optionr7   9   s8    
m$XL      r.   c                >   |                      ddd           |                      ddd           |                     d	
          }|                     dddd           |                     ddg d           |                      ddd           |                      ddd           |                      dt          j        t          j        dd           |                      dd           |                      dd           |                      d d!d"d#           |                      d$d%d&d'           |                      d(d)           |                      d*d+           |                      d,d-           |                      d.d/           |                      d0d1           |                      d2d3           |                      d4d5           |                      d6d7           |                      d8d9           |                      d:d;           d S )<Nhook?zA single hook-id to runnargsr'   z	--verbosez-v
store_truer4   F)requiredz--all-filesz-az!Run on all the files in the repo.r4   r'   z--files*z#Specific filenames to run hooks on.)r<   r&   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)r3   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-typezIndicates 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   STAGEStransform_stage)r!   mutex_groups     r,   _add_run_optionsrI   @   s@   
c0IJJJ
T,???55u5EEKtL0     b2      B     l1      &L      G     E     j$&  
 
 
 J  	 	 	 <    
 +     A     )O     N     ?     -MNNN
,                r.   argsargparse.Namespacec                   t           j                            | j                  r)t           j                            | j                  | _        | j        dv rFd | j        D             | _        | j        )t           j                            | j                  | _        | j        dk    rMt           j                            | j                  r)t           j                            | j                  | _        t          j
                    }t          j        |           t           j                            | j                  | _        | j        dv rFd | j        D             | _        | j        )t           j                            | j                  | _        | j        dk    rOt           j                            | j                  r-t           j                            | j                  | _        d S d S d S )N>   r   try-repoc                L    g | ]!}t           j                            |          "S  )ospathabspath.0filenames     r,   
<listcomp>z*_adjust_args_and_chdir.<locals>.<listcomp>   &    KKKHbgooh//KKKr.   rM   c                L    g | ]!}t           j                            |          "S rO   )rP   rQ   relpathrS   s     r,   rV   z*_adjust_args_and_chdir.<locals>.<listcomp>   rW   r.   )rP   rQ   existsconfigrR   commandfilescommit_msg_filenamerepor   get_rootchdirrY   )rJ   toplevels     r,   _adjust_args_and_chdirrc      s   	w~~dk"" 3goodk22|***KK
KKK
#/')w(( (D$ |z!!bgnnTY&?&?!GOODI..	|~~HHX'//$+..DK|***KK
KKK
#/')w(( (D$ |z!!bgnnTY&?&?!GOODI..			 "!!!r.   argvSequence[str] | Noneintc                   | | nt           j        dd          } t          j        d          }|                    ddddt
          j                    |                    d	
          dkfd} |dd          }t          |           |                    ddd           |                    ddd           |                    ddddg d           |                    d d!t          dd"#            |d$d%            |d&d'            |d(d)          }t          j        |            |d*d+          }t          |           |                    d,d-           |                    d.d/d0d12           t          |            |d3d4          }t          |           |                    d5d6dd7           |                    d8dd9           t          |           |                    d:dd;            |d<d=          }t          |            |d>d?          }t          |            |d@dA          }	t          |	           t          |	            |dBdCt
          j         dD            |dEdF          }
t          |
           |
                    dGdH           |
                    dIdJdK           t          |
            |dLdM          }t          |           t          |            |dNdO          }|                    dPdQR            |dSdT          }|                    dPdQR                               ddU          }|                    dVdWdXY                               dZ          }t!          |           t          |           |                    d[           |                    d\           |                    d]d^           |                    d_t          j        `           t%          |           dak    rd@g} |                    |           }|j        dk    r$|j        r|                    |j        dbg           n!|j        dk    r|                    dbg           t-                      5  t/          |j                  5  t3          j                     t7                      }|j        t8          vr)t;          |           |                    |j                   |j        dk    rFtA          |j        |j!         |j"        |j#        |j$        c          cd d d            cd d d            S |j        d$k    r'tK          |          cd d d            cd d d            S |j        d&k    r'tM          |          cd d d            cd d d            S |j        d(k    r,t          j'        |          cd d d            cd d d            S |j        dZk    rTtQ          ||j        |j        |j)        |j*        |j+        |j,        dd          d          cd d d            cd d d            S |j        d3k    rFt[          |j        ||j.        |j/        |j0        |j1        e          cd d d            cd d d            S |j        d*k    r@te          |j        ||j3        |j.        |j1        f          cd d d            cd d d            S |j        d<k    r-ta          |j        |          cd d d            cd d d            S |j        d>k    r,ti          |j                  cd d d            cd d d            S |j        d@k    r.tk          |j        ||          cd d d            cd d d            S |j        dBk    r&tm                      cd d d            cd d d            S |j        dEk    r'to          |          cd d d            cd d d            S |j        dLk    r3tq          |j        |j.        g          cd d d            cd d d            S |j        dNk    r,ts          |j:                  cd d d            cd d d            S |j        dSk    r,tw          |j:                  cd d d            cd d d            S ty          dh|j         di          # 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )lN   rB   )progz-Vz	--versionversionz	%(prog)s )r4   rj   r\   )r5   namestrr'   r#   r"   c               T                         | |          }t          |           |S )NrD   )
add_parserr   )rk   r'   r!   
subparserss      r,   _add_cmdzmain.<locals>._add_cmd   s.    &&t$&77   r.   r	   z<Auto-update pre-commit config to the latest repos' versions.rD   z--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--reporeposr1   REPOz?Only update this repository -- may be specified multiple times.)r5   r4   metavarr&   r'   z-jz--jobsz1Number of threads to use.  (default %(default)s).)rC   r&   r'   r
   zClean out pre-commit files.r   zClean unused cached repos.r   z.Composable tools for rare use in hook `entry`.r   zWInstall 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-configstore_falseallow_missing_configz6Assume cloned repos should have a `pre-commit` config.)r4   r5   r'   r   zInstall 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.zinstall-hookszInstall 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.r   z
Run hooks.r   zProduce a sample z filerM   z?Try the hooks in a repository, useful for developing new hooks.r_   z Repository to source hooks from.z--refz--revzQManually select a rev to run against, otherwise the `HEAD` revision will be used.r   z Uninstall the pre-commit script.r   z&Validate .pre-commit-config.yaml files	filenamesrA   )r<   r    z%Validate .pre-commit-hooks.yaml filesz!Show help for a specific command.help_cmdr:   zCommand to show help for.r;   z	hook-implr0   z
--hook-dirz--skip-on-missing-configr>   rest)r5   r<   r   z--help)	tags_onlyfreezerq   jobs)r[   color	hook_typehook_dirskip_on_missing_configrJ   )r2   	overwritehooksr   )r2   r   )config_filer2   zCommand z not implemented.z! failed to exit with a returncode)rk   rl   r'   rl   r#   r"   )>sysrd   argparseArgumentParserr(   r)   VERSIONadd_subparsersr-   rf   r   add_parsersr7   rI   r*   rn   r   	REMAINDERlen
parse_argsr\   rx   r   r   r}   r   check_for_cygwin_mismatchr   COMMANDS_NO_GITrc   mark_config_usedr[   r	   bleeding_edger{   rq   r|   r
   r   implr   r~   r   r   ry   r   r2   r   r   rv   r   rt   r   r   r   r   r   r   rw   r   NotImplementedErrorAssertionError)rd   r!   rp   autoupdate_parserhazmat_parserinit_templatedir_parserinstall_parserinstall_hooks_parsermigrate_config_parser
run_parsertry_repo_parseruninstall_parservalidate_config_parservalidate_manifest_parserr'   hook_impl_parserrJ   storero   s                     @r,   mainr      s   #44!""D$,777F k'AI''     &&I&66J     
 !K   ()))"",5 #    ""<B #    ""wxN #    ""hS!@ #   
 HW89999HT45555HG  M }%%%&h-   .///((L )    ((##E	 )    1222Xi.NOOON~&&&mL@      ,"      .))) +      $8   +,,,$HC   ,---%l333Jz"""Z   H_#Kq}#K#K#KLLLLhN  O '''  7 !      % !    _%%%x<   '(((*+++%X H   ''3'???'x"I      ))+S)AAA   8 !  D 	j2MNNN ",,[99%&&&'(((!!-000!!,///!!"< "    !!vX5G!HHH 4yyA~~wT""D|v$-4=(34444			8*%%%	 I
 I
/$*55 I
 I
%'''<.."4(((""4;///<<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future__r   r   loggingrP   r   collections.abcr   pre_commit.constants	constantsr)   r   r   r   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_uninstallr   r   r   "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   	getLoggerloggerenvironpopr   r-   r7   rI   rc   r   __name__
SystemExitrO   r.   r,   <module>r      s   " " " " " "   				 



 $ $ $ $ $ $                               - - - - - - & & & & & & 5 5 5 5 5 5 + + + + + + % % % % % % 3 3 3 3 3 3 A A A A A A 9 9 9 9 9 9 ? ? ? ? ? ? ; ; ; ; ; ; = = = = = = ' ' ' ' ' ' ; ; ; ; ; ; 1 1 1 1 1 1 ? ? ? ? ? ? C C C C C C 2 2 2 2 2 2 6 6 6 6 6 6 " " " " " " 
	<	(	( 
$d + + + 
!4 ( ( (        l l l l^/ / / /6x
 x
 x
 x
 x
v z
*TTVV

 r.   