@@ -126,8 +126,8 @@ def handle_axis_parameter(init_func):
126126 Notes
127127 -----
128128 If the wrapped constructor defines *axis* as its first argument, the
129- parameter is preserved. Otherwise, it is safely removed from positional
130- or keyword arguments .
129+ parameter is preserved when present . Otherwise, the value `None` is injected
130+ as the first argument .
131131
132132 Examples
133133 --------
@@ -139,14 +139,12 @@ def handle_axis_parameter(init_func):
139139 """
140140 @wraps (init_func )
141141 def wrapper (self , * args , ** kwargs ):
142- sig = inspect .signature (init_func )
143- params = list (sig .parameters .values ())
144- if params and params [1 ].name == "axis" :
142+ # If the first argument is a ScaleBase (axis), pass as is.
143+ if args and isinstance (args [0 ], ScaleBase ):
145144 return init_func (self , * args , ** kwargs )
146- if args :
147- args = args [1 :]
148- kwargs .pop ("axis" , None )
149- return init_func (self , * args , ** kwargs )
145+ else :
146+ # Inject None as axis parameter
147+ return init_func (self , None , * args , ** kwargs )
150148 return wrapper
151149
152150
@@ -801,14 +799,6 @@ def register_scale(scale_class):
801799 scale_class : subclass of `ScaleBase`
802800 The scale to register.
803801 """
804- sig = inspect .signature (scale_class .__init__ )
805- if 'axis' in sig .parameters :
806- warnings .warn (
807- f"The scale class { scale_class .__name__ } still uses the 'axis' "
808- "parameter in its constructor. Consider refactoring it to remove "
809- "this dependency." ,
810- DeprecationWarning
811- )
812802 _scale_mapping [scale_class .name ] = scale_class
813803
814804
3ABC
code>
0 commit comments