Ë
    ú}àijÎ  ã                   ó\   — d dl m Z  ddlmZmZ ddlmZ ddlmZmZm	Z	m
Z
mZ  G d„ d«      Zy)	é    )Údatetimeé   )ÚerrorsÚutils)ÚDEFAULT_DATA_CHUNK_SIZE)ÚCancellableStreamÚContainerConfigÚEndpointConfigÚ
HostConfigÚNetworkingConfigc                   ó8  — e Zd Z ej                  d«      	 	 d%d„«       Z ej                  d«      d&d„«       Z ej                  d«      	 	 d'd„«       Z	 	 	 d(d„Z	 	 	 	 	 	 	 	 	 d)d„Z	d	„ Z
d*d
„Zd„ Zd„ Zd„ Z ej                  d«      d„ «       Z ej                  d«      efd„«       Z ej                  d«      edfd„«       Z ej                  d«      d„ «       Z ej                  d«      d+d„«       Z ej                  d«      	 	 	 d,d„«       Z ej                  d«      d„ «       Z ej                  d«      d„ «       Z ej                  d«      d„ «       Z ej2                  d«      d+d„«       Z ej                  d«      d-d„«       Z ej                  d«      d„ «       Z ej                  d«      d„ «       Z ej                  d«      d.d„«       Z ej                  d«      d„ «       Z ej                  d«      d/d„«       Z  ej                  d«      d+d„«       Z! ej                  d«      d+d „«       Z" ej                  d«      d!„ «       Z# ej2                  d"«       ej                  d«      	 	 	 	 d0d#„«       «       Z$ ej                  d«      d*d$„«       Z%y)1ÚContainerApiMixinÚ	containerFc                 ó  — |xr dxs d|xr dxs d|xr dxs d|xr dxs ddœ}dddœ}| j                  d|«      }	| j                  |	||d¬	«      }
| j                  |
|| j                  |«      |¬
«      }|rt	        ||
«      S |S )aI  
        Attach to a container.

        The ``.logs()`` function is a wrapper around this method, which you can
        use instead if you want to fetch/stream container output without first
        retrieving the entire backlog.

        Args:
            container (str): The container to attach to.
            stdout (bool): Include stdout.
            stderr (bool): Include stderr.
            stream (bool): Return container output progressively as an iterator
                of strings, rather than a single string.
            logs (bool): Include the container's previous output.
            demux (bool): Keep stdout and stderr separate.

        Returns:
            By default, the container's output as a single string (two if
            ``demux=True``: one for stdout and one for stderr).

            If ``stream=True``, an iterator of output strings. If
            ``demux=True``, two iterators are returned: one for stdout and one
            for stderr.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        é   r   )ÚlogsÚstdoutÚstderrÚstreamÚUpgradeÚtcp©Ú
Connectionr   ú/containers/{0}/attachT)ÚheadersÚparamsr   )Údemux)Ú_urlÚ_postÚ_read_from_socketÚ_check_is_ttyr   )Úselfr   r   r   r   r   r   r   r   ÚuÚresponseÚoutputs               ú[/home/factor_ks/STREAMA2026/tests/venv/lib/python3.12/site-packages/docker/api/container.pyÚattachzContainerApiMixin.attach   s´   € ð@ ’J˜Q’O !Ø’l Ò' aØ’l Ò' aØ’l Ò' añ	
ˆð $Øñ
ˆð
 �I‰IÐ.°	Ó:ˆØ—:‘:˜a¨¸È�:ÓMˆà×'Ñ'Ø�f˜d×0Ñ0°Ó;À5ð (ó Jˆñ Ü$ V¨XÓ6Ð6àˆMó    Nc           	      ó  — |€ddddœ}d|vr d| j                   v r| j                   d   |d<   |r| j                  ||«      S dddœ}| j                  d|«      }| j                  | j	                  |d| j                  |«      d	|¬
«      «      S )a&  
        Like ``attach``, but returns the underlying socket-like object for the
        HTTP request.

        Args:
            container (str): The container to attach to.
            params (dict): Dictionary of request parameters (e.g. ``stdout``,
                ``stderr``, ``stream``).
                For ``detachKeys``, ~/.docker/config.json is used by default.
            ws (bool): Use websockets instead of raw HTTP.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        Nr   )r   r   r   Ú
detachKeysr   r   r   r   T©r   r   r   )Ú_general_configsÚ_attach_websocketr   Ú_get_raw_response_socketÚpostÚ_attach_params)r"   r   r   Úwsr   r#   s         r&   Úattach_socketzContainerApiMixin.attach_socketE   s¹   € ð" ˆ>àØØñˆFð ˜vÑ%Ø  D×$9Ñ$9Ñ9à#'×#8Ñ#8¸Ñ#FˆF�<Ñ áØ×)Ñ)¨)°VÓ<Ð<ð $Øñ
ˆð
 �I‰IÐ.°	Ó:ˆØ×,Ñ,Ø�I‰IØ�4 × 3Ñ 3°FÓ ;ÀDØð ó ó
ð 	
r(   c	                 ó‚   — |||||||dœ}	| j                  d«      }
| j                  | j                  |
||	¬«      d¬«      S )a\  
        Commit a container to an image. Similar to the ``docker commit``
        command.

        Args:
            container (str): The image hash of the container
            repository (str): The repository to push the image to
            tag (str): The tag to push
            message (str): A commit message
            author (str): The name of the author
            pause (bool): Whether to pause the container before committing
            changes (str): Dockerfile instructions to apply while committing
            conf (dict): The configuration for the container. See the
                `Engine API documentation
                <https://docs.docker.com/reference/api/docker_remote_api/>`_
                for full details.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )r   ÚrepoÚtagÚcommentÚauthorÚpauseÚchangesz/commit©Údatar   T©Újson)r   Ú_resultÚ
_post_json)r"   r   Ú
repositoryr5   Úmessager7   r8   r9   Úconfr   r#   s              r&   ÚcommitzContainerApiMixin.commitr   sZ   € ð2 #ØØØØØØñ
ˆð �I‰I�iÓ ˆØ�|‰|Ø�O‰O˜A D°ˆOÓ8¸tð ó 
ð 	
r(   c
                 ó4  — |rdn||rdnd|rdnd|rdnd||dœ}
|	rt        j                  |	«      |
d<   | j                  d«      }| j                  | j	                  ||
¬«      d«      }|r|D �cg c]	  }d|d   i‘Œ c}S |r|D ]  }|d   d	d
 |d<   Œ |S c c}w )a6  
        List containers. Similar to the ``docker ps`` command.

        Args:
            quiet (bool): Only display numeric Ids
            all (bool): Show all containers. Only running containers are shown
                by default
            trunc (bool): Truncate output
            latest (bool): Show only the latest created container, include
                non-running ones.
            since (str): Show only containers created since Id or Name, include
                non-running ones
            before (str): Show only container created before Id or Name,
                include non-running ones
            limit (int): Show `limit` last created containers, include
                non-running ones
            size (bool): Display sizes
            filters (dict): Filters to be processed on the image list.
                Available filters:

                - `exited` (int): Only containers with specified exit code
                - `status` (str): One of ``restarting``, ``running``,
                    ``paused``, ``exited``
                - `label` (str|list): format either ``"key"``, ``"key=value"``
                    or a list of such.
                - `id` (str): The id of the container.
                - `name` (str): The name of the container.
                - `ancestor` (str): Filter by container ancestor. Format of
                    ``<image-name>[:tag]``, ``<image-id>``, or
                    ``<image@digest>``.
                - `before` (str): Only containers created before a particular
                    container. Give the container name or id.
                - `since` (str): Only containers created after a particular
                    container. Give container name or id.

                A comprehensive list can be found in the documentation for
                `docker ps
                <https://docs.docker.com/engine/reference/commandline/ps>`_.

        Returns:
            A list of dicts, one per container

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        r   r   )ÚlimitÚallÚsizeÚ	trunc_cmdÚsinceÚbeforeÚfiltersz/containers/json©r   TÚIdNé   )r   Úconvert_filtersr   r>   Ú_get)r"   ÚquietrF   ÚtruncÚlatestrI   rJ   rE   rG   rK   r   r#   ÚresÚxs                 r&   Ú
containerszContainerApiMixin.containers˜   s¿   € ñd !‘Q eÙ‘1 Ù‘A 1Ù#™¨ØØñ
ˆñ Ü %× 5Ñ 5°gÓ >ˆF�9ÑØ�I‰IÐ(Ó)ˆØ�l‰l˜4Ÿ9™9 Q¨v˜9Ó6¸Ó=ˆáØ-0Ö1¨�T˜1˜T™7’OÒ1Ð1ÙØò '�Ø˜D™' # 2˜,��$’ð'àˆ
ùò	 2s   Á.Bc                 ó:  — t        |
t        «      r|
g}
t        |	t        «      rt        j                  j	                  |	«      }	|r| j
                  j                  |	«      xs d}	| j                  |||||||||	|
||||||||||||«      }| j                  |||«      S )ar  
        Creates a container. Parameters are similar to those for the ``docker
        run`` command except it doesn't support the attach options (``-a``).

        The arguments that are passed directly to this function are
        host-independent configuration options. Host-specific configuration
        is passed with the `host_config` argument. You'll normally want to
        use this method in combination with the :py:meth:`create_host_config`
        method to generate ``host_config``.

        **Port bindings**

        Port binding is done in two parts: first, provide a list of ports to
        open inside the container with the ``ports`` parameter, then declare
        bindings with the ``host_config`` parameter. For example:

        .. code-block:: python

            container_id = client.api.create_container(
                'busybox', 'ls', ports=[1111, 2222],
                host_config=client.api.create_host_config(port_bindings={
                    1111: 4567,
                    2222: None
                })
            )


        You can limit the host address on which the port will be exposed like
        such:

        .. code-block:: python

            client.api.create_host_config(
                port_bindings={1111: ('127.0.0.1', 4567)}
            )

        Or without host port assignment:

        .. code-block:: python

            client.api.create_host_config(port_bindings={1111: ('127.0.0.1',)})

        If you wish to use UDP instead of TCP (default), you need to declare
        ports as such in both the config and host config:

        .. code-block:: python

            container_id = client.api.create_container(
                'busybox', 'ls', ports=[(1111, 'udp'), 2222],
                host_config=client.api.create_host_config(port_bindings={
                    '1111/udp': 4567, 2222: None
                })
            )

        To bind multiple host ports to a single container port, use the
        following syntax:

        .. code-block:: python

            client.api.create_host_config(port_bindings={
                1111: [1234, 4567]
            })

        You can also bind multiple IPs to a single container port:

        .. code-block:: python

            client.api.create_host_config(port_bindings={
                1111: [
                    ('192.168.0.100', 1234),
                    ('192.168.0.101', 1234)
                ]
            })

        **Using volumes**

        Volume declaration is done in two parts. Provide a list of
        paths to use as mountpoints inside the container with the
        ``volumes`` parameter, and declare mappings from paths on the host
        in the ``host_config`` section.

        .. code-block:: python

            container_id = client.api.create_container(
                'busybox', 'ls', volumes=['/mnt/vol1', '/mnt/vol2'],
                host_config=client.api.create_host_config(binds={
                    '/home/user1/': {
                        'bind': '/mnt/vol2',
                        'mode': 'rw',
                    },
                    '/var/www': {
                        'bind': '/mnt/vol1',
                        'mode': 'ro',
                    },
                    '/autofs/user1': {
                        'bind': '/mnt/vol3',
                        'mode': 'rw',
                        'propagation': 'shared'
                    }
                })
            )

        You can alternatively specify binds as a list. This code is equivalent
        to the example above:

        .. code-block:: python

            container_id = client.api.create_container(
                'busybox', 'ls', volumes=['/mnt/vol1', '/mnt/vol2', '/mnt/vol3'],
                host_config=client.api.create_host_config(binds=[
                    '/home/user1/:/mnt/vol2',
                    '/var/www:/mnt/vol1:ro',
                    '/autofs/user1:/mnt/vol3:rw,shared',
                ])
            )

        **Networking**

        You can specify networks to connect the container to by using the
        ``networking_config`` parameter. At the time of creation, you can
        only connect a container to a single networking, but you
        can create more connections by using
        :py:meth:`~connect_container_to_network`.

        For example:

        .. code-block:: python

            networking_config = client.api.create_networking_config({
                'network1': client.api.create_endpoint_config(
                    ipv4_address='172.28.0.124',
                    aliases=['foo', 'bar'],
                    links=['container2']
                )
            })

            ctnr = client.api.create_container(
                img, command, networking_config=networking_config
            )

        Args:
            image (str): The image to run
            command (str or list): The command to be run in the container
            hostname (str): Optional hostname for the container
            user (str or int): Username or UID
            detach (bool): Detached mode: run container in the background and
                return container ID
            stdin_open (bool): Keep STDIN open even if not attached
            tty (bool): Allocate a pseudo-TTY
            ports (list of ints): A list of port numbers
            environment (dict or list): A dictionary or a list of strings in
                the following format ``["PASSWORD=xxx"]`` or
                ``{"PASSWORD": "xxx"}``.
            volumes (str or list): List of paths inside the container to use
                as volumes.
            network_disabled (bool): Disable networking
            name (str): A name for the container
            entrypoint (str or list): An entrypoint
            working_dir (str): Path to the working directory
            domainname (str): The domain name to use for the container
            host_config (dict): A dictionary created with
                :py:meth:`create_host_config`.
            mac_address (str): The Mac Address to assign the container
            labels (dict or list): A dictionary of name-value labels (e.g.
                ``{"label1": "value1", "label2": "value2"}``) or a list of
                names of labels to set with empty values (e.g.
                ``["label1", "label2"]``)
            stop_signal (str): The stop signal to use to stop the container
                (e.g. ``SIGINT``).
            stop_timeout (int): Timeout to stop the container, in seconds.
                Default: 10
            networking_config (dict): A networking configuration generated
                by :py:meth:`create_networking_config`.
            runtime (str): Runtime to use with this container.
            healthcheck (dict): Specify a test to perform to check that the
                container is healthy.
            use_config_proxy (bool): If ``True``, and if the docker client
                configuration file (``~/.docker/config.json`` by default)
                contains a proxy configuration, the corresponding environment
                variables will be set in the container being created.
            platform (str): Platform in the format ``os[/arch[/variant]]``.

        Returns:
            A dictionary with an image 'Id' key and a 'Warnings' key.

        Raises:
            :py:class:`docker.errors.ImageNotFound`
                If the specified image does not exist.
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        N)	Ú
isinstanceÚstrÚdictr   Úformat_environmentÚ_proxy_configsÚinject_proxy_environmentÚcreate_container_configÚcreate_container_from_config)r"   ÚimageÚcommandÚhostnameÚuserÚdetachÚ
stdin_openÚttyÚportsÚenvironmentÚvolumesÚnetwork_disabledÚnameÚ
entrypointÚworking_dirÚ
domainnameÚhost_configÚmac_addressÚlabelsÚstop_signalÚnetworking_configÚhealthcheckÚstop_timeoutÚruntimeÚuse_config_proxyÚplatformÚconfigs                              r&   Úcreate_containerz"ContainerApiMixin.create_containerÝ   s·   € ôP �gœsÔ#Ø�kˆGä�k¤4Ô(ÜŸ+™+×8Ñ8¸ÓEˆKáØ×-Ñ-×FÑFØóò àð ð ×-Ñ-Ø�7˜H d¨F°JÀØ�; Ø˜j¨+°zØ˜ fØÐ*¨KØ˜'ó
ˆð ×0Ñ0°¸¸xÓHÐHr(   c                 ó4   — t        | j                  g|¢­i |¤ŽS ©N)r	   Ú_version©r"   ÚargsÚkwargss      r&   r^   z)ContainerApiMixin.create_container_configº  s   € Ü˜tŸ}™}Ð>¨tÒ>°vÑ>Ð>r(   c                 óð   — | j                  d«      }d|i}|r:t        j                  | j                  d«      rt	        j
                  d«      ‚||d<   | j                  |||¬«      }| j                  |d«      S )Nz/containers/createrk   ú1.41z0platform is not supported for API version < 1.41rx   r:   T)r   r   Ú
version_ltr}   r   ÚInvalidVersionr?   r>   )r"   ry   rk   rx   r#   r   rT   s          r&   r_   z.ContainerApiMixin.create_container_from_config½  s}   € Ø�I‰IÐ*Ó+ˆà�Dð
ˆñ Ü×Ñ §¡¨vÔ6Ü×+Ñ+ØFóð ð "*ˆF�:ÑØ�o‰o˜a f°VˆoÓ<ˆØ�|‰|˜C Ó&Ð&r(   c                 ó\   — |si }d|v rt        d«      ‚| j                  |d<   t        |i |¤ŽS )a|  
        Create a dictionary for the ``host_config`` argument to
        :py:meth:`create_container`.

        Args:
            auto_remove (bool): enable auto-removal of the container on daemon
                side when the container's process exits.
            binds (dict): Volumes to bind. See :py:meth:`create_container`
                    for more information.
            blkio_weight_device: Block IO weight (relative device weight) in
                the form of: ``[{"Path": "device_path", "Weight": weight}]``.
            blkio_weight: Block IO weight (relative weight), accepts a weight
                value between 10 and 1000.
            cap_add (list of str): Add kernel capabilities. For example,
                ``["SYS_ADMIN", "MKNOD"]``.
            cap_drop (list of str): Drop kernel capabilities.
            cpu_period (int): The length of a CPU period in microseconds.
            cpu_quota (int): Microseconds of CPU time that the container can
                get in a CPU period.
            cpu_shares (int): CPU shares (relative weight).
            cpuset_cpus (str): CPUs in which to allow execution (``0-3``,
                ``0,1``).
            cpuset_mems (str): Memory nodes (MEMs) in which to allow execution
                (``0-3``, ``0,1``). Only effective on NUMA systems.
            device_cgroup_rules (:py:class:`list`): A list of cgroup rules to
                apply to the container.
            device_read_bps: Limit read rate (bytes per second) from a device
                in the form of: `[{"Path": "device_path", "Rate": rate}]`
            device_read_iops: Limit read rate (IO per second) from a device.
            device_write_bps: Limit write rate (bytes per second) from a
                device.
            device_write_iops: Limit write rate (IO per second) from a device.
            devices (:py:class:`list`): Expose host devices to the container,
                as a list of strings in the form
                ``<path_on_host>:<path_in_container>:<cgroup_permissions>``.

                For example, ``/dev/sda:/dev/xvda:rwm`` allows the container
                to have read-write access to the host's ``/dev/sda`` via a
                node named ``/dev/xvda`` inside the container.
            device_requests (:py:class:`list`): Expose host resources such as
                GPUs to the container, as a list of
                :py:class:`docker.types.DeviceRequest` instances.
            dns (:py:class:`list`): Set custom DNS servers.
            dns_opt (:py:class:`list`): Additional options to be added to the
                container's ``resolv.conf`` file
            dns_search (:py:class:`list`): DNS search domains.
            extra_hosts (dict): Additional hostnames to resolve inside the
                container, as a mapping of hostname to IP address.
            group_add (:py:class:`list`): List of additional group names and/or
                IDs that the container process will run as.
            init (bool): Run an init inside the container that forwards
                signals and reaps processes
            ipc_mode (str): Set the IPC mode for the container.
            isolation (str): Isolation technology to use. Default: ``None``.
            links (dict): Mapping of links using the
                ``{'container': 'alias'}`` format. The alias is optional.
                Containers declared in this dict will be linked to the new
                container using the provided alias. Default: ``None``.
            log_config (LogConfig): Logging configuration
            lxc_conf (dict): LXC config.
            mem_limit (float or str): Memory limit. Accepts float values
                (which represent the memory limit of the created container in
                bytes) or a string with a units identification char
                (``100000b``, ``1000k``, ``128m``, ``1g``). If a string is
                specified without a units character, bytes are assumed as an
            mem_reservation (float or str): Memory soft limit.
            mem_swappiness (int): Tune a container's memory swappiness
                behavior. Accepts number between 0 and 100.
            memswap_limit (str or int): Maximum amount of memory + swap a
                container is allowed to consume.
            mounts (:py:class:`list`): Specification for mounts to be added to
                the container. More powerful alternative to ``binds``. Each
                item in the list is expected to be a
                :py:class:`docker.types.Mount` object.
            network_mode (str): One of:

                - ``bridge`` Create a new network stack for the container on
                  the bridge network.
                - ``none`` No networking for this container.
                - ``container:<name|id>`` Reuse another container's network
                  stack.
                - ``host`` Use the host network stack.
                  This mode is incompatible with ``port_bindings``.

            oom_kill_disable (bool): Whether to disable OOM killer.
            oom_score_adj (int): An integer value containing the score given
                to the container in order to tune OOM killer preferences.
            pid_mode (str): If set to ``host``, use the host PID namespace
                inside the container.
            pids_limit (int): Tune a container's pids limit. Set ``-1`` for
                unlimited.
            port_bindings (dict): See :py:meth:`create_container`
                for more information.
                Imcompatible with ``host`` in ``network_mode``.
            privileged (bool): Give extended privileges to this container.
            publish_all_ports (bool): Publish all ports to the host.
            read_only (bool): Mount the container's root filesystem as read
                only.
            restart_policy (dict): Restart the container when it exits.
                Configured as a dictionary with keys:

                - ``Name`` One of ``on-failure``, or ``always``.
                - ``MaximumRetryCount`` Number of times to restart the
                  container on failure.
            security_opt (:py:class:`list`): A list of string values to
                customize labels for MLS systems, such as SELinux.
            shm_size (str or int): Size of /dev/shm (e.g. ``1G``).
            storage_opt (dict): Storage driver options per container as a
                key-value mapping.
            sysctls (dict): Kernel parameters to set in the container.
            tmpfs (dict): Temporary filesystems to mount, as a dictionary
                mapping a path inside the container to options for that path.

                For example:

                .. code-block:: python

                    {
                        '/mnt/vol2': '',
                        '/mnt/vol1': 'size=3G,uid=1000'
                    }

            ulimits (:py:class:`list`): Ulimits to set inside the container,
                as a list of :py:class:`docker.types.Ulimit` instances.
            userns_mode (str): Sets the user namespace mode for the container
                when user namespace remapping option is enabled. Supported
                values are: ``host``
            uts_mode (str): Sets the UTS namespace mode for the container.
                Supported values are: ``host``
            volumes_from (:py:class:`list`): List of container names or IDs to
                get volumes from.
            runtime (str): Runtime to use with this container.


        Returns:
            (dict) A dictionary which can be passed to the ``host_config``
            argument to :py:meth:`create_container`.

        Example:

            >>> client.api.create_host_config(
            ...     privileged=True,
            ...     cap_drop=['MKNOD'],
            ...     volumes_from=['nostalgic_newton'],
            ... )
            {'CapDrop': ['MKNOD'], 'LxcConf': None, 'Privileged': True,
            'VolumesFrom': ['nostalgic_newton'], 'PublishAllPorts': False}

ÚversionzAcreate_host_config() got an unexpected keyword argument 'version')Ú	TypeErrorr}   r   r~   s      r&   Úcreate_host_configz$ContainerApiMixin.create_host_configË  sG   € ñl ØˆFØ˜ÑÜð-óð ð !ŸM™MˆˆyÑÜ˜4Ð* 6Ñ*Ð*r(   c                 ó   — t        |i |¤ŽS )aù  
        Create a networking config dictionary to be used as the
        ``networking_config`` parameter in :py:meth:`create_container`.

        Args:
            endpoints_config (dict): A dictionary mapping network names to
                endpoint configurations generated by
                :py:meth:`create_endpoint_config`.

        Returns:
            (dict) A networking config.

        Example:

            >>> client.api.create_network('network1')
            >>> networking_config = client.api.create_networking_config({
                'network1': client.api.create_endpoint_config()
            })
            >>> container = client.api.create_container(
                img, command, networking_config=networking_config
            )

        )r   r~   s      r&   Úcreate_networking_configz*ContainerApiMixin.create_networking_configk  s   € ô0   Ð0¨Ñ0Ð0r(   c                 ó4   — t        | j                  g|¢­i |¤ŽS )a©  
        Create an endpoint config dictionary to be used with
        :py:meth:`create_networking_config`.

        Args:
            aliases (:py:class:`list`): A list of aliases for this endpoint.
                Names in that list can be used within the network to reach the
                container. Defaults to ``None``.
            links (dict): Mapping of links for this endpoint using the
                ``{'container': 'alias'}`` format. The alias is optional.
                Containers declared in this dict will be linked to this
                container using the provided alias. Defaults to ``None``.
            ipv4_address (str): The IP address of this container on the
                network, using the IPv4 protocol. Defaults to ``None``.
            ipv6_address (str): The IP address of this container on the
                network, using the IPv6 protocol. Defaults to ``None``.
            link_local_ips (:py:class:`list`): A list of link-local (IPv4/IPv6)
                addresses.
            driver_opt (dict): A dictionary of options to provide to the
                network driver. Defaults to ``None``.

        Returns:
            (dict) An endpoint config.

        Example:

            >>> endpoint_config = client.api.create_endpoint_config(
                aliases=['web', 'app'],
                links={'app_db': 'db', 'another': None},
                ipv4_address='132.65.0.123'
            )

        )r
   r}   r~   s      r&   Úcreate_endpoint_configz(ContainerApiMixin.create_endpoint_config…  s   € ôD ˜dŸm™mÐ=¨dÒ=°fÑ=Ð=r(   c                 ód   — | j                  | j                  | j                  d|«      «      d«      S )ai  
        Inspect changes on a container's filesystem.

        Args:
            container (str): The container to diff

        Returns:
            (list) A list of dictionaries containing the attributes `Path`
                and `Kind`.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        z/containers/{0}/changesT©r>   rP   r   ©r"   r   s     r&   ÚdiffzContainerApiMixin.diff©  s/   € ð  �|‰|Ø�I‰I�d—i‘iÐ 9¸9ÓEÓFÈó
ð 	
r(   c                 ón   — | j                  | j                  d|«      d¬«      }| j                  ||d«      S )a  
        Export the contents of a filesystem as a tar archive.

        Args:
            container (str): The container to export
            chunk_size (int): The number of bytes returned by each iteration
                of the generator. If ``None``, data will be streamed as it is
                received. Default: 2 MB

        Returns:
            (generator): The archived filesystem data stream

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        z/containers/{0}/exportT)r   F)rP   r   Ú_stream_raw_result)r"   r   Ú
chunk_sizerT   s       r&   ÚexportzContainerApiMixin.export½  s?   € ð$ �i‰iØ�I‰IÐ.°	Ó:À4ð ó 
ˆð ×&Ñ& s¨J¸Ó>Ð>r(   c                 ó  — d|i}|rddinddi}| j                  d|«      }| j                  ||d|¬«      }| j                  |«       |j                  j	                  d«      }	| j                  ||d	«      |	rt        j                  |	«      fS d
fS )a  
        Retrieve a file or folder from a container in the form of a tar
        archive.

        Args:
            container (str): The container where the file is located
            path (str): Path to the file or folder to retrieve
            chunk_size (int): The number of bytes returned by each iteration
                of the generator. If ``None``, data will be streamed as it is
                received. Default: 2 MB
            encode_stream (bool): Determines if data should be encoded
                (gzip-compressed) during transmission. Default: False

        Returns:
            (tuple): First element is a raw tar data stream. Second element is
            a dict containing ``stat`` information on the specified ``path``.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.

        Example:

            >>> c = docker.APIClient()
            >>> f = open('./sh_bin.tar', 'wb')
            >>> bits, stat = c.api.get_archive(container, '/bin/sh')
            >>> print(stat)
            {'name': 'sh', 'size': 1075464, 'mode': 493,
             'mtime': '2018-10-01T15:37:48-07:00', 'linkTarget': ''}
            >>> for chunk in bits:
            ...    f.write(chunk)
            >>> f.close()
        ÚpathzAccept-Encodingzgzip, deflateÚidentityú/containers/{0}/archiveTr+   zx-docker-container-path-statFN)r   rP   Ú_raise_for_statusr   Úgetr’   r   Údecode_json_header)
r"   r   r–   r“   Úencode_streamr   r   ÚurlrT   Úencoded_stats
             r&   Úget_archivezContainerApiMixin.get_archiveÔ  s¶   € ðJ �Dð
ˆñ
 ð ˜ñ
ð ˜zð!
ð 	ð
 �i‰iÐ1°9Ó=ˆØ�i‰i˜ F°4ÀˆiÓIˆØ×Ñ˜sÔ#Ø—{‘{—‘Ð'EÓFˆà×#Ñ# C¨°UÓ;Ù6BŒE×$Ñ$ \Ó2ð
ð 	
àHLð
ð 	
r(   c                 ód   — | j                  | j                  | j                  d|«      «      d«      S )a|  
        Identical to the `docker inspect` command, but only for containers.

        Args:
            container (str): The container to inspect

        Returns:
            (dict): Similar to the output of `docker inspect`, but as a
            single dict

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        ú/containers/{0}/jsonTrŽ   r�   s     r&   Úinspect_containerz#ContainerApiMixin.inspect_container	  s/   € ð  �|‰|Ø�I‰I�d—i‘iÐ 6¸	ÓBÓCÀTó
ð 	
r(   c                 ó¸   — | j                  d|«      }i }|� t        |t        «      st        |«      }||d<   | j	                  ||¬«      }| j                  |«       y)aB  
        Kill a container or send a signal to a container.

        Args:
            container (str): The container to kill
            signal (str or int): The signal to send. Defaults to ``SIGKILL``

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        z/containers/{0}/killNÚsignalrL   )r   rX   rY   Úintr   r™   )r"   r   r¤   r�   r   rT   s         r&   ÚkillzContainerApiMixin.kill  s]   € ð �i‰iÐ.°	Ó:ˆØˆØÐÜ˜f¤cÔ*Ü˜V›�Ø%ˆF�8ÑØ�j‰j˜ VˆjÓ,ˆà×Ñ˜sÕ#r(   c
                 óž  — |€|}|xr dxs d|xr dxs d|xr dxs d|xr dxs ddœ}
|dk7  rt        |t        «      r|dk  rd}||
d<   |�€t        |t        «      rt        j                  |«      |
d<   nWt        |t        «      r|dkD  r||
d<   n<t        |t
        «      r|dkD  r||
d<   n!t        j                  dt        |«      › �«      ‚|	�µt        j                  | j                  d	«      rt        j                  d
«      ‚t        |	t        «      rt        j                  |	«      |
d<   nWt        |	t        «      r|	dkD  r|	|
d<   n<t        |	t
        «      r|	dkD  r|	|
d<   n!t        j                  dt        |	«      › �«      ‚| j                  d|«      }| j                  ||
|¬«      }| j                  |||«      }|rt        ||«      S |S )a<  
        Get logs from a container. Similar to the ``docker logs`` command.

        The ``stream`` parameter makes the ``logs`` function return a blocking
        generator you can iterate over to retrieve log output as it happens.

        Args:
            container (str): The container to get logs from
            stdout (bool): Get ``STDOUT``. Default ``True``
            stderr (bool): Get ``STDERR``. Default ``True``
            stream (bool): Stream the response. Default ``False``
            timestamps (bool): Show timestamps. Default ``False``
            tail (str or int): Output specified number of lines at the end of
                logs. Either an integer of number of lines or the string
                ``all``. Default ``all``
            since (datetime, int, or float): Show logs since a given datetime,
                integer epoch (in seconds) or float (in fractional seconds)
            follow (bool): Follow log output. Default ``False``
            until (datetime, int, or float): Show logs that occurred before
                the given datetime, integer epoch (in seconds), or
                float (in fractional seconds)

        Returns:
            (generator of bytes or bytes)

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        r   r   )r   r   Ú
timestampsÚfollowrF   ÚtailrI   g        z:since value should be datetime or positive int/float, not z1.35z-until is not supported for API version < 1.35Úuntilz:until value should be datetime or positive int/float, not z/containers/{0}/logs)r   r   )rX   r¥   r   r   Údatetime_to_timestampÚfloatr   ÚInvalidArgumentÚtyperƒ   r}   r„   r   rP   Ú_get_resultr   )r"   r   r   r   r   r¨   rª   rI   r©   r«   r   r�   rT   r%   s                 r&   r   zContainerApiMixin.logs4  sã  € ðB ˆ>ØˆFØ"šL qÒ-¨AØ"šL qÒ-¨AØ *Ò 0¨qÒ 5°AØ"šL qÒ-¨Añˆð
 �5Š=¤*¨T´3Ô"7¸4À!º8ØˆDØˆˆv‰àÐÜ˜%¤Ô*Ü"'×"=Ñ"=¸eÓ"D��w’Ü˜U¤CÔ(¨U°QªYØ"'��w’Ü˜U¤EÔ*¨u°sª{Ø"'��w’ä×,Ñ,ðÜ  ›K˜=ð*óð ð
 ÐÜ×Ñ §¡¨vÔ6Ü×+Ñ+ØCóð ô ˜%¤Ô*Ü"'×"=Ñ"=¸eÓ"D��w’Ü˜U¤CÔ(¨U°QªYØ"'��w’Ü˜U¤EÔ*¨u°sª{Ø"'��w’ä×,Ñ,ðÜ ›;˜-ð)óð ð
 �i‰iÐ.°	Ó:ˆØ�i‰i˜ F°6ˆiÓ:ˆØ×!Ñ! )¨V°SÓ9ˆáÜ$ V¨SÓ1Ð1àˆMr(   c                 ól   — | j                  d|«      }| j                  |«      }| j                  |«       y)zí
        Pauses all processes within a container.

        Args:
            container (str): The container to pause

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        z/containers/{0}/pauseN©r   r   r™   ©r"   r   r�   rT   s       r&   r8   zContainerApiMixin.pause‡  s0   € ð �i‰iÐ/°Ó;ˆØ�j‰j˜‹oˆØ×Ñ˜sÕ#r(   c                 óZ  — | j                  | j                  d|«      «      }| j                  |«       |j                  «       }t	        |«      }d}|j                  di «      j                  d«      }|€yd|v r|j                  |«      S dD ]  }|j                  |› d|› �«      }|sŒ |S  |S )a#  
        Lookup the public-facing port that is NAT-ed to ``private_port``.
        Identical to the ``docker port`` command.

        Args:
            container (str): The container to look up
            private_port (int): The private port to inspect

        Returns:
            (list of dict): The mapping for the host ports

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.

        Example:
            .. code-block:: bash

                $ docker run -d -p 80:80 ubuntu:14.04 /bin/sleep 30
                7174d6347063a83f412fad6124c99cffd25ffe1a0807eb4b7f9cec76ac8cb43b

            .. code-block:: python

                >>> client.api.port('7174d6347063', 80)
                [{'HostIp': '0.0.0.0', 'HostPort': '80'}]
        r¡   NÚNetworkSettingsÚPortsú/)r   ÚudpÚsctp)rP   r   r™   r=   rY   rš   )r"   r   Úprivate_portrT   Újson_Úh_portsÚport_settingsÚprotocols           r&   ÚportzContainerApiMixin.port—  sÂ   € ð8 �i‰i˜Ÿ	™	Ð"8¸)ÓDÓEˆØ×Ñ˜sÔ#Ø—‘“
ˆÜ˜<Ó(ˆØˆð Ÿ	™	Ð"3°RÓ8×<Ñ<¸WÓEˆØÐ Øà�,ÑØ ×$Ñ$ \Ó2Ð2à.ò 	ˆHØ#×'Ñ'¨<¨.¸¸(¸Ð(DÓEˆGÚØàˆð	ð
 ˆr(   c                 ó–   — d|i}| j                  d|«      }| j                  |||¬«      }| j                  |«       |j                  dk(  S )a(  
        Insert a file or folder in an existing container using a tar archive as
        source.

        Args:
            container (str): The container where the file(s) will be extracted
            path (str): Path inside the container where the file(s) will be
                extracted. Must exist.
            data (bytes or stream): tar data to be extracted

        Returns:
            (bool): True if the call succeeds.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        r–   r˜   )r   r;   éÈ   )r   Ú_putr™   Ústatus_code)r"   r   r–   r;   r   r�   rT   s          r&   Úput_archivezContainerApiMixin.put_archiveÉ  sO   € ð& ˜$�ˆØ�i‰iÐ1°9Ó=ˆØ�i‰i˜ F°ˆiÓ6ˆØ×Ñ˜sÔ#Ø�‰ #Ñ%Ð%r(   z1.25c                 ó¢   — i }|rt        j                  |«      |d<   | j                  d«      }| j                  | j	                  ||¬«      d«      S )a…  
        Delete stopped containers

        Args:
            filters (dict): Filters to process on the prune list.

        Returns:
            (dict): A dict containing a list of deleted container IDs and
                the amount of disk space reclaimed in bytes.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        rK   z/containers/prunerL   T)r   rO   r   r>   r   )r"   rK   r   r�   s       r&   Úprune_containersz"ContainerApiMixin.prune_containersâ  sN   € ð  ˆÙÜ %× 5Ñ 5°gÓ >ˆF�9ÑØ�i‰iÐ+Ó,ˆØ�|‰|˜DŸJ™J s°6˜JÓ:¸DÓAÐAr(   c                 óx   — |||dœ}| j                  | j                  d|«      |¬«      }| j                  |«       y)a  
        Remove a container. Similar to the ``docker rm`` command.

        Args:
            container (str): The container to remove
            v (bool): Remove the volumes associated with the container
            link (bool): Remove the specified link and not the underlying
                container
            force (bool): Force the removal of a running container (uses
                ``SIGKILL``)

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )ÚvÚlinkÚforcez/containers/{0}rL   N)Ú_deleter   r™   )r"   r   rÈ   rÉ   rÊ   r   rT   s          r&   Úremove_containerz"ContainerApiMixin.remove_containerø  sD   € ð"  $°Ñ7ˆØ�l‰lØ�I‰IÐ'¨Ó3¸Fð ó 
ˆð 	×Ñ˜sÕ#r(   c                 óx   — | j                  d|«      }d|i}| j                  ||¬«      }| j                  |«       y)a<  
        Rename a container. Similar to the ``docker rename`` command.

        Args:
            container (str): ID of the container to rename
            name (str): New name for the container

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        z/containers/{0}/renamerk   rL   Nr²   )r"   r   rk   r�   r   rT   s         r&   ÚrenamezContainerApiMixin.rename  s>   € ð �i‰iÐ0°)Ó<ˆØ˜$�ˆØ�j‰j˜ VˆjÓ,ˆØ×Ñ˜sÕ#r(   c                 óz   — ||dœ}| j                  d|«      }| j                  ||¬«      }| j                  |«       y)aC  
        Resize the tty session.

        Args:
            container (str or dict): The container to resize
            height (int): Height of tty session
            width (int): Width of tty session

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )ÚhÚwz/containers/{0}/resizerL   Nr²   )r"   r   ÚheightÚwidthr   r�   rT   s          r&   ÚresizezContainerApiMixin.resize!  s?   € ð  EÑ*ˆØ�i‰iÐ0°)Ó<ˆØ�j‰j˜ VˆjÓ,ˆØ×Ñ˜sÕ#r(   c                 ó    — d|i}| j                  d|«      }| j                  }|�||z  }| j                  |||¬«      }| j                  |«       y)aþ  
        Restart a container. Similar to the ``docker restart`` command.

        Args:
            container (str or dict): The container to restart. If a dict, the
                ``Id`` key is used.
            timeout (int): Number of seconds to try to stop for before killing
                the container. Once killed it will then be restarted. Default
                is 10 seconds.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        Útz/containers/{0}/restartN©r   Útimeout©r   rØ   r   r™   ©r"   r   rØ   r   r�   Úconn_timeoutrT   s          r&   ÚrestartzContainerApiMixin.restart4  sY   € ð  �w�ˆØ�i‰iÐ1°9Ó=ˆØ—|‘|ˆØÐ#Ø˜GÑ#ˆLØ�j‰j˜ V°\ˆjÓBˆØ×Ñ˜sÕ#r(   c                 óž   — |s|rt        j                  d«      ‚| j                  d|«      }| j                  |«      }| j	                  |«       y)a�  
        Start a container. Similar to the ``docker start`` command, but
        doesn't support attach options.

        **Deprecation warning:** Passing configuration options in ``start`` is
        no longer supported. Users are expected to provide host config options
        in the ``host_config`` parameter of
        :py:meth:`~ContainerApiMixin.create_container`.


        Args:
            container (str): The container to start

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
            :py:class:`docker.errors.DeprecatedMethod`
                If any argument besides ``container`` are provided.

        Example:

            >>> container = client.api.create_container(
            ...     image='busybox:latest',
            ...     command='/bin/sleep 30')
            >>> client.api.start(container=container.get('Id'))
        z|Providing configuration in the start() method is no longer supported. Use the host_config param in create_container instead.z/containers/{0}/startN)r   ÚDeprecatedMethodr   r   r™   )r"   r   r   r€   r�   rT   s         r&   ÚstartzContainerApiMixin.startL  sO   € ñ8 ‘6Ü×)Ñ)ðóð ð
 �i‰iÐ/°Ó;ˆØ�j‰j˜‹oˆØ×Ñ˜sÕ#r(   c                 ó˜  — | j                  d|«      }d|i}|�:t        j                  | j                  d«      rt	        j
                  d«      ‚||d<   |r<|rt	        j                  d«      ‚| j                  | j                  |d|¬«      |¬	«      S |rt	        j                  d
«      ‚| j                  | j                  ||¬«      d¬«      S )a&  
        Stream statistics for a specific container. Similar to the
        ``docker stats`` command.

        Args:
            container (str): The container to stream statistics from
            decode (bool): If set to true, stream will be decoded into dicts
                on the fly. Only applicable if ``stream`` is True.
                False by default.
            stream (bool): If set to false, only the current stats will be
                returned instead of a stream. True by default.
            one_shot (bool): If set to true, Only get a single stat instead of
                waiting for 2 cycles. Must be used with stream=false. False by
                default.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.

        z/containers/{0}/statsr   r‚   z0one_shot is not supported for API version < 1.41zone-shotz;one_shot is only available in conjunction with stream=FalseT)r   r   )Údecodez8decode is only available in conjunction with stream=TruerL   r<   )
r   r   rƒ   r}   r   r„   r®   Ú_stream_helperrP   r>   )r"   r   rá   r   Úone_shotr�   r   s          r&   ÚstatszContainerApiMixin.statsr  sè   € ð, �i‰iÐ/°Ó;ˆà�fð
ˆð ÐÜ×Ñ §¡¨vÔ6Ü×+Ñ+ØFóð ð "*ˆF�:ÑÙÙÜ×,Ñ,ð#óð ð ×&Ñ&Ø—	‘	˜# d°6�	Ó:À6ð 'ó ð ñ Ü×,Ñ,ØNóð ð —<‘< §	¡	¨#°f 	Ó =ÀD�<ÓIÐIr(   c                 ó®   — |€i }d}nd|i}| j                  d|«      }| j                  }|�||z  }| j                  |||¬«      }| j                  |«       y)aí  
        Stops a container. Similar to the ``docker stop`` command.

        Args:
            container (str): The container to stop
            timeout (int): Timeout in seconds to wait for the container to
                stop before sending a ``SIGKILL``. If None, then the
                StopTimeout value of the container will be used.
                Default: None

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        Né
   rÖ   z/containers/{0}/stopr×   rÙ   rÚ   s          r&   ÚstopzContainerApiMixin.stop¢  sh   € ð  ˆ?ØˆFØ‰Gà˜7�^ˆFØ�i‰iÐ.°	Ó:ˆØ—|‘|ˆØÐ#Ø˜GÑ#ˆLØ�j‰j˜ V°\ˆjÓBˆØ×Ñ˜sÕ#r(   c                 ó~   — | j                  d|«      }i }|�||d<   | j                  | j                  ||¬«      d«      S )a|  
        Display the running processes of a container.

        Args:
            container (str): The container to inspect
            ps_args (str): An optional arguments passed to ps (e.g. ``aux``)

        Returns:
            (str): The output of the top

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        z/containers/{0}/topÚps_argsrL   T)r   r>   rP   )r"   r   ré   r#   r   s        r&   ÚtopzContainerApiMixin.top¾  sH   € ð  �I‰IÐ+¨YÓ7ˆØˆØÐØ 'ˆF�9ÑØ�|‰|˜DŸI™I a°˜IÓ7¸Ó>Ð>r(   c                 ól   — | j                  d|«      }| j                  |«      }| j                  |«       y)z€
        Unpause all processes within a container.

        Args:
            container (str): The container to unpause
        z/containers/{0}/unpauseNr²   r³   s       r&   ÚunpausezContainerApiMixin.unpauseÔ  s0   € ð �i‰iÐ1°9Ó=ˆØ�j‰j˜‹oˆØ×Ñ˜sÕ#r(   z1.22c                 ó  — | j                  d|«      }i }|r||d<   |r||d<   |r||d<   |r||d<   |r||d<   |r||d<   |rt        j                  |«      |d<   |	rt        j                  |	«      |d	<   |
rt        j                  |
«      |d
<   |rt        j                  |«      |d<   |r:t        j                  | j                  d«      rt        j                  d«      ‚||d<   | j                  ||¬«      }| j                  |d«      S )aC  
        Update resource configs of one or more containers.

        Args:
            container (str): The container to inspect
            blkio_weight (int): Block IO (relative weight), between 10 and 1000
            cpu_period (int): Limit CPU CFS (Completely Fair Scheduler) period
            cpu_quota (int): Limit CPU CFS (Completely Fair Scheduler) quota
            cpu_shares (int): CPU shares (relative weight)
            cpuset_cpus (str): CPUs in which to allow execution
            cpuset_mems (str): MEMs in which to allow execution
            mem_limit (float or str): Memory limit
            mem_reservation (float or str): Memory soft limit
            memswap_limit (int or str): Total memory (memory + swap), -1 to
                disable swap
            kernel_memory (int or str): Kernel memory limit
            restart_policy (dict): Restart policy dictionary

        Returns:
            (dict): Dictionary containing a ``Warnings`` key.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        z/containers/{0}/updateÚBlkioWeightÚ	CpuPeriodÚ	CpuSharesÚCpuQuotaÚ
CpusetCpusÚ
CpusetMemsÚMemoryÚMemoryReservationÚ
MemorySwapÚKernelMemoryz1.23z=restart policy update is not supported for API version < 1.23ÚRestartPolicy)r;   T)	r   r   Úparse_bytesrƒ   r}   r   r„   r?   r>   )r"   r   Úblkio_weightÚ
cpu_periodÚ	cpu_quotaÚ
cpu_sharesÚcpuset_cpusÚcpuset_memsÚ	mem_limitÚmem_reservationÚmemswap_limitÚkernel_memoryÚrestart_policyr�   r;   rT   s                   r&   Úupdate_containerz"ContainerApiMixin.update_containerà  s'  € ðB �i‰iÐ0°)Ó<ˆØˆÙØ".ˆD�ÑÙØ *ˆD�ÑÙØ *ˆD�ÑÙØ(ˆD�ÑÙØ!,ˆD�ÑÙØ!,ˆD�ÑÙÜ"×.Ñ.¨yÓ9ˆD�‰NÙÜ(-×(9Ñ(9¸/Ó(JˆDÐ$Ñ%ÙÜ!&×!2Ñ!2°=Ó!AˆD�ÑÙÜ#(×#4Ñ#4°]Ó#CˆD�Ñ ÙÜ×Ñ §¡¨vÔ6Ü×+Ñ+ð-óð ð %3ˆD�Ñ!à�o‰o˜c¨ˆoÓ-ˆØ�|‰|˜C Ó&Ð&r(   c                 óî   — | j                  d|«      }i }|�:t        j                  | j                  d«      rt	        j
                  d«      ‚||d<   | j                  |||¬«      }| j                  |d«      S )a[  
        Block until a container stops, then return its exit code. Similar to
        the ``docker wait`` command.

        Args:
            container (str or dict): The container to wait on. If a dict, the
                ``Id`` key is used.
            timeout (int): Request timeout
            condition (str): Wait until a container state reaches the given
                condition, either ``not-running`` (default), ``next-exit``,
                or ``removed``

        Returns:
            (dict): The API's response as a Python dictionary, including
                the container's exit code under the ``StatusCode`` attribute.

        Raises:
            :py:class:`requests.exceptions.ReadTimeout`
                If the timeout is exceeded.
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        z/containers/{0}/waitz1.30z6wait condition is not supported for API version < 1.30Ú	condition)rØ   r   T)r   r   rƒ   r}   r   r„   r   r>   )r"   r   rØ   r  r�   r   rT   s          r&   ÚwaitzContainerApiMixin.wait"  s{   € ð0 �i‰iÐ.°	Ó:ˆØˆØÐ Ü×Ñ §¡¨vÔ6Ü×+Ñ+ØLóð ð #,ˆF�;Ñà�j‰j˜ g°fˆjÓ=ˆØ�|‰|˜C Ó&Ð&r(   )TTFFF)NF)NNNNTNN)	FFFFNNéÿÿÿÿFN)NNNFFFNNNFNNNNNNNNNNNNTN)NNr|   )TTFFrF   NNN)FFF)ræ   )NTN)NNNNNNNNNNN)&Ú__name__Ú
__module__Ú__qualname__r   Úcheck_resourcer'   r2   rC   rV   rz   r^   r_   rˆ   rŠ   rŒ   r�   r   r”   rŸ   r¢   r¦   r   r8   r¿   rÄ   Úminimum_versionrÆ   rÌ   rÎ   rÔ   rÜ   rß   rä   rç   rê   rì   r  r  © r(   r&   r   r      s½  „ Ø€U×Ñ˜+Ó&Ø48Ø/4ò3ó 'ð3ðj €U×Ñ˜+Ó&ò*
ó 'ð*
ðX €U×Ñ˜+Ó&ØCGØ;?ò#
ó 'ð#
ðJ FKØ;@ØóCðJ IMØJNØ37ØGKØHLØDHØ=AØ48Ø9=ó[Iòz?ó'ò^+ò@1ò4">ðH €U×Ñ˜+Ó&ñ
ó 'ð
ð& €U×Ñ˜+Ó&Ø+Bò ?ó 'ð?ð, €U×Ñ˜+Ó&Ø6MØ"'ò2
ó 'ð2
ðh €U×Ñ˜+Ó&ñ
ó 'ð
ð& €U×Ñ˜+Ó&ò$ó 'ð$ð, €U×Ñ˜+Ó&Ø?DØ>BØòPó 'ðPðd €U×Ñ˜+Ó&ñ$ó 'ð$ð €U×Ñ˜+Ó&ñ/ó 'ð/ðb €U×Ñ˜+Ó&ñ&ó 'ð&ð0 €U×Ñ˜6Ó"òBó #ðBð* €U×Ñ˜+Ó&ò$ó 'ð$ð, €U×Ñ˜+Ó&ñ$ó 'ð$ð" €U×Ñ˜+Ó&ñ$ó 'ð$ð$ €U×Ñ˜+Ó&ò$ó 'ð$ð. €U×Ñ˜+Ó&ñ#$ó 'ð#$ðJ €U×Ñ˜+Ó&ò-Jó 'ð-Jð^ €U×Ñ˜+Ó&ò$ó 'ð$ð6 €U×Ñ˜+Ó&ò?ó 'ð?ð* €U×Ñ˜+Ó&ñ	$ó 'ð	$ð €U×Ñ˜6Ó"Ø€U×Ñ˜+Ó&àGKØGKØ@DØò	>'ó 'ó #ð>'ð@ €U×Ñ˜+Ó&ò!'ó 'ñ!'r(   r   N)r   Ú r   r   Ú	constantsr   Útypesr   r	   r
   r   r   r   r  r(   r&   ú<module>r     s$   ðÝ ç Ý /÷õ ÷v'ò v'r(   