
    3~h.                     r    d dl Z ddlmZ  G d de j                        Zd Z G d de j
                        Zy)	    N   )
Connectionc                   "     e Zd ZdZ fdZ xZS )TaskaS  
    Extends `invoke.tasks.Task` with knowledge of target hosts and similar.

    As `invoke.tasks.Task` relegates documentation responsibility to its `@task
    <invoke.tasks.task>` expression, so we relegate most details to our version
    of `@task <fabric.tasks.task>` - please see its docs for details.

    .. versionadded:: 2.1
    c                 R    |j                  dd       | _        t        |   |i | y )Nhosts)popr   super__init__)selfargskwargs	__class__s      U/var/www/peopleoo.sandbox-dev.co.uk/venv/lib/python3.12/site-packages/fabric/tasks.pyr   zTask.__init__   s)     ZZ.
$)&)    )__name__
__module____qualname____doc__r   __classcell__r   s   @r   r   r      s    * *r   r   c                  X    |j                  dt               t        j                  | i |S )a  
    Wraps/extends Invoke's `@task <invoke.tasks.task>` with extra kwargs.

    See `the Invoke-level API docs <invoke.tasks.task>` for most details; this
    Fabric-specific implementation adds the following additional keyword
    arguments:

    :param hosts:
        An iterable of host-connection specifiers appropriate for eventually
        instantiating a `.Connection`. The existence of this argument will
        trigger automatic parameterization of the task when invoked from the
        CLI, similar to the behavior of :option:`--hosts`.

        .. note::
            This parameterization is "lower-level" than that driven by
            :option:`--hosts`: if a task decorated with this parameter is
            executed in a session where :option:`--hosts` was given, the
            CLI-driven value will win out.

        List members may be one of:

        - A string appropriate for being the first positional argument to
          `.Connection` - see its docs for details, but these are typically
          shorthand-only convenience strings like ``hostname.example.com`` or
          ``user@host:port``.
        - A dictionary appropriate for use as keyword arguments when
          instantiating a `.Connection`. Useful for values that don't mesh well
          with simple strings (e.g. statically defined IPv6 addresses) or to
          bake in more complex info (eg ``connect_timeout``, ``connect_kwargs``
          params like auth info, etc).

        These two value types *may* be mixed together in the same list, though
        we recommend that you keep things homogenous when possible, to avoid
        confusion when debugging.

        .. note::
            No automatic deduplication of values is performed; if you pass in
            multiple references to the same effective target host, the wrapped
            task will execute on that host multiple times (including making
            separate connections).

    .. versionadded:: 2.1
    klass)
setdefaultr   invoketask)r   r   s     r   r   r      s)    \ gt$;;'''r   c                   <     e Zd ZdZ fdZ fdZd Z fdZ xZS )ConnectionCallzU
    Subclass of `invoke.tasks.Call` that generates `Connections <.Connection>`.
    c                 T    |j                  d      }t        |   |i | || _        y)aw  
        Creates a new `.ConnectionCall`.

        Performs minor extensions to `~invoke.tasks.Call` -- see its docstring
        for most details. Only specific-to-subclass params are documented here.

        :param dict init_kwargs:
            Keyword arguments used to create a new `.Connection` when the
            wrapped task is executed. Default: ``None``.
        init_kwargsN)r	   r
   r   r    )r   r   r   r    r   s       r   r   zConnectionCall.__init__O   s-     jj/$)&)&r   c                 B    t         |          }| j                  |d<   |S )Nr    )r
   clone_kwargsr    )r   r   r   s     r   r"   zConnectionCall.clone_kwargs^   s'     %' $ 0 0}r   c                 :    | j                   }||d<   t        di |S )Nconfig )r    r   )r   r$   r   s      r   make_contextzConnectionCall.make_contexth   s'    !! "x#F##r   c                     t         |          }| j                  r$|d d dj                  | j                  d         z   }|S )Nz, host='{}'>host)r
   __repr__r    format)r   retr   s     r   r*   zConnectionCall.__repr__p   sD    g cr(^2243C3CF3KLLC
r   )	r   r   r   r   r   r"   r&   r*   r   r   s   @r   r   r   J   s!    '$ r   r   )r   
connectionr   r   r   Callr   r%   r   r   <module>r/      s1     "*6;; *$/(d*V[[ *r   