Skip to content
Merged
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
9 changes: 6 additions & 3 deletions neo4j/_async_compat/network/_bolt_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
if t.TYPE_CHECKING:
import typing_extensions as te

from ..._async.io import AsyncBolt
from ..._sync.io import Bolt

from ... import addressing
from ..._deadline import Deadline
from ..._exceptions import (
Expand Down Expand Up @@ -75,7 +78,7 @@ def _sanitize_deadline(deadline):


class AsyncBoltSocket:
Bolt: te.Final[t.Type] = None # type: ignore[assignment]
Bolt: te.Final[t.Type[AsyncBolt]] = None # type: ignore[assignment]

def __init__(self, reader, protocol, writer):
self._reader = reader # type: asyncio.StreamReader
Expand Down Expand Up @@ -405,7 +408,7 @@ async def connect(cls, address, *, timeout, custom_resolver, ssl_context,


class BoltSocket:
Bolt: te.Final[t.Type] = None # type: ignore[assignment]
Bolt: te.Final[t.Type[Bolt]] = None # type: ignore[assignment]

def __init__(self, socket_: socket):
self._socket = socket_
Expand Down Expand Up @@ -605,7 +608,7 @@ def _handshake(cls, s, resolved_address):
def close_socket(cls, socket_):
try:
if isinstance(socket_, BoltSocket):
socket.close()
socket_.close()
else:
socket_.shutdown(SHUT_RDWR)
socket_.close()
Expand Down