Skip to content

Commit 2ca3a8e

Browse files
committed
examples typing fixed.
1 parent 5abb6b2 commit 2ca3a8e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

examples/ssl_pool.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import socket
21
import ssl
32
import urllib.parse
43
from http.client import HTTPResponse
@@ -10,7 +9,7 @@
109
Hostname = str
1110
Port = int
1211
Endpoint = Tuple[Hostname, Port]
13-
Connection = socket.socket
12+
Connection = ssl.SSLSocket
1413

1514

1615
http_pool = ConnectionPool[Endpoint, Connection](

examples/tcp_pool.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import socket
2-
from ipaddress import IPv4Address
3-
from typing import Tuple
2+
from ipaddress import IPv4Address, IPv6Address
3+
from typing import Tuple, Union
44

55
from generic_connection_pool.contrib.socket import TcpSocketConnectionManager
66
from generic_connection_pool.threading import ConnectionPool
77

88
Port = int
9-
Endpoint = Tuple[IPv4Address, Port]
9+
IpAddress = Union[IPv4Address, IPv6Address]
10+
Endpoint = Tuple[IpAddress, Port]
1011
Connection = socket.socket
1112

1213

@@ -21,7 +22,7 @@
2122
)
2223

2324

24-
def command(addr: IPv4Address, port: int, cmd: str) -> None:
25+
def command(addr: IpAddress, port: int, cmd: str) -> None:
2526
with redis_pool.connection(endpoint=(addr, port), timeout=5.0) as sock:
2627
sock.sendall(cmd.encode() + b'\n')
2728
response = sock.recv(1024)

0 commit comments

Comments
 (0)