mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 11:55:04 +00:00
Add typing information, 2/n (#1178)
* Add typing to Docker Stack modules. Clean modules up. * Add typing to Docker Swarm modules. * Add typing to unit tests. * Add more typing. * Add ignore.txt entries.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import typing as t
|
||||
from queue import Empty
|
||||
|
||||
from .. import constants
|
||||
@@ -19,6 +20,12 @@ from .basehttpadapter import BaseHTTPAdapter
|
||||
from .npipesocket import NpipeSocket
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
from collections.abc import Mapping
|
||||
|
||||
from requests import PreparedRequest
|
||||
|
||||
|
||||
RecentlyUsedContainer = urllib3._collections.RecentlyUsedContainer
|
||||
|
||||
|
||||
@@ -91,7 +98,9 @@ class NpipeHTTPAdapter(BaseHTTPAdapter):
|
||||
)
|
||||
super().__init__()
|
||||
|
||||
def get_connection(self, url: str | bytes, proxies=None) -> NpipeHTTPConnectionPool:
|
||||
def get_connection(
|
||||
self, url: str | bytes, proxies: Mapping[str, str] | None = None
|
||||
) -> NpipeHTTPConnectionPool:
|
||||
with self.pools.lock:
|
||||
pool = self.pools.get(url)
|
||||
if pool:
|
||||
@@ -104,7 +113,9 @@ class NpipeHTTPAdapter(BaseHTTPAdapter):
|
||||
|
||||
return pool
|
||||
|
||||
def request_url(self, request, proxies) -> str:
|
||||
def request_url(
|
||||
self, request: PreparedRequest, proxies: Mapping[str, str] | None
|
||||
) -> str:
|
||||
# The select_proxy utility in requests errors out when the provided URL
|
||||
# does not have a hostname, like is the case when using a UNIX socket.
|
||||
# Since proxies are an irrelevant notion in the case of UNIX sockets
|
||||
|
||||
Reference in New Issue
Block a user