File: //lib/python3/dist-packages/docker/api/__pycache__/container.cpython-310.pyc
o
�2.aF� � @ s~ d dl m Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z dd lm
Z
dd
lmZ G dd� d�Zd
S )� )�datetime� )�errors)�utils)�DEFAULT_DATA_CHUNK_SIZE)�CancellableStream)�ContainerConfig)�EndpointConfig)�
HostConfig��NetworkingConfigc @ sV e Zd Ze�d� dHdd��Ze�d�dIdd��Ze�d� dJd d
��Z dKdd
�Z dLdd�Z dd� Z
dMdd�Zdd� Zdd� Z
dd� Ze�d�dd� �Ze�d�efdd��Ze�d�edfdd��Ze�d�d d!� �Ze�d�dMd"d#��Ze�d� dNd%d&��Ze�d�d'd(� �Ze�d�d)d*� �Ze�d�d+d,� �Ze�d-�dMd.d/��Ze�d�dOd0d1��Ze�d�d2d3� �Ze�d�d4d5� �Ze�d�dPd7d8��Ze�d�d9d:� �Ze�d�dQd;d<��Z e�d�dMd=d>��Z!e�d�dMd?d@��Z"e�d�dAdB� �Z#e�dC�e�d� dRdDdE���Z$e�d�dSdFdG��Z%dS )T�ContainerApiMixin� containerTFc C s� |rdpd|r dp
d|rdpd|rdpdd�}ddd�}| � d|�} | j| ||dd �}
| j|
|| �|�|d
�}|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�output� r$ �6/usr/lib/python3/dist-packages/docker/api/container.py�attach s
���
zContainerApiMixin.attachNc C sz |du r
dddd�}d|vrd| j v r| j d |d<