Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DeprecationWarning when importing ABCs. #669

Merged
merged 6 commits into from
Apr 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions dash/development/base_component.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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):
Expand Down