Skip to content

Commit

Permalink
Import ABC from collections.abc
Browse files Browse the repository at this point in the history
  • Loading branch information
tirkarthi committed Jul 24, 2020
1 parent 506125a commit 2718f45
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions st2client/st2client/utils/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
"""

from __future__ import absolute_import
import collections
from six.moves.collections_abc import MutableSet

__all__ = [
'OrderedSet'
]


class OrderedSet(collections.MutableSet):
class OrderedSet(MutableSet):

def __init__(self, iterable=None):
self.end = end = []
Expand Down
5 changes: 3 additions & 2 deletions st2common/st2common/util/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@

from __future__ import absolute_import

import collections
import mongoengine
import six

from six.moves.collections_abc import Mapping


def mongodb_to_python_types(value):
# Convert MongoDB BaseDict and BaseList types to python dict and list types.
Expand All @@ -29,7 +30,7 @@ def mongodb_to_python_types(value):
# functions used to convert JSON/YAML objects/strings will errored. This is caused
# by the PR StackStorm/orquesta#191 which converts dict to collections.Mapping
# in YAQL related functions.
elif isinstance(value, collections.Mapping):
elif isinstance(value, Mapping):
value = dict(value)

# Recursively traverse the dict and list to convert values.
Expand Down
4 changes: 2 additions & 2 deletions st2common/st2common/util/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import os
import re
import sys
import collections
import functools

import six
from six.moves.collections_abc import Mapping

__all__ = [
'prefix_dict_keys',
Expand Down Expand Up @@ -137,7 +137,7 @@ def deep_update(d, u):
"""

for k, v in six.iteritems(u):
if isinstance(v, collections.Mapping):
if isinstance(v, Mapping):
r = deep_update(d.get(k, {}), v)
d[k] = r
else:
Expand Down
4 changes: 2 additions & 2 deletions st2common/st2common/util/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

import os
import re
import collections

import six

from six.moves.collections_abc import Iterable
from st2common.util import schema as util_schema
from st2common.constants.pack import MANIFEST_FILE_NAME
from st2common.constants.pack import PACK_REF_WHITELIST_REGEX
Expand Down Expand Up @@ -123,7 +123,7 @@ def validate_config_against_schema(config_schema, config_object, config_path,
except jsonschema.ValidationError as e:
attribute = getattr(e, 'path', [])

if isinstance(attribute, (tuple, list, collections.Iterable)):
if isinstance(attribute, (tuple, list, Iterable)):
attribute = [str(item) for item in attribute]
attribute = '.'.join(attribute)
else:
Expand Down
4 changes: 2 additions & 2 deletions st2common/st2common/util/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
"""

from __future__ import absolute_import
import collections
from six.moves.collections_abc import MutableSet

__all__ = [
'OrderedSet'
]


class OrderedSet(collections.MutableSet):
class OrderedSet(MutableSet):

def __init__(self, iterable=None):
self.end = end = []
Expand Down

0 comments on commit 2718f45

Please sign in to comment.