Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Commit 17a2f47

Browse files
committed
feat: Multiplexed sessions - Add some more type hints.
Signed-off-by: Taylor Curran <taylor.curran@improving.com>
1 parent 9c3db74 commit 17a2f47

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

google/cloud/spanner_v1/database.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import copy
1818
import functools
19+
from typing import Optional
1920

2021
import grpc
2122
import logging
@@ -1305,8 +1306,8 @@ def __init__(
13051306
**kw,
13061307
):
13071308
self._database: Database = database
1308-
self._session: Session = None
1309-
self._batch: Batch = None
1309+
self._session: Optional[Session] = None
1310+
self._batch: Optional[Batch] = None
13101311

13111312
if request_options is None:
13121313
self._request_options = RequestOptions()
@@ -1381,7 +1382,7 @@ class MutationGroupsCheckout(object):
13811382

13821383
def __init__(self, database):
13831384
self._database: Database = database
1384-
self._session: Session = None
1385+
self._session: Optional[Session] = None
13851386

13861387
def __enter__(self):
13871388
"""Begin ``with`` block."""
@@ -1421,7 +1422,7 @@ class SnapshotCheckout(object):
14211422

14221423
def __init__(self, database, **kw):
14231424
self._database: Database = database
1424-
self._session: Session = None
1425+
self._session: Optional[Session] = None
14251426
self._kw: dict = kw
14261427

14271428
def __enter__(self):
@@ -1464,11 +1465,14 @@ def __init__(
14641465
session_id=None,
14651466
transaction_id=None,
14661467
):
1467-
self._database = database
1468-
self._session_id = session_id
1469-
self._session = None
1470-
self._snapshot = None
1471-
self._transaction_id = transaction_id
1468+
self._database: Database = database
1469+
1470+
self._session_id: Optional[str] = session_id
1471+
self._transaction_id: Optional[bytes] = transaction_id
1472+
1473+
self._session: Optional[Session] = None
1474+
self._snapshot: Optional[Snapshot] = None
1475+
14721476
self._read_timestamp = read_timestamp
14731477
self._exact_staleness = exact_staleness
14741478

0 commit comments

Comments
 (0)