HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/docker/api/__pycache__/daemon.cpython-310.pyc
o

�2.ax�@s:ddlZddlmZddlmZmZmZGdd�d�ZdS)�N)�datetime�)�auth�types�utilsc@sPeZdZe�d�dd��Zddd�Zdd�Z		dd
d�Zdd
�Z	ddd�Z
dS)�DaemonApiMixinz1.25cCs|�d�}|�|�|�d�S)a(
        Get data usage information.

        Returns:
            (dict): A dictionary representing different resource categories
            and their respective data usage.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        z
/system/dfT��_url�_result�_get)�self�url�r�3/usr/lib/python3/dist-packages/docker/api/daemon.py�dfs

zDaemonApiMixin.dfNc	Csxt|t�r
t�|�}t|t�rt�|�}|rt�|�}|||d�}|�d�}|j||ddd�}|j||d�}t�	||�S)ar
        Get real-time events from the server. Similar to the ``docker events``
        command.

        Args:
            since (UTC datetime or int): Get events from this point
            until (UTC datetime or int): Get events until this point
            filters (dict): Filter the events by event time, container or image
            decode (bool): If set to true, stream will be decoded into dicts on
                the fly. False by default.

        Returns:
            A :py:class:`docker.types.daemon.CancellableStream` generator

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

        Example:

            >>> for event in client.events(decode=True)
            ...   print(event)
            {u'from': u'image/with:tag',
             u'id': u'container-id',
             u'status': u'start',
             u'time': 1423339459}
            ...

            or

            >>> events = client.events()
            >>> for event in events:
            ...   print(event)
            >>> # and cancel from another thread
            >>> events.close()
        )�since�until�filtersz/eventsTN)�params�stream�timeout)�decode)
�
isinstancerr�datetime_to_timestamp�convert_filtersr	r�_stream_helperr�CancellableStream)	rrrrrrr
�responserrrr�eventss
&



�
zDaemonApiMixin.eventscCs|�|�|�d��d�S)a

        Display system-wide information. Identical to the ``docker info``
        command.

        Returns:
            (dict): The info as a dict

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        z/infoT�r
rr	�rrrr�infoSszDaemonApiMixin.infoFc
Cs�|rtj�|�rtj||jd�|_n|jr|jjr!tj|jd�|_|j�|�}|r5|�	dd�|kr5|s5|S||||d�}|j
|�d�|d�}	|	jdkrU|j�
|pRtj|�|j|	dd	�S)
a^
        Authenticate with a registry. Similar to the ``docker login`` command.

        Args:
            username (str): The registry username
            password (str): The plaintext password
            email (str): The email for the registry account
            registry (str): URL to the registry.  E.g.
                ``https://index.docker.io/v1/``
            reauth (bool): Whether or not to refresh existing authentication on
                the Docker server.
            dockercfg_path (str): Use a custom path for the Docker config file
                (default ``$HOME/.docker/config.json`` if present,
                otherwise ``$HOME/.dockercfg``)

        Returns:
            (dict): The response from the login request

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )�
credstore_env�usernameN)r#�password�email�
serveraddressz/auth)�data��T��json)�os�path�existsr�load_configr"�
_auth_configs�is_empty�resolve_authconfig�get�
_post_jsonr	�status_code�add_auth�
INDEX_NAMEr
)
rr#r$r%�registry�reauth�dockercfg_path�authcfg�req_datarrrr�loginas,
����
zDaemonApiMixin.logincCs|�|�|�d���dkS)a!
        Checks the server is responsive. An exception will be raised if it
        isn't responding.

        Returns:
            (bool) The response from the server.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        z/_ping�OKrr rrr�ping�szDaemonApiMixin.pingTcCs"|jd|d�}|j|�|�dd�S)a&
        Returns version information from the server. Similar to the ``docker
        version`` command.

        Returns:
            (dict): The server version information

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        z/version)�
versioned_apiTr)r)r�api_versionr
rrr�version�szDaemonApiMixin.version)NNNN)NNNFN)T)�__name__�
__module__�__qualname__r�minimum_versionrrr!r<r>rArrrrrs

;
�9r)r+r�rrrrrrrr�<module>s