Ë
    zñ�j!•  ã                   ó  — d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZ d dlm	Z	m
Z
mZmZmZmZmZmZ ddlmZmZmZmZ ddlmZmZ ddlmZmZmZmZ ddlmZm Z m!Z! dd	l"m#Z# dd
l$m%Z%m&Z&m'Z' e	rddl(m)Z) ddlm*Z* ddl$m+Z+  G d„ d«      Z,y)é    N)Úimport_module)ÚTYPE_CHECKINGÚAnyÚDictÚListÚOptionalÚSequenceÚTupleÚTypeé   )Ú
CollectionÚConfigÚExecutorÚFilesystemLoader)ÚcompleteÚprint_completion_script)ÚCollectionNotFoundÚExitÚ
ParseErrorÚUnexpectedExit)ÚArgumentÚParserÚParserContext)Úpty_size)ÚdebugÚenable_loggingÚhelpline)ÚLoader)ÚParseResult)ÚLexiconc                   ó2  — e Zd ZU dZded<   ded   fd„Zded   fd„Zee   ed<   d	Z	d
e	z  Z
dZd
ez  ZdZ	 	 	 	 	 	 	 	 dCdee   ded   dee   dee   deed      deed      deed      deee      ddfd„ZdDd„ZdEdeddfd„ZdFdeee      deddfd„Zdeee      ddfd „ZdDd!„ZdDd"„ZdDd#„ZdDd$„Zdeee      ddfd%„Zedefd&„«       Zedefd'„«       Zedefd(„«       Zedee   fd)„«       ZedGd*„«       Z ede!fd+„«       Z"dDd,„Z#dDd-„Z$dDd.„Z%dDd/„Z&d0e!d1e'ee(f   ddfd2„Z)de*fd3„Z+dDd4„Z,deddfd5„Z-dDd6„Z.dDd7„Z/dDd8„Z0	 dHd9dd:eee      dee1eee   f      fd;„Z2dDd<„Z3dId=edefd>„Z4	 dId?e5e1eee   f      d=eddfd@„Z6dAe5e1eee   f      ddfdB„Z7y)JÚProgramau  
    Manages top-level CLI invocation, typically via ``setup.py`` entrypoints.

    Designed for distributing Invoke task collections as standalone programs,
    but also used internally to implement the ``invoke`` program itself.

    .. seealso::
        :ref:`reusing-as-a-binary` for a tutorial/walkthrough of this
        functionality.

    .. versionadded:: 1.0
    r   ÚcoreÚreturnr   c                 ó2  — t        dt        d¬«      t        dt        dd¬«      t        dd	¬
«      t        dt        dd¬«      t        dt        dd¬«      t        dt        dd¬«      t        ddd¬«      t        dd¬
«      t        ddd¬«      t        dt        dd¬«      t        ddd¬«      t        d t        d!d"¬«      t        d#t        dd$¬«      t        d%t        dd&¬«      t        d't        dd(¬«      t        d)t        dd*¬«      t        d+t        dd,¬«      gS )-zd
        Return default core `.Argument` objects, as a list.

        .. versionadded:: 1.0
        )úcommand-timeoutÚTz7Specify a global command execution timeout, in seconds.)ÚnamesÚkindÚhelp)r   Fz:Print tab-completion candidates for given parse remainder.©r(   r)   Údefaultr*   )ÚconfigÚfz"Runtime configuration file to use.©r(   r*   )r   ÚdzEnable debug output.)ÚdryÚRz!Echo commands instead of running.)ÚechoÚez&Echo executed commands before running.)r*   ÚhTz$Show core or per-task help and exit.)r(   Úoptionalr*   )Úhidez*Set default value of run()'s 'hide' kwarg.)ÚlistÚlz8List available tasks, optionally limited to a namespace.)ú
list-depthÚDr   z3When listing tasks, only show the first INT levels.)úlist-formatÚFzbChange the display format used when listing tasks. Should be one of: flat (default), nested, json.Úflat)r(   r*   r,   )úprint-completion-scriptÚ zIPrint the tab-completion script for your preferred shell (bash|zsh|fish).)úprompt-for-sudo-passwordzCPrompt user at start of session for the sudo.password config value.)ÚptyÚpz(Use a pty when executing shell commands.)ÚversionÚVzShow version and exit.)ú	warn-onlyÚwz3Warn, instead of failing, when shell commands fail.)ú	write-pyczEnable creation of .pyc files.)r   ÚintÚboolÚstr©Úselfs    úO/var/www/api.ozpay.ru/ozpay/venv/lib/python3.12/site-packages/invoke/program.pyÚ	core_argszProgram.core_args0   sm  € ô Ø.ÜØNôô
 Ø#ÜØØQô	ô Ø%Ø9ôô Ø$ÜØØ+ô	ô Ø"ÜØØ8ô	ô Ø#ÜØØ=ô	ô Ø#ØØ;ôô
 ØØAôô Ø#ØØOôô
 Ø)ÜØØJô	ô Ø*ØyØôô
 Ø2ÜØØ`ô	ô Ø3ÜØØZô	ô Ø"ÜØØ?ô	ô Ø&ÜØØ-ô	ô Ø(ÜØØJô	ô Ø$ÜØØ5ô	ðs_
ð _	
ó    c                 óZ   — t        dd¬«      t        dt        dd¬«      t        dd	¬«      gS )
aU  
        Return default task-related `.Argument` objects, as a list.

        These are only added to the core args in "task runner" mode (the
        default for ``invoke`` itself) - they are omitted when the constructor
        is given a non-empty ``namespace`` argument ("bundled namespace" mode).

        .. versionadded:: 1.0
        )Ú
collectionÚcz Specify collection name to load.r/   )ú	no-dedupeFzDisable task deduplication.r+   )úsearch-rootÚrz4Change root directory used for finding task modules.)r   rJ   rL   s    rN   Ú	task_argszProgram.task_args˜   sB   € ô Ø)Ø7ôô Ø$ÜØØ2ô	ô Ø*ØKôð
ð 	
rP   Úargvé   ú é   é   NrD   Ú	namespacer   ÚnameÚbinaryÚloader_classr   Úexecutor_classr   Úconfig_classr   Úbinary_namesc	                 óº   — |€dn|| _         || _        || _        || _        || _        g | _        |xs t        | _        |xs t        | _	        |xs t        | _        y)a^  
        Create a new, parameterized `.Program` instance.

        :param str version:
            The program's version, e.g. ``"0.1.0"``. Defaults to ``"unknown"``.

        :param namespace:
            A `.Collection` to use as this program's subcommands.

            If ``None`` (the default), the program will behave like ``invoke``,
            seeking a nearby task namespace with a `.Loader` and exposing
            arguments such as :option:`--list` and :option:`--collection` for
            inspecting or selecting specific namespaces.

            If given a `.Collection` object, will use it as if it had been
            handed to :option:`--collection`. Will also update the parser to
            remove references to tasks and task-related options, and display
            the subcommands in ``--help`` output. The result will be a program
            that has a static set of subcommands.

        :param str name:
            The program's name, as displayed in ``--version`` output.

            If ``None`` (default), is a capitalized version of the first word
            in the ``argv`` handed to `.run`. For example, when invoked from a
            binstub installed as ``foobar``, it will default to ``Foobar``.

        :param str binary:
            Descriptive lowercase binary name string used in help text.

            For example, Invoke's own internal value for this is ``inv[oke]``,
            denoting that it is installed as both ``inv`` and ``invoke``. As
            this is purely text intended for help display, it may be in any
            format you wish, though it should match whatever you've put into
            your ``setup.py``'s ``console_scripts`` entry.

            If ``None`` (default), uses the first word in ``argv`` verbatim (as
            with ``name`` above, except not capitalized).

        :param binary_names:
            List of binary name strings, for use in completion scripts.

            This list ensures that the shell completion scripts generated by
            :option:`--print-completion-script` instruct the shell to use
            that completion for all of this program's installed names.

            For example, Invoke's internal default for this is ``["inv",
            "invoke"]``.

            If ``None`` (the default), the first word in ``argv`` (in the
            invocation of :option:`--print-completion-script`) is used in a
            single-item list.

        :param loader_class:
            The `.Loader` subclass to use when loading task collections.

            Defaults to `.FilesystemLoader`.

        :param executor_class:
            The `.Executor` subclass to use when executing tasks.

            Defaults to `.Executor`; may also be overridden at runtime by the
            :ref:`configuration system <default-values>` and its
            ``tasks.executor_class`` setting (anytime that setting is not
            ``None``).

        :param config_class:
            The `.Config` subclass to use for the base config object.

            Defaults to `.Config`.

        .. versionchanged:: 1.2
            Added the ``binary_names`` argument.
        NÚunknown)rD   r]   Ú_nameÚ_binaryÚ_binary_namesrX   r   r`   r   ra   r   rb   )	rM   rD   r]   r^   r_   r`   ra   rb   rc   s	            rN   Ú__init__zProgram.__init__¾   s`   € ðj %, O‘y¸ˆŒØ"ˆŒØˆŒ
ð ˆŒØ)ˆÔØˆŒ	Ø(Ò<Ô,<ˆÔØ,Ò8´ˆÔØ(Ò2¬FˆÕrP   c                 ó.   — | j                  «       | _        y)a«  
        Instantiate a `.Config` (or subclass, depending) for use in task exec.

        This Config is fully usable but will lack runtime-derived data like
        project & runtime config files, CLI arg overrides, etc. That data is
        added later in `update_config`. See `.Config` docstring for lifecycle
        details.

        :returns: ``None``; sets ``self.config`` instead.

        .. versionadded:: 1.0
        N)rb   r-   rL   s    rN   Úcreate_configzProgram.create_config  s   € ð ×'Ñ'Ó)ˆ�rP   Úmergec                 ó6  — i }| j                   d   j                  rd|d<   | j                   j                  j                  rd|d<   | j                   j                  j                  r#| j                   j                  j                  |d<   | j                   j                  j                  rd|d<   | j                   j
                  j                  rd|d<   i }d| j                   v r| j                   d   j                  rd	|d
<   i }| j                   d   j                  }|r||d<   i }| j                   d   j                  rd}t        j                  |«      |d<   t        ||||¬«      }| j                  j                  |d	¬«       | j                   j                  j                  }	|	€ t        j                  j                  dd«      }	| j                  j                  |	«       | j                  j                  d	¬«       |r| j                  j                  «        yy)as  
        Update the previously instantiated `.Config` with parsed data.

        For example, this is how ``--echo`` is able to override the default
        config value for ``run.echo``.

        :param bool merge:
            Whether to merge at the end, or defer. Primarily useful for
            subclassers. Default: ``True``.

        .. versionadded:: 1.0
        rF   TÚwarnrB   r7   r3   r1   rT   FÚdeduper&   ÚcommandrA   z&Desired 'sudo.password' config value: Úpassword)ÚrunÚtasksÚsudoÚtimeouts)rl   NÚINVOKE_RUNTIME_CONFIG)ÚargsÚvaluerB   r7   r3   r1   ÚgetpassÚdictr-   Úload_overridesÚosÚenvironÚgetÚset_runtime_pathÚload_runtimerl   )
rM   rl   rr   rs   ru   rp   rt   ÚpromptÚ	overridesÚruntime_paths
             rN   Úupdate_configzProgram.update_config.  s´  € ð& ˆØ�9‰9�[Ñ!×'Ò'ØˆC�‰KØ�9‰9�=‰=×ÒØˆC�‰JØ�9‰9�>‰>×ÒØŸ)™)Ÿ.™.×.Ñ.ˆC�‰KØ�9‰9�>‰>×ÒØˆC�‰KØ�9‰9�=‰=×ÒØˆC�‰JØˆØ˜$Ÿ)™)Ñ#¨¯	©	°+Ñ(>×(DÒ(DØ#ˆE�(‰OØˆØ—)‘)Ð-Ñ.×4Ñ4ˆÙØ")ˆH�YÑð ˆØ�9‰9Ð/Ñ0×6Ò6Ø=ˆFÜ&Ÿ™¨vÓ6ˆD�ÑÜ˜S¨°DÀ8ÔLˆ	Ø�‰×"Ñ" 9°EÐ"Ô:Ø—y‘y×'Ñ'×-Ñ-ˆØÐÜŸ:™:Ÿ>™>Ð*AÀ4ÓHˆLØ�‰×$Ñ$ \Ô2Ø�‰× Ñ  uÐ Ô-ÙØ�K‰K×ÑÕð rP   Úexitc                 óö  — 	 | j                  «        | j                  |«       | j                  «        | j                  «        | j	                  «        | j                  «        | j                  «        y# t        t        t        f$ �rP}t        dj                  |«      «       t        |t        «      rt        |t        j                  ¬«       t        |t        «      r1|j                   r%t        |j                   t        j                  ¬«       t        |t        «      r2|j"                  j$                  rt        |t        j                  d¬«       |rlt        |t        «      r|j"                  j&                  }n/t        |t        «      r|j(                  }nt        |t        «      rd}t        j*                  «       nt        d«       Y d}~yY d}~yd}~wt,        $ r t        j*                  d«       Y yw xY w)aÀ  
        Execute main CLI logic, based on ``argv``.

        :param argv:
            The arguments to execute against. May be ``None``, a list of
            strings, or a string. See `.normalize_argv` for details.

        :param bool exit:
            When ``False`` (default: ``True``), will ignore `.ParseError`,
            `.Exit` and `.Failure` exceptions, which otherwise trigger calls to
            `sys.exit`.

            .. note::
                This is mostly a concession to testing. If you're setting this
                to ``False`` in a production setting, you should probably be
                using `.Executor` and friends directly instead!

        .. versionadded:: 1.0
        z-Received a possibly-skippable exception: {!r})Úfiler@   )r‡   Úendr   z3Invoked as run(..., exit=False), ignoring exceptionN)rk   Ú
parse_coreÚparse_collectionÚparse_tasksÚparse_cleanupr„   Úexecuter   r   r   r   ÚformatÚ
isinstanceÚprintÚsysÚstderrÚmessageÚresultr7   ÚexitedÚcoder…   ÚKeyboardInterrupt)rM   rX   r…   r4   r–   s        rN   rr   zProgram.runc  sY  € ð(/	ð ×ÑÔ ð �O‰O˜DÔ!à×!Ñ!Ô#à×ÑÔà×ÑÔ ð ×ÑÔ ð �L‰L�NøÜ¤¤jÐ1ó 	MÜÐA×HÑHÈÓKÔLô ˜!œZÔ(Ü�aœcŸj™jÕ)Ü˜!œTÔ" q§y¢yÜ�a—i‘i¤c§j¡jÕ1Ü˜!œ^Ô,°·±·²Ü�aœcŸj™j¨bÕ1áÜ˜a¤Ô0ØŸ8™8Ÿ?™?‘DÜ ¤4Ô(ØŸ6™6‘DÜ ¤:Ô.Ø�DÜ—‘˜•äÐK×LÑLô ûô !ò 	Ü�H‰H�QŽKð	ús   ‚A1A4 Á4G8Â	EGÇ!G8Ç7G8c                 óF  — t        dj                  |«      «       | j                  |«       | j                  «        t        d«       | j                  d   j
                   t        _        | j                  j                   j
                  r
t        «        | j                  j                  j
                  r!t        d«       | j                  «        t        ‚| j                  d   j
                  r4t        | j                  d   j
                  | j                  ¬«       t        ‚y )Nzargv given to Program.run: {!r}zFinished parsing core argsrH   z)Saw --version, printing version & exitingr?   )Úshellr(   )r   rŽ   Únormalize_argvÚparse_core_argsrw   rx   r‘   Údont_write_bytecoder   rD   Úprint_versionr   r   rc   ©rM   rX   s     rN   r‰   zProgram.parse_core¨  sä   € ÜÐ/×6Ñ6°tÓ<Ô=Ø×Ñ˜DÔ!ð 	×ÑÔÜÐ*Ô+ð '+§i¡i°Ñ&<×&BÑ&BÐ"BŒÔð �9‰9�?‰?× Ò ÜÔð �9‰9×Ñ×"Ò"ÜÐ=Ô>Ø×ÑÔ ÜˆJð �9‰9Ð.Ñ/×5Ò5Ü#Ø—i‘iÐ 9Ñ:×@Ñ@Ø×'Ñ'õô ˆJð 6rP   c                 ó^  — | j                   �t        d«       | j                   | _        n^t        d«       | j                  j                  j
                  du r!t        d«       | j                  «        t        ‚| j                  «        d| _	        d| _
        d| _        | j                  | _        y)z`
        Load a tasks collection & project-level config.

        .. versionadded:: 1.0
        Nz;Program was given default namespace, not loading collectionz;No default namespace provided, trying to load one from diskTz8No bundled namespace & bare --help given; printing help.r>   )r]   r   rR   rw   r*   rx   Ú
print_helpr   Úload_collectionÚ	list_rootÚ
list_depthÚlist_formatÚscoped_collectionrL   s    rN   rŠ   zProgram.parse_collectionÆ  s•   € ð �>‰>Ð%ÜØMôð #Ÿn™nˆD�OäØMôð �y‰y�~‰~×#Ñ# tÑ+ÜØNôð —‘Ô!Ü�
Ø× Ñ Ô"ð )-ˆŒØ)-ˆŒØ!ˆÔØ!%§¡ˆÕrP   c                 ó   — | j                   j                  j                  }|du r!t        d«       | j	                  «        t
        ‚|rV|| j                  j                  v r$d}t        |«       | j                  |«       t
        ‚t        dj                  |«      «      ‚| j                   j                  j                  }| j                   d   j                  | _        | j                   d   j                  | _        |rPt        |t        «      r*|| _        	 | j"                  j%                  |«      }|| _        | j+                  «        t
        ‚| j                   j,                  j                  rFt-        | j.                  | j0                  | j2                  | j"                  | j5                  «       ¬«       | j6                  s(| j"                  j8                  s| j;                  «        y	y	y	# t(        $ r d}t        |j                  |«      «      ‚w xY w)
zo
        Post-parsing, pre-execution steps such as --help, --list, etc.

        .. versionadded:: 1.0
        Tz(Saw bare --help, printing help & exitingz7Saw --help <taskname>, printing per-task help & exitingzNo idea what '{}' is!r<   r:   zSub-collection '{}' not found!)r(   r#   Úinitial_contextrR   ÚparserN)rw   r*   rx   r   r    r   r¨   ÚcontextsÚprint_task_helpr   rŽ   r8   r¤   r£   r�   rK   r¢   rR   Úsubcollection_from_pathr¥   ÚKeyErrorÚ
list_tasksr   rc   r#   r§   Ú_make_parserrs   r,   Úno_tasks_given)rM   ÚhalpÚmsgr¢   Úsubs        rN   rŒ   zProgram.parse_cleanupê  s¬  € ð �y‰y�~‰~×#Ñ#ˆð �4‰<ÜÐ<Ô=Ø�O‰OÔÜˆJñ Ø�t—{‘{×+Ñ+Ñ+ØO�Ü�c”
Ø×$Ñ$ TÔ*Ü�
ô !Ð!8×!?Ñ!?ÀÓ!EÓFÐFð —I‘I—N‘N×(Ñ(ˆ	ØŸ9™9 ]Ñ3×9Ñ9ˆÔØŸ)™) LÑ1×7Ñ7ˆŒÙä˜)¤SÔ)Ø!*�”ð6ØŸ/™/×AÑAÀ)ÓL�CØ-0�DÔ*ð �O‰OÔÜˆJð �9‰9×Ñ×#Ò#ÜØ×'Ñ'Ø—Y‘YØ $× 4Ñ 4ØŸ?™?ð ×(Ñ(Ó*õð �zŠz $§/¡/×"9Ò"9Ø×ÑÕ!ð #:ˆzøô-  ò 6Ø:�CÜ˜sŸz™z¨)Ó4Ó5Ð5ð6ús   Ä"G' Ç'&Hc                 óD   — t        d«       | j                  «        t        ‚)NzVNo tasks specified for execution and no default task; printing global help as fallback)r   r    r   rL   s    rN   r¯   zProgram.no_tasks_given(  s   € ÜØdô	
ð 	�‰ÔÜˆ
rP   c                 ó:  — | j                   }| j                  j                  j                   }|�,|j                  d«      \  }}}t	        |«      }t        ||«      } || j                  | j                  | j                  «      } |j                  | j                  Ž  y)aÆ  
        Hand off data & tasks-to-execute specification to an `.Executor`.

        .. note::
            Client code just wanting a different `.Executor` subclass can just
            set ``executor_class`` in `.__init__`, or override
            ``tasks.executor_class`` anywhere in the :ref:`config system
            <default-values>` (which may allow you to avoid using a custom
            Program entirely).

        .. versionadded:: 1.0
        Nú.)	ra   r-   rs   Ú
rpartitionr   ÚgetattrrR   r#   r�   )rM   ÚklassÚconfig_pathÚmodule_pathÚ_Ú
class_nameÚmoduleÚexecutors           rN   r�   zProgram.execute/  s‡   € ð ×#Ñ#ˆØ—k‘k×'Ñ'×6Ñ6ˆØÐ"à)4×)?Ñ)?ÀÓ)DÑ&ˆK˜˜Jô # ;Ó/ˆFÜ˜F JÓ/ˆEÙ˜Ÿ™¨$¯+©+°t·y±yÓAˆØˆ×Ñ˜$Ÿ*™*Ò%rP   c                 óî   — |€2t         j                  }t        dj                  |«      «       || _        yt	        |t
        «      r*|j                  «       }t        dj                  |«      «       || _        y)a¡  
        Massages ``argv`` into a useful list of strings.

        **If None** (the default), uses `sys.argv`.

        **If a non-string iterable**, uses that in place of `sys.argv`.

        **If a string**, performs a `str.split` and then executes with the
        result. (This is mostly a convenience; when in doubt, use a list.)

        Sets ``self.argv`` to the result.

        .. versionadded:: 1.0
        Nz#argv was None; using sys.argv: {!r}z%argv was string-like; splitting: {!r})r‘   rX   r   rŽ   r�   rK   Úsplitrž   s     rN   rš   zProgram.normalize_argvI  sa   € ð ˆ<Ü—8‘8ˆDÜÐ7×>Ñ>¸tÓDÔEð ˆ�	ô ˜œcÔ"Ø—:‘:“<ˆDÜÐ9×@Ñ@ÀÓFÔGØˆ�	rP   c                 óR   — | j                   xs | j                  j                  «       S )zi
        Derive program's human-readable name based on `.binary`.

        .. versionadded:: 1.0
        )rf   r_   Ú
capitalizerL   s    rN   r^   zProgram.name`  s    € ð �z‰zÒ5˜TŸ[™[×3Ñ3Ó5Ð5rP   c                 óv   — | j                   r,t        j                  j                  | j                   d   «      S dS )zò
        Returns the program name we were actually called as.

        Specifically, this is the (Python's os module's concept of a) basename
        of the first argument in the parsed argument vector.

        .. versionadded:: 1.2
        r   r@   )rX   r|   ÚpathÚbasenamerL   s    rN   Ú	called_aszProgram.called_asi  s,   € ð 26·²Œr�w‰w×Ñ §	¡	¨!¡Ó-ÐBÀÐBrP   c                 ó6   — | j                   xs | j                  S )zu
        Derive program's help-oriented binary name(s) from init args & argv.

        .. versionadded:: 1.0
        )rg   rÆ   rL   s    rN   r_   zProgram.binaryv  s   € ð �|‰|Ò-˜tŸ~™~Ð-rP   c                 ó8   — | j                   xs | j                  gS )zv
        Derive program's completion-oriented binary name(s) from args & argv.

        .. versionadded:: 1.2
        )rh   rÆ   rL   s    rN   rc   zProgram.binary_names  s   € ð ×!Ñ!Ò5 d§n¡nÐ%5Ð5rP   c                 ó4   — | j                   d   j                  S )zj
        Obtain core program args from ``self.core`` parse result.

        .. versionadded:: 1.0
        r   )r#   rw   rL   s    rN   rw   zProgram.args‰  s   € ð �y‰y˜‰|× Ñ Ð rP   c                 óx   — | j                  «       }| j                  €|| j                  «       z  }t        |¬«      S )zñ
        The initial parser context, aka core program flags.

        The specific arguments contained therein will differ depending on
        whether a bundled namespace was specified in `.__init__`.

        .. versionadded:: 1.0
        )rw   )rO   r]   rW   r   )rM   rw   s     rN   r§   zProgram.initial_context’  s6   € ð �~‰~ÓˆØ�>‰>Ð!Ø�D—N‘NÓ$Ñ$ˆDÜ $Ô'Ð'rP   c                 ój   — t        dj                  | j                  | j                  xs d«      «       y )Nú{} {}re   )r�   rŽ   r^   rD   rL   s    rN   r�   zProgram.print_version¡  s"   € Üˆg�n‰n˜TŸY™Y¨¯©Ò(A¸	ÓBÕCrP   c                 ó<  — d}| j                   �d}t        dj                  | j                  |«      «       t        d«       t        d«       t        d«       | j	                  | j
                  j                  «       «       | j                   �| j                  «        y y )Nz-task1 [--task1-opts] ... taskN [--taskN-opts]z$<subcommand> [--subcommand-opts] ...zUsage: {} [--core-opts] {}r@   zCore options:)r]   r�   rŽ   r_   Úprint_columnsr§   Úhelp_tuplesr­   )rM   Úusage_suffixs     rN   r    zProgram.print_help¤  s|   € ØFˆØ�>‰>Ð%ØAˆLÜÐ*×1Ñ1°$·+±+¸|ÓLÔMÜˆbŒ	ÜˆoÔÜˆbŒ	Ø×Ñ˜4×/Ñ/×;Ñ;Ó=Ô>Ø�>‰>Ð%Ø�O‰OÕð &rP   c                 ó  — t        d«       t        | j                  d¬«      }|j                  | j                  dd «      | _        d}t        |j                  | j
                  | j
                  j                  «      «       y)z³
        Filter out core args, leaving any tasks or their args for later.

        Sets ``self.core`` to the `.ParseResult` from this step.

        .. versionadded:: 1.0
        z#Parsing initial context (core args)T)ÚinitialÚignore_unknownr   Nz-Core-args parse result: {!r} & unparsed: {!r})r   r   r§   Ú
parse_argvrX   r#   rŽ   Úunparsed)rM   r¨   r±   s      rN   r›   zProgram.parse_core_args°  sa   € ô 	Ð3Ô4Ü × 4Ñ 4ÀTÔJˆØ×%Ñ% d§i¡i°° mÓ4ˆŒ	Ø=ˆÜˆc�j‰j˜Ÿ™ D§I¡I×$6Ñ$6Ó7Õ8rP   c                 ó$  — | j                   d   j                  }| j                  | j                  |¬«      }| j                   j                  j                  }	 |j                  |«      \  }}| j                  j                  |«       | j                  j                  «        t        j                  ||| j                  j                  j                  ¬«      | _        y# t        $ r)}t        dj                  |j                  «      «      ‚d}~ww xY w)zq
        Load a task collection based on parsed core args, or die trying.

        .. versionadded:: 1.0
        rU   )r-   Ústart)Úloaded_fromÚauto_dash_namesz%Can't find any collection named {!r}!N)rw   rx   r`   r-   rR   ÚloadÚset_project_locationÚload_projectr   Úfrom_modulers   rÙ   r   r   rŽ   r^   )rM   r×   ÚloaderÚ	coll_namer½   Úparentr4   s          rN   r¡   zProgram.load_collection¾  sã   € ð —	‘	˜-Ñ(×.Ñ.ˆØ×"Ñ"Ø—;‘; eð #ó 
ˆð —I‘I×(Ñ(×.Ñ.ˆ	ð	OØ#Ÿ[™[¨Ó3‰NˆF�Fð
 �K‰K×,Ñ,¨VÔ4Ø�K‰K×$Ñ$Ô&Ü(×4Ñ4ØØ"Ø $§¡× 1Ñ 1× AÑ AôˆD�Oøô
 "ò 	OÜÐ>×EÑEÀaÇfÁfÓMÓNÐNûð	Oús   ÁBC Ã	DÃ&$D
Ä
DÚcontextÚnew_argsc                 óŠ   — |j                  «       D ]0  \  }}|j                  sŒ|j                  |j                  |   _        Œ2 y ©N)ÚitemsÚ	got_valueÚ_valuerw   )rM   rá   râ   ÚkeyÚargs        rN   Ú_update_core_contextzProgram._update_core_contextÛ  s:   € ð !Ÿ™Ó(ò 	6‰HˆC�Ø�}‹}Ø+.¯:©:�—‘˜SÑ!Õ(ñ	6rP   c                 ó    — t        | j                  | j                  j                  | j                  j
                  j                  ¬«      ¬«      S )N)Úignore_unknown_help)rÒ   r©   )r   r§   rR   Úto_contextsr-   rs   rì   rL   s    rN   r®   zProgram._make_parseræ  sB   € ÜØ×(Ñ(Ø—_‘_×0Ñ0Ø$(§K¡K×$5Ñ$5×$IÑ$Ið 1ó ô
ð 	
rP   c                 ó¾  — | j                  «       | _        t        dj                  | j                  «      «       | j                  j                  | j                  j                  «      }|j                  d«      | _	        | j                  | j                  d   | j                  j                  ¬«       || _        t        dj                  | j                  «      «       y)aý  
        Parse leftover args, which are typically tasks & per-task args.

        Sets ``self.parser`` to the parser used, ``self.tasks`` to the
        parsed per-task contexts, and ``self.core_via_tasks`` to a context
        holding any core flags seen within the task contexts.

        Also modifies ``self.core`` to include the data from ``core_via_tasks``
        (so that it correctly reflects any supplied core flags regardless of
        where they appeared).

        .. versionadded:: 1.0
        zParsing tasks against {!r}r   )rá   râ   zResulting task contexts: {!r}N)r®   r¨   r   rŽ   rR   rÔ   r#   rÕ   ÚpopÚcore_via_tasksrê   rw   rs   )rM   r”   s     rN   r‹   zProgram.parse_tasksî  s§   € ð ×'Ñ'Ó)ˆŒÜÐ*×1Ñ1°$·/±/ÓBÔCØ—‘×'Ñ'¨¯	©	×(:Ñ(:Ó;ˆØ$Ÿj™j¨›mˆÔØ×!Ñ!Ø—I‘I˜a‘L¨4×+>Ñ+>×+CÑ+Cð 	"ô 	
ð ˆŒ
ÜÐ-×4Ñ4°T·Z±ZÓ@ÕArP   c                 óš  — | j                   j                  |   }|j                  «       }t        j                  | j
                  |   «      }d}|rdnd}t        |j                  | j                  ||«      «       t        d«       t        d«       |rU|j                  «       D ]6  }|j                  «       rt        | j                  |z   «       Œ,t        d«       Œ8 t        d«       n#t        | j                  dz   «       t        d«       t        d«       |r| j                  |«       yt        | j                  dz   «       t        d«       y)zp
        Print help for a specific task, e.g. ``inv --help <taskname>``.

        .. versionadded:: 1.0
        z3Usage: {} [--core-opts] {} {}[other tasks here ...]z[--options] r@   z
Docstring:ÚnonezOptions:N)r¨   r©   rÏ   ÚinspectÚgetdocrR   r�   rŽ   r_   Ú
splitlinesÚstripÚleading_indentrÎ   )rM   r^   ÚctxÚtuplesÚ	docstringÚheaderÚoptsÚlines           rN   rª   zProgram.print_task_help  s  € ð �k‰k×"Ñ" 4Ñ(ˆØ—‘Ó"ˆÜ—N‘N 4§?¡?°4Ñ#8Ó9ˆ	ØFˆÙ!'‰~¨RˆÜˆf�m‰m˜DŸK™K¨¨tÓ4Ô5ÜˆbŒ	ÜˆlÔÙà!×,Ñ,Ó.ò �Ø—:‘:”<Ü˜$×-Ñ-°Ñ4Õ5ä˜"•Ið	ô
 �"�Iä�$×%Ñ%¨Ñ.Ô/Ü�"ŒIÜˆjÔÙØ×Ñ˜vÕ&ä�$×%Ñ%¨Ñ.Ô/Ü�"�IrP   c                 óÀ   — | j                   }|s&d}t        |j                  |j                  «      «      ‚ t	        | dj                  | j
                  «      «      «        y )Nz"No tasks found in collection '{}'!zlist_{})r¥   r   rŽ   r^   r·   r¤   )rM   Úfocusr±   s      rN   r­   zProgram.list_tasks'  sO   € à×&Ñ&ˆÙØ6ˆCÜ�s—z‘z %§*¡*Ó-Ó.Ð.ð 	:Œ��i×&Ñ& t×'7Ñ'7Ó8Ó9Õ;rP   c                 ó^   — | j                  | j                  «      }| j                  |¬«       y )N)Úpairs©Ú_make_pairsr¥   Údisplay_with_columns)rM   r  s     rN   Ú	list_flatzProgram.list_flat1  s)   € Ø× Ñ  ×!7Ñ!7Ó8ˆØ×!Ñ!¨Ð!Õ.rP   c                 ód   — | j                  | j                  «      }d}| j                  ||¬«       y )Nz'*' denotes collection defaults)r  Úextrar  )rM   r  r  s      rN   Úlist_nestedzProgram.list_nested5  s0   € Ø× Ñ  ×!7Ñ!7Ó8ˆØ1ˆØ×!Ñ!¨°UÐ!Õ;rP   ÚcollÚ	ancestorsc                 ó
  — |€g }g }t        |«      | j                  z  }dj                  d„ |D «       «      }t        |j                  j                  «       «      D �]2  \  }}||j                  k(  }|}	t        t        |j                  t        |j                  «      «      «      }
|s| j                  r/dj                  |	«      }	|
D �cg c]  }dj                  |«      ‘Œ }
}| j                  dk(  r	|}|r|	dz  }	| j                  dk(  r=|}|r| j                  rd|z   }|
D �cg c]  }||z   ‘Œ	 }
}|r|r|
j                  d|«       |
r dj                  d	j                  |
«      «      nd
}|	z   |z   }|j                  |t!        |«      f«       �Œ5 | j"                  xr t        |«      dz   | j"                  k\  }t        |j$                  j                  «       «      D �]  \  }}|}	|s| j                  rdj                  |	«      }	|radD �cg c]3  }t'        ||«      r%dj                  t        t'        ||«      «      |«      ‘Œ5 }}|	dj                  d	j                  |«      «      z  }	| j                  dk(  r |j                  ||	z   t!        |«      f«       n0| j                  dk(  r!|r|j                  ||	z   t!        |«      f«       |rŒí| j)                  |||gz   ¬«      }|j+                  |«       �Œ |S c c}w c c}w c c}w )Nrµ   c              3   ó    K  — | ]  }|–— Œ y ­wrä   © ©Ú.0Úxs     rN   ú	<genexpr>z&Program._make_pairs.<locals>.<genexpr>C  s   è ø€ Ò 6 q¤Ñ 6ùs   ‚ú.{}ÚnestedÚ*r>   r   z ({})z, r@   r   )rs   ÚcollectionsrÌ   z [{}])r	  r
  )ÚlenÚindentÚjoinÚsortedrs   rå   r,   r8   ÚmapÚ	transformÚaliasesr¢   rŽ   r¤   ÚinsertÚappendr   r£   r  r·   r  Úextend)rM   r	  r
  r  r  Úancestor_pathr^   ÚtaskÚ
is_defaultÚdisplaynamer  r  ÚprefixÚaliasÚ	alias_strÚfullÚtruncateÚsubcollÚattrÚtalliesÚrecursed_pairss                        rN   r  zProgram._make_pairs:  sÞ  € ð
 ÐØˆIØˆÜ�Y“ $§+¡+Ñ-ˆØŸ™Ñ 6¨IÔ 6Ó6ˆÜ  §¡×!1Ñ!1Ó!3Ó4ó  	1‰JˆD�$Ø §¡Ñ-ˆJð ˆKÜœ3˜tŸ~™~¬v°d·l±lÓ/CÓDÓEˆGñ ˜DŸNšNØ#Ÿl™l¨;Ó7�Ø4;Ö<¨q˜5Ÿ<™<¨�?Ð<�Ð<à×Ñ 8Ò+Ø�ÙØ 3Ñ&�Kð ×Ñ 6Ò)Ø&�ñ ˜dŸnšnØ  6™\�FØ7>Ö?¨e˜6 E›>Ð?�Ð?Ù¡)Ø—N‘N 1 fÔ-á>E˜Ÿ™ t§y¡y°Ó'9Ô:È2ˆIØ˜KÑ'¨)Ñ3ˆDØ�L‰L˜$¤¨£Ð/Ö0ðA 	1ðD —?‘?ÒN¬¨I«¸Ñ(:¸t¿¹Ñ'NˆÜ# D×$4Ñ$4×$:Ñ$:Ó$<Ó=ó 	-‰MˆD�'ØˆKÙ˜DŸNšNØ#Ÿl™l¨;Ó7�Ùð !9öàÜ˜w¨Ô-ð —N‘N¤3¤w¨w¸Ó'=Ó#>ÀÕEð�ð ð
 ˜wŸ~™~¨d¯i©i¸Ó.@ÓAÑA�Ø×Ñ 8Ò+Ø—‘˜f {Ñ2´H¸WÓ4EÐFÕGØ×!Ñ! VÒ+±à—‘˜m¨kÑ9¼8ÀGÓ;LÐMÔNâØ!%×!1Ñ!1Ø ¨I¸¸Ñ,>ð "2ó "�ð —‘˜^Ö,ð+	-ð, ˆùò] =ùò @ùòs   ÃK6Ä!K;È
8L c                 ó¦   — | j                   rt        d«      ‚| j                  }|j                  «       }t	        t        j                  |«      «       y )Nz:The --list-depth option is not supported with JSON format!)r£   r   r¥   Ú
serializedr�   ÚjsonÚdumps)rM   r	  Údatas      rN   Ú	list_jsonzProgram.list_json  sE   € ð
 �?Š?ÜØLóð ð ×%Ñ%ˆØ�‰Ó ˆÜŒd�j‰j˜ÓÕrP   r  c                 ó  — | j                   }| j                  }|rdj                  |«      nd}d}|s|r0|rdj                  |«      nd}|r|rdnd}dj                  |||«      }dj                  ||«      }| j                  �d}|S )Nú '{}'r@   zdepth={}z; z	 ({}{}{})zAvailable{} tasks{}ÚSubcommands)r¢   r£   rŽ   r]   )	rM   r  ÚrootÚdepthÚ	specifierÚtailÚdepthstrÚjoinerÚtexts	            rN   Útask_list_openerzProgram.task_list_opener�  s‹   € Ø�~‰~ˆØ—‘ˆÙ,0�G—N‘N 4Ô(°bˆ	ØˆÙ‘EÙ38�z×(Ñ(¨Ô/¸bˆHÙ#©‘T°BˆFØ×%Ñ% h°¸Ó>ˆDØ$×+Ñ+¨I°tÓ<ˆð �>‰>Ð%Ø ˆDØˆrP   r  c                 óF  — | j                   }t        dj                  | j                  |¬«      «      «       | j	                  |«       | j
                  j                  }|rBd}|r"dj                  |«      }dj                  |«      }t        dj                  ||«      «       y y )Nz{}:
)r  r@   r4  r  zDefault{} task: {}
)r¢   r�   rŽ   r=  rÎ   r¥   r,   )rM   r  r  r6  r,   Úspecifics         rN   r  zProgram.display_with_columnsŸ  s�   € ð �~‰~ˆÜˆg�n‰n˜T×2Ñ2¸Ð2Ó?Ó@ÔAØ×Ñ˜5Ô!ð ×(Ñ(×0Ñ0ˆÙØˆHÙØ"Ÿ>™>¨$Ó/�ØŸ,™, wÓ/�äÐ(×/Ñ/°¸'ÓBÕCð rP   rù   c                 ó  — t        d„ |D «       «      }t        «       d   |z
  | j                  z
  | j                  z
  dz
  }t	        j
                  |¬«      }|D ]¨  \  }}|€d}|j                  |«      }|t        |«      z
  }dj                  | j                  ||dz  | j                  dz  f«      }	|r6t        |	|d   z   «       |dd D ]  }
t        dt        |	«      z  |
z   «       Œ Œ�t        |	j                  «       «       Œª t        d«       y)z®
        Print tabbed columns from (name, help) ``tuples``.

        Useful for listing tasks + docstrings, flags + help strings, etc.

        .. versionadded:: 1.0
        c              3   ó8   K  — | ]  }t        |d    «      –— Œ y­w)r   N)r  r  s     rN   r  z(Program.print_columns.<locals>.<genexpr>¼  s   è ø€ Ò3 qœ˜Q˜q™TŸÑ3ùs   ‚r   r   )ÚwidthNr@   rZ   )Úmaxr   Úleading_indent_widthÚcol_paddingÚtextwrapÚTextWrapperÚwrapr  r  r÷   r�   Úrstrip)rM   rù   Ú
name_widthÚ
desc_widthÚwrapperr^   Úhelp_strÚhelp_chunksÚname_paddingÚspecÚchunks              rN   rÎ   zProgram.print_columns°  s,  € ô Ñ3¨FÔ3Ó3ˆ
ä‹J�q‰MØñà×'Ñ'ñ(ð ×Ññð ñ	ð 	ô ×&Ñ&¨ZÔ8ˆØ$ò 	%‰NˆD�(ØÐØ�à!Ÿ,™, xÓ0ˆKà%¬¨D«	Ñ1ˆLØ—7‘7à×'Ñ'ØØ  3Ñ&Ø×$Ñ$ sÑ*ð	óˆDñ Ü�d˜[¨™^Ñ+Ô,Ø(¨¨˜_ò 5�EÜ˜3¤ T£™?¨eÑ3Õ4ñ5ô �d—k‘k“mÕ$ð+	%ô, 	ˆb�	rP   )NNNNNNNN)r$   N)T)NT)r$   r    rä   )r@   )8Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r   rO   rW   rK   rD  r÷   Úindent_widthr  rE  r   r   ri   rk   rJ   r„   rr   r‰   rŠ   rŒ   r¯   r�   rš   Úpropertyr^   rÆ   r_   rc   rw   r   r§   r�   r    r›   r¡   r   r   rê   r   r®   r‹   rª   r­   r  r  r
   r  r2  r=  r	   r  rÎ   r  rP   rN   r"   r"       s�  … ñð Óðf
˜4 
Ñ+ó f
ðP
˜4 
Ñ+ó 
ð: ˆs‰)ƒOð ÐØÐ/Ñ/€NØ€LØ�<Ñ€FØ€Kð "&Ø,0Ø"Ø $Ø15Ø59Ø15Ø,0ñ_3à˜#‘ð_3ð ˜LÑ)ð_3ð �s‰mð	_3ð
 ˜‘ð_3ð ˜t H™~Ñ.ð_3ð !  jÑ!1Ñ2ð_3ð ˜t H™~Ñ.ð_3ð ˜t C™yÑ)ð_3ð 
ó_3óB*ñ3  4ð 3 °4ó 3 ñjC˜  c¡Ñ+ð C¸$ð CÈ$ó CðJ˜x¨¨S©	Ñ2ð °tó ó< 1óH<"ó|ó&ð4 8¨D°©IÑ#6ð ¸4ó ð. ð6�cò 6ó ð6ð ð
C˜3ò 
Có ð
Cð ð.˜ò .ó ð.ð ð6˜d 3™iò 6ó ð6ð ò!ó ð!ð ð( ò (ó ð(óDó
ó9óOð:	6Ø$ð	6Ø04°S¸#°X±ð	6à	ó	6ð
˜fó 
óBð0 Cð ¨Dó óB<ó/ó<ð *.ñCàðCð ˜D ™IÑ&ðCð 
ˆe�C˜ #™Ð&Ñ'Ñ	(ó	CóJ ñ  cð °3ó ð" HJñDØ˜e C¨°#©Ð$6Ñ7Ñ8ðDØADðDà	óDð"+Ø˜u S¨(°3©-Ð%7Ñ8Ñ9ð+à	ô+rP   r"   )-ry   ró   r/  r|   r‘   rF  Ú	importlibr   Útypingr   r   r   r   r   r	   r
   r   r@   r   r   r   r   Úcompletion.completer   r   Ú
exceptionsr   r   r   r   r¨   r   r   r   Ú	terminalsr   Úutilr   r   r   rÞ   r   r   r    r"   r  rP   rN   ú<module>r_     sa   ðÛ Û Û Û 	Û 
Û Ý #÷	÷ 	ó 	÷ =Ó <ß Bß LÓ Lß 3Ñ 3Ý ß 1Ñ 1áÝÝ#Ý÷{ò {rP   