From 7f4a01b7c6580da88151b4b58a89e462e0b627d3 Mon Sep 17 00:00:00 2001 From: Robsdedude Date: Mon, 11 Nov 2024 17:30:51 +0100 Subject: [PATCH] Typing: fix auth token shorthand The driver accepts a tuple `("user", "password")` for the auth argument. This is shorthand for a `basic` auth token. It was typed to expect `tuple[Any, Any]`, which is inconsistent with `neo4j.basic(str, str, ...)`. --- src/neo4j/_async/driver.py | 8 ++++---- src/neo4j/_sync/driver.py | 8 ++++---- src/neo4j/api.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/neo4j/_async/driver.py b/src/neo4j/_async/driver.py index 627fa14d7..c1b3a1e68 100644 --- a/src/neo4j/_async/driver.py +++ b/src/neo4j/_async/driver.py @@ -1026,7 +1026,7 @@ async def verify_connectivity( bookmark_manager: ( AsyncBookmarkManager | BookmarkManager | None ) = ..., - auth: Auth | tuple[t.Any, t.Any] = ..., + auth: Auth | tuple[str, str] = ..., notifications_min_severity: ( T_NotificationMinimumSeverity | None ) = ..., @@ -1101,7 +1101,7 @@ async def get_server_info( bookmark_manager: ( AsyncBookmarkManager | BookmarkManager | None ) = ..., - auth: Auth | tuple[t.Any, t.Any] = ..., + auth: Auth | tuple[str, str] = ..., notifications_min_severity: ( T_NotificationMinimumSeverity | None ) = ..., @@ -1184,7 +1184,7 @@ async def supports_multi_db(self) -> bool: async def verify_authentication( self, - auth: Auth | tuple[t.Any, t.Any] | None = None, + auth: Auth | tuple[str, str] | None = None, # all other arguments are experimental # they may be change or removed any time without prior notice session_connection_timeout: float = ..., @@ -1208,7 +1208,7 @@ async def verify_authentication( async def verify_authentication( self, - auth: Auth | tuple[t.Any, t.Any] | None = None, + auth: Auth | tuple[str, str] | None = None, **config, ) -> bool: """ diff --git a/src/neo4j/_sync/driver.py b/src/neo4j/_sync/driver.py index 3b205a342..90db409cb 100644 --- a/src/neo4j/_sync/driver.py +++ b/src/neo4j/_sync/driver.py @@ -1025,7 +1025,7 @@ def verify_connectivity( bookmark_manager: ( BookmarkManager | BookmarkManager | None ) = ..., - auth: Auth | tuple[t.Any, t.Any] = ..., + auth: Auth | tuple[str, str] = ..., notifications_min_severity: ( T_NotificationMinimumSeverity | None ) = ..., @@ -1100,7 +1100,7 @@ def get_server_info( bookmark_manager: ( BookmarkManager | BookmarkManager | None ) = ..., - auth: Auth | tuple[t.Any, t.Any] = ..., + auth: Auth | tuple[str, str] = ..., notifications_min_severity: ( T_NotificationMinimumSeverity | None ) = ..., @@ -1183,7 +1183,7 @@ def supports_multi_db(self) -> bool: def verify_authentication( self, - auth: Auth | tuple[t.Any, t.Any] | None = None, + auth: Auth | tuple[str, str] | None = None, # all other arguments are experimental # they may be change or removed any time without prior notice session_connection_timeout: float = ..., @@ -1207,7 +1207,7 @@ def verify_authentication( def verify_authentication( self, - auth: Auth | tuple[t.Any, t.Any] | None = None, + auth: Auth | tuple[str, str] | None = None, **config, ) -> bool: """ diff --git a/src/neo4j/api.py b/src/neo4j/api.py index 8c93276c8..2346a4a20 100644 --- a/src/neo4j/api.py +++ b/src/neo4j/api.py @@ -163,7 +163,7 @@ def __eq__(self, other: t.Any) -> bool: AuthToken = Auth if t.TYPE_CHECKING: - _TAuth = t.Union[t.Tuple[t.Any, t.Any], Auth, None] + _TAuth = t.Union[t.Tuple[str, str], Auth, None] def basic_auth(user: str, password: str, realm: str | None = None) -> Auth: