Skip to content

Commit 26980e1

Browse files
authored
Typing: fix auth token shorthand (#1121)
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, ...)`.
1 parent 31318ff commit 26980e1

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/neo4j/_async/driver.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ async def verify_connectivity(
10241024
bookmark_manager: (
10251025
AsyncBookmarkManager | BookmarkManager | None
10261026
) = ...,
1027-
auth: Auth | tuple[t.Any, t.Any] = ...,
1027+
auth: Auth | tuple[str, str] = ...,
10281028
notifications_min_severity: (
10291029
T_NotificationMinimumSeverity | None
10301030
) = ...,
@@ -1099,7 +1099,7 @@ async def get_server_info(
10991099
bookmark_manager: (
11001100
AsyncBookmarkManager | BookmarkManager | None
11011101
) = ...,
1102-
auth: Auth | tuple[t.Any, t.Any] = ...,
1102+
auth: Auth | tuple[str, str] = ...,
11031103
notifications_min_severity: (
11041104
T_NotificationMinimumSeverity | None
11051105
) = ...,
@@ -1182,7 +1182,7 @@ async def supports_multi_db(self) -> bool:
11821182

11831183
async def verify_authentication(
11841184
self,
1185-
auth: Auth | tuple[t.Any, t.Any] | None = None,
1185+
auth: Auth | tuple[str, str] | None = None,
11861186
# all other arguments are experimental
11871187
# they may be change or removed any time without prior notice
11881188
session_connection_timeout: float = ...,
@@ -1206,7 +1206,7 @@ async def verify_authentication(
12061206

12071207
async def verify_authentication(
12081208
self,
1209-
auth: Auth | tuple[t.Any, t.Any] | None = None,
1209+
auth: Auth | tuple[str, str] | None = None,
12101210
**config,
12111211
) -> bool:
12121212
"""

src/neo4j/_sync/driver.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ def verify_connectivity(
10231023
bookmark_manager: (
10241024
BookmarkManager | BookmarkManager | None
10251025
) = ...,
1026-
auth: Auth | tuple[t.Any, t.Any] = ...,
1026+
auth: Auth | tuple[str, str] = ...,
10271027
notifications_min_severity: (
10281028
T_NotificationMinimumSeverity | None
10291029
) = ...,
@@ -1098,7 +1098,7 @@ def get_server_info(
10981098
bookmark_manager: (
10991099
BookmarkManager | BookmarkManager | None
11001100
) = ...,
1101-
auth: Auth | tuple[t.Any, t.Any] = ...,
1101+
auth: Auth | tuple[str, str] = ...,
11021102
notifications_min_severity: (
11031103
T_NotificationMinimumSeverity | None
11041104
) = ...,
@@ -1181,7 +1181,7 @@ def supports_multi_db(self) -> bool:
11811181

11821182
def verify_authentication(
11831183
self,
1184-
auth: Auth | tuple[t.Any, t.Any] | None = None,
1184+
auth: Auth | tuple[str, str] | None = None,
11851185
# all other arguments are experimental
11861186
# they may be change or removed any time without prior notice
11871187
session_connection_timeout: float = ...,
@@ -1205,7 +1205,7 @@ def verify_authentication(
12051205

12061206
def verify_authentication(
12071207
self,
1208-
auth: Auth | tuple[t.Any, t.Any] | None = None,
1208+
auth: Auth | tuple[str, str] | None = None,
12091209
**config,
12101210
) -> bool:
12111211
"""

src/neo4j/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def __eq__(self, other: t.Any) -> bool:
163163
AuthToken = Auth
164164

165165
if t.TYPE_CHECKING:
166-
_TAuth = t.Union[t.Tuple[t.Any, t.Any], Auth, None]
166+
_TAuth = t.Union[t.Tuple[str, str], Auth, None]
167167

168168

169169
def basic_auth(user: str, password: str, realm: str | None = None) -> Auth:

0 commit comments

Comments
 (0)