File: //lib/python3/dist-packages/docker/api/__pycache__/image.cpython-310.pyc
o
�2.a�N � @ sb d dl Z d dlZddlmZmZmZ ddlmZ e �e �Z
G dd� d�Zdd� Z dd d
�Z
dS )� N� )�auth�errors�utils)�DEFAULT_DATA_CHUNK_SIZEc @ s. e Zd Ze�d�efdd��Ze�d�dd� �Zd*dd �Z d+d
d�Z d,dd
�Z
d,dd�Z d,dd�Z d,dd�Z
d,dd�Ze�d�dd� �Ze�d�e�d�d-dd���Zd-dd�Ze�d�d-dd��Z d.d d!�Z d/d"d#�Ze�d�d0d$d%��Zd-d&d'�Ze�d�d1d(d)��ZdS )2�
ImageApiMixin�imagec C s$ | j | �d|�dd�}| �||d�S )a�
Get a tarball of an image. Similar to the ``docker save`` command.
Args:
image (str): Image name to get
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): A stream of raw archive data.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
Example:
>>> image = client.api.get_image("busybox:latest")
>>> f = open('/tmp/busybox-latest.tar', 'wb')
>>> for chunk in image:
>>> f.write(chunk)
>>> f.close()
z/images/{0}/getT)�streamF)�_get�_url�_stream_raw_result)�selfr �
chunk_size�res� r �2/usr/lib/python3/dist-packages/docker/api/image.py� get_image s zImageApiMixin.get_imagec C s | � | �d|��}| �|d�S )a#
Show the history of an image.
Args:
image (str): The image to show history for
Returns:
(str): The history of the image
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
z/images/{0}/historyT)r
r �_result)r
r r r r r �history) s zImageApiMixin.historyNFc C s� |rdnd|r dndd�}|r&t �| jd�r||d<