Skip to content

Commit 37ac4c1

Browse files
ref: use stdlib warnings module instead of a third party dependency (googleapis#1120)
1 parent 41aff04 commit 37ac4c1

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

google/cloud/spanner_dbapi/connection.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
from google.cloud.spanner_dbapi.cursor import Cursor
3232
from google.cloud.spanner_v1 import RequestOptions
3333
from google.cloud.spanner_v1.snapshot import Snapshot
34-
from deprecated import deprecated
3534

3635
from google.cloud.spanner_dbapi.exceptions import (
3736
InterfaceError,
@@ -187,10 +186,11 @@ def autocommit_dml_mode(self):
187186
return self._autocommit_dml_mode
188187

189188
@property
190-
@deprecated(
191-
reason="This method is deprecated. Use _spanner_transaction_started field"
192-
)
193189
def inside_transaction(self):
190+
warnings.warn(
191+
"This method is deprecated. Use _spanner_transaction_started field",
192+
DeprecationWarning,
193+
)
194194
return (
195195
self._transaction
196196
and not self._transaction.committed

google/cloud/spanner_dbapi/parse_utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
import datetime
1818
import decimal
1919
import re
20+
import warnings
2021

2122
import sqlparse
2223
from google.cloud import spanner_v1 as spanner
2324
from google.cloud.spanner_v1 import JsonObject
2425
from . import client_side_statement_parser
25-
from deprecated import deprecated
2626

2727
from .exceptions import Error
2828
from .parsed_statement import ParsedStatement, StatementType, Statement
@@ -179,14 +179,17 @@
179179
RE_PYFORMAT = re.compile(r"(%s|%\([^\(\)]+\)s)+", re.DOTALL)
180180

181181

182-
@deprecated(reason="This method is deprecated. Use _classify_stmt method")
183182
def classify_stmt(query):
184183
"""Determine SQL query type.
185184
:type query: str
186185
:param query: A SQL query.
187186
:rtype: str
188187
:returns: The query type name.
189188
"""
189+
warnings.warn(
190+
"This method is deprecated. Use _classify_stmt method", DeprecationWarning
191+
)
192+
190193
# sqlparse will strip Cloud Spanner comments,
191194
# still, special commenting styles, like
192195
# PostgreSQL dollar quoted comments are not

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
"sqlparse >= 0.4.4",
4444
"proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'",
4545
"protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
46-
"deprecated >= 1.2.14",
4746
"grpc-interceptor >= 0.15.4",
4847
]
4948
extras = {

0 commit comments

Comments
 (0)