@@ -52,11 +52,20 @@ class ComponentMeta(abc.ABCMeta):
52
52
# pylint: disable=arguments-differ
53
53
def __new__ (mcs , name , bases , attributes ):
54
54
module = attributes ["__module__" ].split ("." )[0 ]
55
+
56
+ if attributes .get ("_explicitize_dash_init" , False ):
57
+ # We only want to patch the new generated component without
58
+ # the `@_explicitize_args` decorator for mypy support
59
+ # See issue: https://github.com/plotly/dash/issues/3226
60
+ attributes ["__init__" ] = _explicitize_args (attributes ["__init__" ])
61
+
62
+ _component = abc .ABCMeta .__new__ (mcs , name , bases , attributes )
63
+
55
64
if name == "Component" or module == "builtins" :
56
- # Don't do the base component
65
+ # Don't add to the registry the base component
57
66
# and the components loaded dynamically by load_component
58
67
# as it doesn't have the namespace.
59
- return abc . ABCMeta . __new__ ( mcs , name , bases , attributes )
68
+ return _component
60
69
61
70
_namespace = attributes .get ("_namespace" , module )
62
71
ComponentRegistry .namespace_to_package [_namespace ] = module
@@ -65,13 +74,7 @@ def __new__(mcs, name, bases, attributes):
65
74
"_children_props"
66
75
)
67
76
68
- if attributes .get ("_explicitize_dash_init" , False ):
69
- # We only want to patch the new generated component without
70
- # the `@_explicitize_args` decorator for mypy support
71
- # See issue: https://github.com/plotly/dash/issues/3226
72
- attributes ["__init__" ] = _explicitize_args (attributes ["__init__" ])
73
-
74
- return abc .ABCMeta .__new__ (mcs , name , bases , attributes )
77
+ return _component
75
78
76
79
77
80
def is_number (s ):
0 commit comments