@@ -2063,7 +2063,7 @@ def __init__(self, plotly_name, **kwargs):
2063
2063
"""
2064
2064
# Validate inputs
2065
2065
# ---------------
2066
- self ._raise_on_invalid_property_error ( * kwargs . keys () )
2066
+ self ._process_kwargs ( ** kwargs )
2067
2067
2068
2068
# Store params
2069
2069
# ------------
@@ -2107,6 +2107,12 @@ def __init__(self, plotly_name, **kwargs):
2107
2107
# type: Dict[Tuple[Tuple[Union[str, int]]], List[Callable]]
2108
2108
self ._change_callbacks = {}
2109
2109
2110
+ def _process_kwargs (self , ** kwargs ):
2111
+ """
2112
+ Process any extra kwargs that are not predefined as constructor params
2113
+ """
2114
+ self ._raise_on_invalid_property_error (* kwargs .keys ())
2115
+
2110
2116
@property
2111
2117
def plotly_name (self ):
2112
2118
"""
@@ -3145,26 +3151,38 @@ def __init__(self, plotly_name, **kwargs):
3145
3151
# ---------------
3146
3152
assert plotly_name == 'layout'
3147
3153
3148
- # Compute invalid kwargs
3149
- # ----------------------
3150
- # Pass to parent for error handling
3151
- invalid_kwargs = {
3152
- k : v
3153
- for k , v in kwargs .items ()
3154
- if not self ._subplotid_prop_re .fullmatch (k )
3155
- }
3156
- super ().__init__ (plotly_name , ** invalid_kwargs )
3154
+ # Call superclass constructor
3155
+ # ---------------------------
3156
+ super ().__init__ (plotly_name )
3157
3157
3158
3158
# Initialize _subplotid_props
3159
3159
# ---------------------------
3160
3160
# This is a set storing the names of the layout's dynamic subplot
3161
3161
# properties
3162
3162
self ._subplotid_props = set ()
3163
3163
3164
- # Process subplot properties
3165
- # --------------------------
3166
- # The remaining kwargs are valid subplot properties
3167
- for prop , value in kwargs .items ():
3164
+ # Process kwargs
3165
+ # --------------
3166
+ self ._process_kwargs (** kwargs )
3167
+
3168
+ def _process_kwargs (self , ** kwargs ):
3169
+ """
3170
+ Process any extra kwargs that are not predefined as constructor params
3171
+ """
3172
+ unknown_kwargs = {
3173
+ k : v
3174
+ for k , v in kwargs .items ()
3175
+ if not self ._subplotid_prop_re .fullmatch (k )
3176
+ }
3177
+ super ()._process_kwargs (** unknown_kwargs )
3178
+
3179
+ subplot_kwargs = {
3180
+ k : v
3181
+ for k , v in kwargs .items ()
3182
+ if self ._subplotid_prop_re .fullmatch (k )
3183
+ }
3184
+
3185
+ for prop , value in subplot_kwargs .items ():
3168
3186
self ._set_subplotid_prop (prop , value )
3169
3187
3170
3188
def _set_subplotid_prop (self , prop , value ):
0 commit comments