Skip to content

Commit f6b17dd

Browse files
committed
_pysslConn back to _sslConn
1 parent af83d81 commit f6b17dd

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

pymongo/network_layer.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@
4646
_HAVE_SSL = False
4747

4848
try:
49-
from pymongo.pyopenssl_context import _sslConn as _pysslConn
49+
from pymongo.pyopenssl_context import _sslConn
5050

5151
_HAVE_PYOPENSSL = True
5252
except ImportError:
5353
_HAVE_PYOPENSSL = False
54-
_pysslConn = SSLSocket # type: ignore[assignment, misc]
54+
_sslConn = SSLSocket # type: ignore[assignment, misc]
5555

5656
from pymongo.ssl_support import (
5757
BLOCKING_IO_LOOKUP_ERROR,
@@ -76,12 +76,12 @@
7676

7777
# These socket-based I/O methods are for KMS requests and any other network operations that do not use
7878
# the MongoDB wire protocol
79-
async def async_socket_sendall(sock: Union[socket.socket, _pysslConn], buf: bytes) -> None:
79+
async def async_socket_sendall(sock: Union[socket.socket, _sslConn], buf: bytes) -> None:
8080
timeout = sock.gettimeout()
8181
sock.settimeout(0.0)
8282
loop = asyncio.get_running_loop()
8383
try:
84-
if _HAVE_SSL and isinstance(sock, (SSLSocket, _pysslConn)):
84+
if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)):
8585
await asyncio.wait_for(_async_socket_sendall_ssl(sock, buf, loop), timeout=timeout)
8686
else:
8787
await asyncio.wait_for(loop.sock_sendall(sock, buf), timeout=timeout) # type: ignore[arg-type]
@@ -95,7 +95,7 @@ async def async_socket_sendall(sock: Union[socket.socket, _pysslConn], buf: byte
9595
if sys.platform != "win32":
9696

9797
async def _async_socket_sendall_ssl(
98-
sock: Union[socket.socket, _pysslConn], buf: bytes, loop: AbstractEventLoop
98+
sock: Union[socket.socket, _sslConn], buf: bytes, loop: AbstractEventLoop
9999
) -> None:
100100
view = memoryview(buf)
101101
sent = 0
@@ -138,7 +138,7 @@ def _is_ready(fut: Future) -> None:
138138
loop.remove_writer(fd)
139139

140140
async def _async_socket_receive_ssl(
141-
conn: _pysslConn, length: int, loop: AbstractEventLoop, once: Optional[bool] = False
141+
conn: _sslConn, length: int, loop: AbstractEventLoop, once: Optional[bool] = False
142142
) -> memoryview:
143143
mv = memoryview(bytearray(length))
144144
total_read = 0
@@ -192,7 +192,7 @@ def _is_ready(fut: Future) -> None:
192192
# https://docs.python.org/3/library/asyncio-platforms.html#asyncio-platform-support
193193
# Note: In PYTHON-4493 we plan to replace this code with asyncio streams.
194194
async def _async_socket_sendall_ssl(
195-
sock: Union[socket.socket, _pysslConn], buf: bytes, dummy: AbstractEventLoop
195+
sock: Union[socket.socket, _sslConn], buf: bytes, dummy: AbstractEventLoop
196196
) -> None:
197197
view = memoryview(buf)
198198
total_length = len(buf)
@@ -213,7 +213,7 @@ async def _async_socket_sendall_ssl(
213213
total_sent += sent
214214

215215
async def _async_socket_receive_ssl(
216-
conn: _pysslConn, length: int, dummy: AbstractEventLoop, once: Optional[bool] = False
216+
conn: _sslConn, length: int, dummy: AbstractEventLoop, once: Optional[bool] = False
217217
) -> memoryview:
218218
mv = memoryview(bytearray(length))
219219
total_read = 0
@@ -239,7 +239,7 @@ async def _async_socket_receive_ssl(
239239
return mv
240240

241241

242-
def sendall(sock: Union[socket.socket, _pysslConn], buf: bytes) -> None:
242+
def sendall(sock: Union[socket.socket, _sslConn], buf: bytes) -> None:
243243
sock.sendall(buf)
244244

245245

@@ -252,15 +252,15 @@ async def _poll_cancellation(conn: AsyncConnection) -> None:
252252

253253

254254
async def async_receive_data_socket(
255-
sock: Union[socket.socket, _pysslConn], length: int
255+
sock: Union[socket.socket, _sslConn], length: int
256256
) -> memoryview:
257257
sock_timeout = sock.gettimeout()
258258
timeout = sock_timeout
259259

260260
sock.settimeout(0.0)
261261
loop = asyncio.get_running_loop()
262262
try:
263-
if _HAVE_SSL and isinstance(sock, (SSLSocket, _pysslConn)):
263+
if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)):
264264
return await asyncio.wait_for(
265265
_async_socket_receive_ssl(sock, length, loop, once=True), # type: ignore[arg-type]
266266
timeout=timeout,
@@ -435,7 +435,7 @@ def sock(self) -> socket.socket:
435435

436436

437437
class NetworkingInterface(NetworkingInterfaceBase):
438-
def __init__(self, conn: Union[socket.socket, _pysslConn]):
438+
def __init__(self, conn: Union[socket.socket, _sslConn]):
439439
super().__init__(conn)
440440

441441
def gettimeout(self) -> float | None:
@@ -451,11 +451,11 @@ def is_closing(self) -> bool:
451451
return self.conn.is_closing()
452452

453453
@property
454-
def get_conn(self) -> Union[socket.socket, _pysslConn]:
454+
def get_conn(self) -> Union[socket.socket, _sslConn]:
455455
return self.conn
456456

457457
@property
458-
def sock(self) -> Union[socket.socket, _pysslConn]:
458+
def sock(self) -> Union[socket.socket, _sslConn]:
459459
return self.conn
460460

461461
def fileno(self) -> int:

0 commit comments

Comments
 (0)