@@ -51,13 +51,12 @@ class ComponentMeta(abc.ABCMeta):
51
51
52
52
# pylint: disable=arguments-differ
53
53
def __new__ (mcs , name , bases , attributes ):
54
- component = abc .ABCMeta .__new__ (mcs , name , bases , attributes )
55
54
module = attributes ["__module__" ].split ("." )[0 ]
56
55
if name == "Component" or module == "builtins" :
57
56
# Don't do the base component
58
57
# and the components loaded dynamically by load_component
59
58
# as it doesn't have the namespace.
60
- return component
59
+ return abc . ABCMeta . __new__ ( mcs , name , bases , attributes )
61
60
62
61
_namespace = attributes .get ("_namespace" , module )
63
62
ComponentRegistry .namespace_to_package [_namespace ] = module
@@ -66,7 +65,13 @@ def __new__(mcs, name, bases, attributes):
66
65
"_children_props"
67
66
)
68
67
69
- return component
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 )
70
75
71
76
72
77
def is_number (s ):
@@ -435,6 +440,8 @@ def _validate_deprecation(self):
435
440
436
441
ComponentType = typing .TypeVar ("ComponentType" , bound = Component )
437
442
443
+ ComponentTemplate = typing .TypeVar ("ComponentTemplate" )
444
+
438
445
439
446
# This wrapper adds an argument given to generated Component.__init__
440
447
# with the actual given parameters by the user as a list of string.
0 commit comments