ó
    ç“,j¿3  ã                   ó.  • S SK r S SKJr  S SKJrJrJrJrJrJ	r	  S SK
r
S SKrS SKJr  S SKJr  SSKJrJrJr  SSKJrJrJrJrJr  SS	KJrJrJrJr  S
SKJrJrJ r J!r!J"r"J#r#  S
SKJ$r$  \$RJ                  " SSSS.S9\!" SS\ 3S9\!" \RL                  " 5       SSSS9\"" SSSSS9\"" SSSSS9\"" SSSS94S\RN                  S\(S \S!\)S"\)S#\)4S$ jj5       r*\" 5       SSSS\S%.S \S\(S&\\(\4   S!\)S"\)S'\)S(\)S)\(S*S4S+ jjr+S\4S \S\\(   S)\(S*S4S, jjr,\" 5       SSS4S-\\(   S.\)S"\)S'\)S*S4
S/ jjr-S-\	\(   S0\	\(   S\(S*S4S1 jr.S \S2\\(\4   S*\)4S3 jr/S \S2\\(\4   S*S4S4 jr0\S5.S \S2\\(\4   S)\(S*\\(\4   4S6 jjr1S \S7\\(   S*\\\(\\(   4      4S8 jr2g)9é    N)ÚPath)ÚAnyÚDictÚIterableÚListÚOptionalÚSequence)Úmsg)Úlocale_escapeé   )ÚSimpleFrozenDictÚSimpleFrozenListÚcheck_spacy_env_vars)Úget_checksumÚget_hashÚis_cwdÚjoin_commandÚload_project_config)Úparse_config_overridesÚrun_commandÚsplit_commandÚworking_diré   )ÚCOMMANDÚPROJECT_FILEÚPROJECT_LOCKÚArgÚOptÚ_get_parent_command)ÚappÚrunT)Úallow_extra_argsÚignore_unknown_options)Úcontext_settingszName of command defined in the )ÚhelpzELocation of project directory. Defaults to current working directory.F)r%   ÚexistsÚ	file_okayz--forcez-Fz/Force re-running steps, even if nothing changedz--dryz-Dz+Perform a dry run and don't execute scriptsz--helpz+Show help message and available subcommandsÚctxÚ
subcommandÚproject_dirÚforceÚdryÚ	show_helpc           	      ó–   • [        U 5      nU(       d  U(       d  [        X!U5        g[        U R                  5      n[	        UUUUUUS9  g)a8  Run a named command or workflow defined in the project.yml. If a workflow
name is specified, all commands in the workflow are run, in order. If
commands define dependencies and/or outputs, they will only be re-run if
state has changed.

DOCS: https://github.com/explosion/weasel/tree/main/docs/cli.md#rocket-run
)Ú	overridesr+   r,   Úparent_commandN)r   Úprint_run_helpr   ÚargsÚproject_run)r(   r)   r*   r+   r,   r-   r0   r/   s           ÚœC:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\weasel/cli/run.pyÚproject_run_clir5      sE   € ô( )¨Ó-€NÞž
Ü�{°Õ?ä*¨3¯8©8Ó4ˆ	ÜØØØØØØ)ó	
ó    )r/   r+   r,   ÚcaptureÚskip_requirements_checkr0   r/   r7   r8   r0   Úreturnc          
      óp  • [        XS9nUR                  S/ 5       V	s0 s H  o™S   U	_M
     n
n	UR                  S0 5      n[        [        U
R	                  5       5      [        UR	                  5       5      U5        X;   a4  [
        R                  " SU S35        X±    H  n	[        U U	UUUUS9  M     gX¡   n	U	R                  S/ 5       HF  nX-  R                  5       (       a  M  S	U S
U 3nSnU(       d  SOSn[
        R                  " XÞUS9  MH     [        5         [        U 5       n[
        R                  " U5        [        UU	5      nU(       d%  U(       d  [
        R                  " SU	S    S35        O [        U	S   XES9  U(       d  [        UU	5        SSS5        gs  sn	f ! , (       d  f       g= f)a­  Run a named script defined in the project.yml. If the script is part
of the default pipeline (defined in the "run" section), DVC is used to
execute the command, so it can determine whether to rerun it. It then
calls into "exec" to execute it.

project_dir (Path): Path to project directory.
subcommand (str): Name of command to run.
overrides (Dict[str, Any]): Optional config overrides.
force (bool): Force re-running, even if nothing changed.
dry (bool): Perform a dry run and don't execute commands.
capture (bool): Whether to capture the output and errors of individual commands.
    If False, the stdout and stderr will not be redirected, and if there's an error,
    sys.exit will be called with the return code. You should use capture=False
    when you want to turn over execution to the command, and capture=True
    when you want to run the command more like a function.
skip_requirements_check (bool): No longer used, deprecated.
)r/   ÚcommandsÚnameÚ	workflowszRunning workflow 'Ú')r/   r+   r,   r7   Údepsz)Missing dependency specified by command 'z': zGMaybe you forgot to run the 'weasel assets' command or a previous step?r   N©Úexitsz
Skipping 'z': nothing changedÚscript)r,   r7   )r   ÚgetÚvalidate_subcommandÚlistÚkeysr
   Úinfor3   r&   Úfailr   r   ÚdividerÚcheck_rerunÚrun_commandsÚupdate_lockfile)r*   r)   r/   r+   r,   r7   r8   r0   ÚconfigÚcmdr;   r=   ÚdepÚerrÚerr_helpÚ	err_exitsÚcurrent_dirÚreruns                     r4   r3   r3   4   sˆ  € ô8 ! ÑB€FØ,2¯J©J°zÀ2Ô,FÓGÒ,F S�F‘˜SÒ Ñ,F€HÐGØ—
‘
˜;¨Ó+€IÜœ˜XŸ]™]›_Ó-¬t°I·N±NÓ4DÓ/EÀzÔRàÓÜ�ŠÐ% j \°Ð3Ô4ØÔ(ˆCÜØØØ#ØØØôò )ð Ñ"ˆØ—7‘7˜6 2Ö&ˆCØÑ%×-Ñ-×/Ó/ØAÀ*ÀÈSÐQTÐPUÐV�Ød�Þ%(™A¨d�	Ü—’˜¨iÔ8ñ 'ô 	ÔÜ˜Ô%¨Ü�KŠK˜
Ô#Ü ¨SÓ1ˆEÞ¦Ü—’˜: c¨&¡k ]Ð2DÐEÕFä˜S ™]°ÒEÞÜ# K°Ô5÷ &Ð%ùò1 H÷0 &Õ%ús   žF"Ä*A/F'Æ'
F5c           
      ó,  • [        U 5      nUR                  S/ 5      nU Vs0 s H  oUS   U_M
     nnUR                  S0 5      n[        U 5      (       a  SOU nU(       Ga	  [        [	        UR                  5       5      [	        UR                  5       5      U5        [        SU SU SU 35        X;   a+  Xa   R                  S5      n	U	(       a  [        S	U	 S	35        ggX;   a„  Xq   n
[        S
[        U
5       S35        [        U
5       VVs/ s H#  u  p¼US-    SU 3Xl   R                  SS5      4PM%     nnn[        R                  " U5        U SU S3n[        SU 35        gg[        S5        UR                  S5      nU(       a  [        [        U5       S	35        U(       a^  [        S[         35        [        SU SU 35        [        R                  " U Vs/ s H  oUS   UR                  SS5      4PM     sn5        U(       ao  [        S[         35        [        SU SU 35        [        R                  " UR                  5        VV
s/ s H  u  nn
USR                  U
5      4PM     sn
n5        ggs  snf s  snnf s  snf s  sn
nf )a6  Simulate a CLI help prompt using the info available in the project.yml.

project_dir (Path): The project directory.
subcommand (Optional[str]): The subcommand or None. If a subcommand is
    provided, the subcommand help is shown. Otherwise, the top-level help
    and a list of available commands is printed.
r;   r<   r=   Ú zUsage: ú run Ú r%   Ú
z
Workflow consisting of z
 commands:r   ú. z run [COMMAND] z --helpzFor command details, run: ÚtitlezAvailable commands in zAvailable workflows in z run [WORKFLOW] z -> N)r   rC   r   rD   rE   rF   ÚprintÚlenÚ	enumerater
   Útabler   r   ÚitemsÚjoin)r*   r)   r0   rM   Úconfig_commandsrN   r;   r=   Úproject_locÚ	help_textÚstepsÚiÚstepÚ
steps_dataÚhelp_cmdr[   r<   s                    r4   r1   r1   t   st  € ô ! Ó-€FØ—j‘j ¨RÓ0€OÙ,;Ó<ªO S�F‘˜SÒ ©O€HÐ<Ø—
‘
˜;¨Ó+€IÜ˜{×+Ñ+‘"°€KßÜœD §¡£Ó1´4¸	¿¹Ó8HÓ3IÈ:ÔVÜ�˜Ð' u¨Z¨L¸¸+¸ÐGÔHØÓ!Ø Ñ,×0Ñ0°Ó8ˆIÞÜ˜˜9˜+ RÐ(Õ)ð àÓ$ØÑ)ˆEÜÐ-¬c°%«j¨\¸ÐDÔEô  )¨Ô/ôâ/‘G�Að ˜‘E�7˜"˜T˜FÐ# X¡^×%7Ñ%7¸ÀÓ%CÓDÙ/ð ñ ô �IŠI�jÔ!Ø(Ð)¨¸¸ÀWÐMˆHÜÐ.¨x¨jÐ9Õ:ð %ô 	ˆbŒ	Ø—
‘
˜7Ó#ˆÞÜ”] 5Ó)Ð*¨"Ð-Ô.ÞÜÐ*¬<¨.Ð9Ô:Ü�G˜NÐ+¨?¸;¸-ÐHÔIÜ�IŠIÁ_ÓUÂ_¸c˜F™ S§W¡W¨V°RÓ%8Ó9Á_ÑUÔVÞÜÐ+¬L¨>Ð:Ô;Ü�G˜NÐ+Ð+;¸K¸=ÐIÔJÜ�IŠIÀYÇ_Á_ÔEVÔWÒEV±k°d¸E˜˜fŸk™k¨%Ó0Ó1ÑEVÒWÕXð ùò; =ùóùò Vùó Xs   ¢J Ä*JÇ" JÉ J
r;   Úsilentc                 óH  • U  Hœ  n[        U5      n[        U5      (       a  US   S;   a  [        R                  US'   O1[        U5      (       a!  US   S;   a  [        R                  SS/USS QnU(       d  [	        S[        U5       35        U(       a  M“  [        XSS	9  Mž     g)
a>  Run a sequence of commands in a subprocess, in order.

commands (List[str]): The string commands.
silent (bool): Don't print the commands.
dry (bool): Perform a dry run and don't execut anything.
capture (bool): Whether to capture the output and errors of individual commands.
    If False, the stdout and stderr will not be redirected, and if there's an error,
    sys.exit will be called with the return code. You should use capture=False
    when you want to turn over execution to the command, and capture=True
    when you want to run the command more like a function.
r   )ÚpythonÚpython3)ÚpipÚpip3z-mrn   r   NzRunning command: )r7   )r   r]   ÚsysÚ
executabler\   r   r   )r;   rj   r,   r7   ÚcÚcommands         r4   rK   rK   £   s‘   € ó" ˆÜ Ó"ˆô ˆw�<‰<˜G A™JÐ*?Ó?ÜŸ™ˆG�AŠJÜ��\‰\˜g a™j¨OÓ;Ü—~‘~ t¨UÐA°W¸Q¸R°[ÐAˆGÞÜÐ%¤l°7Ó&;Ð%<Ð=Ô>ßˆsÜ˜Ô1ò! r6   r=   c                 ó¨  • U (       d#  U(       d  [         R                  " S[         3SS9  X ;  a£  X!;  a�  / nUS;   a  UR                  S5        U (       a#  UR                  SSR	                  U 5       35        U(       a#  UR                  SSR	                  U5       35        [         R                  " S	U S
[         3SR	                  U5      SS9  ggg)zžCheck that a subcommand is valid and defined. Raises an error otherwise.

commands (Sequence[str]): The available commands.
subcommand (str): The subcommand.
z$No commands or workflows defined in r   r@   )ÚassetsÚassetz-Did you mean to run: python -m weasel assets?zAvailable commands: z, zAvailable workflows: z Can't find command or workflow 'z' in rZ   N)r
   rH   r   Úappendra   )r;   r=   r)   Úhelp_msgs       r4   rD   rD   Ç   s»   € ö žIÜ�ŠÐ7¼°~ÐFÈaÒPØÓ! jÓ&AØˆØÐ,Ó,Ø�O‰OÐKÔLÞØ�O‰OÐ2°4·9±9¸XÓ3FÐ2GÐHÔIÞØ�O‰OÐ3°D·I±I¸iÓ4HÐ3IÐJÔKÜ�ŠØ.¨z¨l¸%Ä¸~ÐNØ�I‰I�hÓØó	
ð 'BÐ!r6   rs   c                 ó2  • UR                  SS5      (       a  gU [        -  nUR                  5       (       d  g[        R                  " U5      nUS   U;  a  gX1S      nUR                  S/ 5      (       d  g[        X5      n[        U5      [        U5      :g  $ )a  Check if a command should be rerun because its settings or inputs/outputs
changed.

project_dir (Path): The current project directory.
command (Dict[str, Any]): The command, as defined in the project.yml.
strict_version (bool):
RETURNS (bool): Whether to re-run the command.
Úno_skipFTr<   Úouts)rC   r   r&   ÚsrslyÚ	read_yamlÚget_lock_entryr   )r*   rs   Ú	lock_pathÚdataÚentryÚ
lock_entrys         r4   rJ   rJ   à   s‘   € ð ‡{�{�9˜e×$Ñ$ØØœlÑ*€IØ×Ñ×ÑØÜ�?Š?˜9Ó%€DØˆv�˜dÓ"ØØ˜‘Ñ!€Eà�9‰9�V˜R× Ñ Øô   Ó5€JÜ�JÓ¤8¨E£?Ñ2Ð2r6   c                 óì   • U [         -  nUR                  5       (       d  [        R                  " U0 5        0 nO[        R                  " U5      n[        X5      X1S   '   [        R                  " X#5        g)a*  Update the lockfile after running a command. Will create a lockfile if
it doesn't yet exist and will add an entry for the current command, its
script and dependencies/outputs.

project_dir (Path): The current project directory.
command (Dict[str, Any]): The command, as defined in the project.yml.
r<   N)r   r&   r|   Ú
write_yamlr}   r~   )r*   rs   r   r€   s       r4   rL   rL      s_   € ð œlÑ*€IØ×Ñ×ÑÜ×Ò˜ BÔ'Ø‰ä�Š˜yÓ)ˆÜ*¨;Ó@€D�‰ÑÜ	×Ò�YÕ%r6   )r0   c                óÐ   • [        XR                  S/ 5      5      n[        XR                  S/ 5      5      n[        XR                  S/ 5      5      nU SUS    3US   U/ UQUQS.$ )a©  Get a lockfile entry for a given command. An entry includes the command,
the script (command steps) and a list of dependencies and outputs with
their paths and file hashes, if available. The format is based on the
dvc.lock files, to keep things consistent.

project_dir (Path): The current project directory.
command (Dict[str, Any]): The command, as defined in the project.yml.
RETURNS (Dict[str, Any]): The lockfile entry.
r?   ÚoutputsÚoutputs_no_cacherW   r<   rB   )rN   rB   r?   r{   )Úget_fileinforC   )r*   rs   r0   r?   r{   Úouts_ncs         r4   r~   r~     sz   € ô ˜§[¡[°¸Ó%<Ó=€DÜ˜§[¡[°¸BÓ%?Ó@€DÜ˜;¯©Ð4FÈÓ(KÓL€Gà Ð!  w¨v¡Ð&7Ð8Ø˜(Ñ#ØØ!�$Ð!˜Ð!ñ	ð r6   Úpathsc                 óŽ   • / nU H<  nX-  nUR                  5       (       a  [        U5      OSnUR                  X5S.5        M>     U$ )a  Generate the file information for a list of paths (dependencies, outputs).
Includes the file path and the file's checksum.

project_dir (Path): The current project directory.
paths (List[str]): The file paths.
RETURNS (List[Dict[str, str]]): The lockfile entry for a file.
N)ÚpathÚmd5)r&   r   rw   )r*   rŠ   r€   rŒ   Ú	file_pathr�   s         r4   rˆ   rˆ   )  sK   € ð €DÛˆØÑ&ˆ	Ø)2×)9Ñ)9×);Ñ);Œl˜9Ô%ÀˆØ�‰˜TÑ.Ö/ñ ð €Kr6   )3rp   Úpathlibr   Útypingr   r   r   r   r   r	   r|   ÚtyperÚwasabir
   Úwasabi.utilr   Úutilr   r   r   r   r   r   r   r   r   r   r   r   Úmainr   r   r   r   r   r   r    rs   ÚcwdÚContextÚstrÚboolr5   r3   r1   rK   rD   rJ   rL   r~   rˆ   © r6   r4   Ú<module>r›      sß  ðÛ 
Ý ß @× @ã Û Ý Ý %ç KÑ Kß TÕ Tß RÓ Rß T× TÝ ð ‡‚Ø	°ÐQUÑVññ ˜$Ð'FÀ|ÀnÐ%UÑVÙ˜DŸHšH›JÐ-tð  ~Bð  NSñ  TÙ�e˜Y¨Ð3dÑeÙ�E˜7 DÐ/\Ñ]Ù˜% Ð0]Ñ^ñ
à	�‰ð
ð ð
ð ð	
ð
 ð
ð 
ð
ð ô
óð
ñH !1Ó 2ØØØØ$)Ø!ò=6Øð=6àð=6ð �C˜�H‰~ð	=6ð
 ð=6ð 
ð=6ð ð=6ð "ð=6ð ð=6ð 
õ=6ðB 48Èwñ,YØð,YØ#+¨C¡=ð,YØILð,Yà	õ,Yñ` /Ó0ØØØñ	!2Ø�s‰mð!2àð!2ð 
ð!2ð ð	!2ð
 
õ!2ðH
Ø�s‰mð
Ø(0°©ð
ØCFð
à	ô
ð23Øð3à�#�s�(‰^ð3ð 
ô3ð@& ð &°°S¸#°X±ð &À4ô &ð& JQòØðØ $ S¨# X¡ðØCFðà	ˆ#ˆsˆ(�^õð.˜dð ¨4°©9ð ¸¸dÀ3ÈÐQTÉÐCUÑ>VÑ9Wõ r6   