summaryrefslogtreecommitdiff
path: root/oslo_db
diff options
context:
space:
mode:
authorlikui <likui@yovole.com>2021-05-11 09:36:51 +0800
committerlikui <likui@yovole.com>2021-05-11 09:37:44 +0800
commit8064e184059385a44d7834dc5924e14ae6ed6240 (patch)
treeeca25d6f09a07be758cbc963a93b6f614f621d79 /oslo_db
parent78d12d76969730d25f81b069b1b40730b91bd62f (diff)
downloadoslo-db-8064e184059385a44d7834dc5924e14ae6ed6240.tar.gz
Replace getargspec with getfullargspec
getargspec() is deprecated since py3 [1] https://docs.python.org/3/library/inspect.html#inspect.getargspec Change-Id: Ie1513f9b4911e54ce6714074eb2dc4052323ef42
Diffstat (limited to 'oslo_db')
-rw-r--r--oslo_db/sqlalchemy/enginefacade.py4
-rw-r--r--oslo_db/sqlalchemy/utils.py20
2 files changed, 2 insertions, 22 deletions
diff --git a/oslo_db/sqlalchemy/enginefacade.py b/oslo_db/sqlalchemy/enginefacade.py
index 6a13c70..1373d82 100644
--- a/oslo_db/sqlalchemy/enginefacade.py
+++ b/oslo_db/sqlalchemy/enginefacade.py
@@ -12,6 +12,7 @@
import contextlib
import functools
+import inspect
import operator
import threading
import warnings
@@ -26,7 +27,6 @@ from oslo_db import exception
from oslo_db import options
from oslo_db.sqlalchemy import engines
from oslo_db.sqlalchemy import orm
-from oslo_db.sqlalchemy import utils
from oslo_db import warning
@@ -997,7 +997,7 @@ class _TransactionContextManager(object):
def __call__(self, fn):
"""Decorate a function."""
- argspec = utils.getargspec(fn)
+ argspec = inspect.getfullargspec(fn)
if argspec.args[0] == 'self' or argspec.args[0] == 'cls':
context_index = 1
else:
diff --git a/oslo_db/sqlalchemy/utils.py b/oslo_db/sqlalchemy/utils.py
index d1499f0..2babb18 100644
--- a/oslo_db/sqlalchemy/utils.py
+++ b/oslo_db/sqlalchemy/utils.py
@@ -19,7 +19,6 @@
import collections
from collections import abc
import contextlib
-import inspect as pyinspect
import itertools
import logging
import re
@@ -1184,25 +1183,6 @@ def suspend_fk_constraints_for_col_alter(
)
-def getargspec(fn):
- """Inspects a function for its argspec.
-
- This is to handle a difference between py2/3. The Python 2.x getargspec
- call is deprecated in Python 3.x, with the suggestion to use the signature
- call instead.
-
- To keep compatibility with the results, while avoiding deprecation
- warnings, this instead will use the getfullargspec instead.
-
- :param fn: The function to inspect.
- :returns: The argspec for the function.
- """
- if hasattr(pyinspect, 'getfullargspec'):
- return pyinspect.getfullargspec(fn)
-
- return pyinspect.getargspec(fn)
-
-
class NonCommittingConnectable(object):
"""A ``Connectable`` substitute which rolls all operations back.