-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
docker: Fix some incomlpete types in docker #14817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lev-blit
wants to merge
18
commits into
python:main
Choose a base branch
from
lev-blit:feature/docker-fix-incomplete-types
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 14 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
847b9af
fill in incomplete in docker/errors.pyi
lev-blit 93ccd5d
fill in incomplete in docker/api/image.pyi
lev-blit 4c29fb7
fill in incomplete in docker/api/swarm.pyi
lev-blit 8022a93
fill in some incomplete in docker/credentials/store.pyi
lev-blit c29d9b3
fill in incomplete in docker/models/services.pyi
lev-blit d87b2b1
fill in incomplete in docker/transport/npipeconn.pyi
lev-blit b5fc722
fill in incomplete in docker/transport/npipesocket.pyi
lev-blit 1dbeac1
fill in incomplete in docker/transport/sshconn.pyi
lev-blit b75198f
fill in incomplete in docker/transport/unixconn.pyi
lev-blit 051f3c9
fill in type for aliases in docker/types/networks.pyi
lev-blit f7d2d7e
fill in some incompletes in docker/types/services.pyi
lev-blit 0081f41
fill in incomplete in docker/types/swarm.pyi
lev-blit 26e2f94
fill in incomplete in docker/utils/decorators.pyi
lev-blit 5009692
fill in incomplete in docker/utils/utils.pyi
lev-blit b6fe703
remove win32 change - will be extracted to another PR
lev-blit bb329f7
introduce a TypeAlias instead of a TODO comment
lev-blit 423a90c
fixup the types of decorators to return the same callable
lev-blit e3c8c34
use str instead of AnyStr
lev-blit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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]: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another workaround is to add a type alias like this above and use that here: