Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stubs/docker/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "7.1.*"
upstream_repository = "https://github.com/docker/docker-py"
requires = ["types-requests", "urllib3>=2"]
requires = ["types-paramiko", "types-requests", "urllib3>=2"]
4 changes: 2 additions & 2 deletions stubs/docker/docker/api/image.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from _typeshed import Incomplete
import logging
from typing import Any

log: Incomplete
log: logging.Logger

class ImageApiMixin:
def get_image(self, image: str, chunk_size: int | None = 2097152): ...
Expand Down
21 changes: 12 additions & 9 deletions stubs/docker/docker/api/swarm.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from _typeshed import Incomplete
import logging
from typing import Literal

log: Incomplete
from docker.types.swarm import SwarmSpec

log: logging.Logger

class SwarmApiMixin:
def create_swarm_spec(self, *args, **kwargs): ...
def create_swarm_spec(self, *args, **kwargs) -> SwarmSpec: ...
def get_unlock_key(self): ...
def init_swarm(
self,
Expand All @@ -20,17 +23,17 @@ class SwarmApiMixin:
def inspect_node(self, node_id): ...
def join_swarm(
self, remote_addrs, join_token, listen_addr: str = "0.0.0.0:2377", advertise_addr=None, data_path_addr=None
): ...
def leave_swarm(self, force: bool = False): ...
) -> Literal[True]: ...
def leave_swarm(self, force: bool = False) -> Literal[True]: ...
def nodes(self, filters=None): ...
def remove_node(self, node_id, force: bool = False): ...
def unlock_swarm(self, key): ...
def update_node(self, node_id, version, node_spec=None): ...
def remove_node(self, node_id, force: bool = False) -> Literal[True]: ...
def unlock_swarm(self, key) -> Literal[True]: ...
def update_node(self, node_id, version, node_spec=None) -> Literal[True]: ...
def update_swarm(
self,
version,
swarm_spec=None,
rotate_worker_token: bool = False,
rotate_manager_token: bool = False,
rotate_manager_unlock_key: bool = False,
): ...
) -> Literal[True]: ...
6 changes: 3 additions & 3 deletions stubs/docker/docker/credentials/store.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from _typeshed import Incomplete

class Store:
program: Incomplete
exe: Incomplete
program: str
exe: str | None
environment: Incomplete
def __init__(self, program, environment=None) -> None: ...
def __init__(self, program: str, environment=None) -> None: ...
def get(self, server): ...
def store(self, server, username, secret): ...
def erase(self, server) -> None: ...
Expand Down
16 changes: 9 additions & 7 deletions stubs/docker/docker/errors.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from _typeshed import Incomplete
from collections.abc import Iterator, Mapping
from typing import NoReturn
from typing import Any, NoReturn

from docker.models.containers import Container
from docker.models.images import Image
from requests import HTTPError, Response

class DockerException(Exception): ...
Expand Down Expand Up @@ -35,11 +35,13 @@ class NullResource(DockerException, ValueError): ...

class ContainerError(DockerException):
container: Container
exit_status: Incomplete
command: Incomplete
image: Incomplete
exit_status: int
command: str | list[str] | None
image: str | Image
stderr: str | None
def __init__(self, container: Container, exit_status, command, image, stderr: str | None) -> None: ...
def __init__(
self, container: Container, exit_status: int, command: str | list[str] | None, image: str | Image, stderr: str | None
) -> None: ...

class StreamParseError(RuntimeError):
msg: str
Expand All @@ -52,7 +54,7 @@ class BuildError(DockerException):

class ImageLoadError(DockerException): ...

def create_unexpected_kwargs_error(name, kwargs: Mapping[str, Incomplete]) -> NoReturn: ...
def create_unexpected_kwargs_error(name, kwargs: Mapping[str, Any]) -> NoReturn: ...

class MissingContextParameter(DockerException):
param: str
Expand Down
10 changes: 4 additions & 6 deletions stubs/docker/docker/models/services.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from _typeshed import Incomplete

from .resource import Collection, Model

class Service(Model):
Expand All @@ -21,7 +19,7 @@ class ServiceCollection(Collection[Service]):
def get(self, service_id, insert_defaults=None): ...
def list(self, **kwargs): ...

CONTAINER_SPEC_KWARGS: Incomplete
TASK_TEMPLATE_KWARGS: Incomplete
CREATE_SERVICE_KWARGS: Incomplete
PLACEMENT_KWARGS: Incomplete
CONTAINER_SPEC_KWARGS: list[str]
TASK_TEMPLATE_KWARGS: list[str]
CREATE_SERVICE_KWARGS: list[str]
PLACEMENT_KWARGS: list[str]
32 changes: 16 additions & 16 deletions stubs/docker/docker/transport/npipeconn.pyi
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
from _typeshed import Incomplete

import urllib3
import urllib3.connection
from docker.transport.basehttpadapter import BaseHTTPAdapter
from docker.transport.npipesocket import NpipeSocket
from urllib3._collections import RecentlyUsedContainer as urllib3_RecentlyUsedContainer

RecentlyUsedContainer: Incomplete
RecentlyUsedContainer = urllib3_RecentlyUsedContainer

class NpipeHTTPConnection(urllib3.connection.HTTPConnection):
npipe_path: Incomplete
timeout: Incomplete
def __init__(self, npipe_path, timeout: int = 60) -> None: ...
sock: Incomplete
npipe_path: str
timeout: int
def __init__(self, npipe_path: str, timeout: int = 60) -> None: ...
sock: NpipeSocket | None
def connect(self) -> None: ...

class NpipeHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
npipe_path: Incomplete
timeout: Incomplete
def __init__(self, npipe_path, timeout: int = 60, maxsize: int = 10) -> None: ...
npipe_path: str
timeout: urllib3.Timeout
def __init__(self, npipe_path: str, timeout: int = 60, maxsize: int = 10) -> None: ...

class NpipeHTTPAdapter(BaseHTTPAdapter):
__attrs__: Incomplete
npipe_path: Incomplete
timeout: Incomplete
max_pool_size: Incomplete
pools: Incomplete
def __init__(self, base_url, timeout: int = 60, pool_connections=..., max_pool_size=...) -> None: ...
__attrs__: list[str]
npipe_path: str
timeout: int
max_pool_size: int
pools: RecentlyUsedContainer
def __init__(self, base_url: str, timeout: int = 60, pool_connections: int = 25, max_pool_size: int = 10) -> None: ...
def get_connection(self, url, proxies=None): ...
def request_url(self, request, proxies): ...
69 changes: 38 additions & 31 deletions stubs/docker/docker/transport/npipesocket.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import io
from _typeshed import Incomplete
from _typeshed import Incomplete, ReadableBuffer
from typing import Literal, NoReturn

cERROR_PIPE_BUSY: int
cSECURITY_SQOS_PRESENT: int
Expand All @@ -9,41 +10,47 @@ MAXIMUM_RETRY_COUNT: int
def check_closed(f): ...

class NpipeSocket:
# TODO: handle requires the type pywin32._win32typing.PyHANDLE
def __init__(self, handle=None) -> None: ...
def accept(self) -> None: ...
def bind(self, address) -> None: ...
def close(self) -> None: ...
flags: Incomplete
def connect(self, address, retry_count: int = 0): ...
def connect_ex(self, address): ...
def detach(self): ...
def dup(self): ...
def getpeername(self): ...
def getsockname(self): ...
def getsockopt(self, level, optname, buflen=None) -> None: ...
def ioctl(self, control, option) -> None: ...
def listen(self, backlog) -> None: ...
def makefile(self, mode=None, bufsize=None): ...
def recv(self, bufsize, flags: int = 0): ...
def recvfrom(self, bufsize, flags: int = 0): ...
def recvfrom_into(self, buf, nbytes: int = 0, flags: int = 0): ...
def recv_into(self, buf, nbytes: int = 0): ...
def send(self, string, flags: int = 0): ...
def sendall(self, string, flags: int = 0): ...
def sendto(self, string, address): ...
def setblocking(self, flag): ...
def settimeout(self, value) -> None: ...
def gettimeout(self): ...
def setsockopt(self, level, optname, value) -> None: ...
def shutdown(self, how): ...
flags: int
def connect(self, address: str, retry_count: int = 0) -> None: ...
def connect_ex(self, address: str) -> None: ...
# TODO: return type requires the type pywin32._win32typing.PyHANDLE
def detach(self) -> Incomplete | None: ...
def dup(self) -> NpipeSocket: ...
def getpeername(self) -> str: ...
def getsockname(self) -> str: ...
# NotImplementedError
def getsockopt(self, level, optname, buflen=None) -> NoReturn: ...
# NotImplementedError
def ioctl(self, control, option) -> NoReturn: ...
# NotImplementedError
def listen(self, backlog) -> NoReturn: ...
def makefile(self, mode: str | None = None, bufsize: int | None = None) -> io.BufferedReader: ...
def recv(self, bufsize: int, flags: int = 0) -> str: ...
def recvfrom(self, bufsize: int, flags: int = 0) -> tuple[str, str]: ...
def recvfrom_into(self, buf: memoryview | ReadableBuffer, nbytes: int = 0, flags: int = 0) -> tuple[int, str]: ...
def recv_into(self, buf: memoryview | ReadableBuffer, nbytes: int = 0) -> int: ...
def send(self, string: str, flags: int = 0) -> int: ...
def sendall(self, string: str, flags: int = 0) -> int: ...
def sendto(self, string: str, address: str) -> int: ...
def setblocking(self, flag: bool) -> None: ...
def settimeout(self, value: float | None) -> None: ...
def gettimeout(self) -> int | None: ...
# NotImplementedError
def setsockopt(self, level, optname, value) -> NoReturn: ...
def shutdown(self, how) -> None: ...

class NpipeFileIOBase(io.RawIOBase):
sock: Incomplete
def __init__(self, npipe_socket) -> None: ...
sock: NpipeSocket
def __init__(self, npipe_socket: NpipeSocket) -> None: ...
def close(self) -> None: ...
def fileno(self): ...
def isatty(self): ...
def readable(self): ...
def readinto(self, buf): ...
def seekable(self): ...
def writable(self): ...
def isatty(self) -> Literal[False]: ...
def readable(self) -> Literal[True]: ...
def readinto(self, buf: memoryview | ReadableBuffer) -> int: ...
def seekable(self) -> Literal[False]: ...
def writable(self) -> Literal[False]: ...
54 changes: 30 additions & 24 deletions stubs/docker/docker/transport/sshconn.pyi
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import socket
from _typeshed import Incomplete
import subprocess

import urllib3
import urllib3.connection
from docker.transport.basehttpadapter import BaseHTTPAdapter
from paramiko import SSHClient, Transport
from urllib3._collections import RecentlyUsedContainer as urllib3_RecentlyUsedContainer

RecentlyUsedContainer: Incomplete
RecentlyUsedContainer = urllib3_RecentlyUsedContainer

class SSHSocket(socket.socket):
host: Incomplete
port: Incomplete
user: Incomplete
proc: Incomplete
def __init__(self, host) -> None: ...
host: str
port: str | None
user: str | None
proc: subprocess.Popen[bytes] | None
def __init__(self, host: str) -> None: ...
def connect(self, **kwargs) -> None: ... # type:ignore[override]
def sendall(self, data) -> None: ... # type:ignore[override]
def send(self, data): ... # type:ignore[override]
Expand All @@ -21,27 +23,31 @@ class SSHSocket(socket.socket):
def close(self) -> None: ...

class SSHConnection(urllib3.connection.HTTPConnection):
ssh_transport: Incomplete
timeout: Incomplete
ssh_host: Incomplete
def __init__(self, ssh_transport=None, timeout: int = 60, host=None) -> None: ...
sock: Incomplete
ssh_transport: Transport | None
timeout: int
ssh_host: str | None
def __init__(self, ssh_transport: Transport | None = None, timeout: int = 60, host: str | None = None) -> None: ...
sock: SSHSocket | None
def connect(self) -> None: ...

class SSHConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
scheme: str
ssh_transport: Incomplete
timeout: Incomplete
ssh_host: Incomplete
def __init__(self, ssh_client=None, timeout: int = 60, maxsize: int = 10, host=None) -> None: ...
ssh_transport: Transport | None
timeout: urllib3.Timeout
ssh_host: str | None
def __init__(
self, ssh_client: SSHClient | None = None, timeout: int = 60, maxsize: int = 10, host: str | None = None
) -> None: ...

class SSHHTTPAdapter(BaseHTTPAdapter):
__attrs__: Incomplete
ssh_client: Incomplete
ssh_host: Incomplete
timeout: Incomplete
max_pool_size: Incomplete
pools: Incomplete
def __init__(self, base_url, timeout: int = 60, pool_connections=25, max_pool_size=10, shell_out: bool = False) -> None: ...
def get_connection(self, url, proxies=None): ...
__attrs__: list[str]
ssh_client: SSHClient | None
ssh_host: str
timeout: int
max_pool_size: int
pools: int
def __init__(
self, base_url: str, timeout: int = 60, pool_connections: int = 25, max_pool_size: int = 10, shell_out: bool = False
) -> None: ...
def get_connection(self, url: str | bytes, proxies=None) -> SSHConnectionPool: ...
def close(self) -> None: ...
41 changes: 22 additions & 19 deletions stubs/docker/docker/transport/unixconn.pyi
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
from _typeshed import Incomplete
import socket

import urllib3
import urllib3.connection
from docker.transport.basehttpadapter import BaseHTTPAdapter
from requests import PreparedRequest
from urllib3._collections import RecentlyUsedContainer as urllib3_RecentlyUsedContainer

RecentlyUsedContainer: Incomplete
RecentlyUsedContainer = urllib3_RecentlyUsedContainer

class UnixHTTPConnection(urllib3.connection.HTTPConnection):
base_url: Incomplete
unix_socket: Incomplete
timeout: Incomplete
def __init__(self, base_url, unix_socket, timeout: int = 60) -> None: ...
sock: Incomplete
base_url: str
unix_socket: str
timeout: int
def __init__(self, base_url: str, unix_socket: str, timeout: int = 60) -> None: ...
sock: socket.socket | None
def connect(self) -> None: ...

class UnixHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
base_url: Incomplete
socket_path: Incomplete
timeout: Incomplete
def __init__(self, base_url, socket_path, timeout: int = 60, maxsize: int = 10) -> None: ...
base_url: str
socket_path: str
timeout: urllib3.Timeout
def __init__(self, base_url: str, socket_path: str, timeout: int = 60, maxsize: int = 10) -> None: ...

class UnixHTTPAdapter(BaseHTTPAdapter):
__attrs__: Incomplete
socket_path: Incomplete
timeout: Incomplete
max_pool_size: Incomplete
pools: Incomplete
def __init__(self, socket_url, timeout: int = 60, pool_connections=25, max_pool_size=10) -> None: ...
def get_connection(self, url, proxies=None): ...
def request_url(self, request, proxies): ...
__attrs__: list[str]
socket_path: str
timeout: int
max_pool_size: int
pools: RecentlyUsedContainer
def __init__(self, socket_url: str, timeout: int = 60, pool_connections: int = 25, max_pool_size: int = 10) -> None: ...
def get_connection(self, url: bytes | str, proxies=None) -> UnixHTTPConnectionPool: ...
# proxies is unused
def request_url(self, request: PreparedRequest, proxies) -> str: ...
2 changes: 1 addition & 1 deletion stubs/docker/docker/types/networks.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class EndpointConfig(dict[str, Incomplete]):
def __init__(
self,
version: str,
aliases: list[Incomplete] | None = None,
aliases: list[str] | None = None,
links: dict[str, str] | dict[str, None] | dict[str, str | None] | Iterable[tuple[str, str | None]] | None = None,
ipv4_address: str | None = None,
ipv6_address: str | None = None,
Expand Down
Loading