summaryrefslogtreecommitdiff
path: root/oslo_db/sqlalchemy/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'oslo_db/sqlalchemy/utils.py')
-rw-r--r--oslo_db/sqlalchemy/utils.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/oslo_db/sqlalchemy/utils.py b/oslo_db/sqlalchemy/utils.py
index 02992f0..b7e101e 100644
--- a/oslo_db/sqlalchemy/utils.py
+++ b/oslo_db/sqlalchemy/utils.py
@@ -17,12 +17,7 @@
# under the License.
import collections
-# TODO(smcginnis) update this once six has support for collections.abc
-# (https://github.com/benjaminp/six/pull/241) or clean up once we drop py2.7.
-try:
- from collections.abc import Iterable
-except ImportError:
- from collections import Iterable
+from collections import abc
import contextlib
import inspect as pyinspect
import itertools
@@ -32,7 +27,6 @@ import re
from alembic.migration import MigrationContext
from alembic.operations import Operations
from oslo_utils import timeutils
-import six
import sqlalchemy
from sqlalchemy import Boolean
from sqlalchemy import CheckConstraint
@@ -286,7 +280,7 @@ def paginate_query(query, model, limit, sort_keys, marker=None,
def to_list(x, default=None):
if x is None:
return default
- if not isinstance(x, Iterable) or isinstance(x, six.string_types):
+ if not isinstance(x, abc.Iterable) or isinstance(x, str):
return [x]
elif isinstance(x, list):
return x
@@ -941,7 +935,7 @@ class DialectFunctionDispatcher(object):
def _url_from_target(self, target):
if isinstance(target, Connectable):
return target.engine.url
- elif isinstance(target, six.string_types):
+ elif isinstance(target, str):
if "://" not in target:
target_url = sa_url.make_url("%s://" % target)
else: