Skip to content

Commit

Permalink
Use abc.ABCMeta as metaclass base for component as MutableMapping.
Browse files Browse the repository at this point in the history
  • Loading branch information
T4rk1n committed Oct 31, 2018
1 parent b29fa0a commit 1aac5b3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dash/development/base_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
import os
import inspect
import keyword
import abc
import six


class ComponentRegistry(type):
class ComponentRegistry(abc.ABCMeta):
"""Just importing a component lib will make it be loaded on the index"""

component_registry = set()

def __new__(mcs, name, bases, attributes):
component = type.__new__(mcs, name, bases, attributes)
component = abc.ABCMeta.__new__(mcs, name, bases, attributes)
if name == 'Component':
# Don't do the base component
return component
Expand Down Expand Up @@ -72,7 +73,7 @@ def wrapper(*args, **kwargs):


@six.add_metaclass(ComponentRegistry)
class Component:
class Component(collections.MutableMapping):
class _UNDEFINED(object):
def __repr__(self):
return 'undefined'
Expand Down

0 comments on commit 1aac5b3

Please sign in to comment.