diff --git a/dash/development/base_component.py b/dash/development/base_component.py index d4e30dea39..01f8189d3e 100644 --- a/dash/development/base_component.py +++ b/dash/development/base_component.py @@ -1,12 +1,12 @@ -import collections import abc import inspect import sys - import six from .._utils import patch_collections_abc +MutableSequence = patch_collections_abc('MutableSequence') + # pylint: disable=no-init,too-few-public-methods class ComponentRegistry: @@ -53,8 +53,7 @@ def is_number(s): def _check_if_has_indexable_children(item): if (not hasattr(item, 'children') or (not isinstance(item.children, Component) and - not isinstance(item.children, (tuple, - collections.MutableSequence)))): + not isinstance(item.children, (tuple, MutableSequence)))): raise KeyError @@ -153,7 +152,7 @@ def _get_set_or_delete(self, id, operation, new_item=None): pass # if children is like a list - if isinstance(self.children, (tuple, collections.MutableSequence)): + if isinstance(self.children, (tuple, MutableSequence)): for i, item in enumerate(self.children): # If the item itself is the one we're looking for if getattr(item, 'id', None) == id: @@ -229,7 +228,7 @@ def traverse_with_paths(self): yield "\n".join(["[*] " + children_string, p]), t # children is a list of components - elif isinstance(children, (tuple, collections.MutableSequence)): + elif isinstance(children, (tuple, MutableSequence)): for idx, i in enumerate(children): list_path = "[{:d}] {:s} {}".format( idx, @@ -262,7 +261,7 @@ def __len__(self): elif isinstance(self.children, Component): length = 1 length += len(self.children) - elif isinstance(self.children, (tuple, collections.MutableSequence)): + elif isinstance(self.children, (tuple, MutableSequence)): for c in self.children: length += 1 if isinstance(c, Component):