@@ -226,7 +226,7 @@ def __init__(self, *args, **kargs):
226226 # self.fig_width = None
227227 # self.fig_height = None
228228
229- self .update (** kargs )
229+ self .update (kargs )
230230
231231 def __call__ (self , ** kargs ):
232232 """Call the template object can manipulate the rcParams that will be set."""
@@ -376,25 +376,25 @@ def clear(self):
376376 for attr in attrs :
377377 delattr (self , attr )
378378
379- def update (self , * args , ** kargs ): # pylint: disable=signature-differs
379+ def update (self , other ):
380380 """Update the template with new attributes from keyword arguments.
381381
382382 Up to one positional argument may be supplied
383383
384384 Keyword arguments may be supplied to set default parameters. Any Matplotlib rc parameter
385385 may be specified, with .'s replaced with _ and )_ replaced with __.
386386 """
387- if len ( args ) == 1 and isinstance ( args [ 0 ], Mapping ) :
388- super (). update ( args [ 0 ])
389- elif len ( args ) > 0 :
390- raise SyntaxError (
391- "Only one posotional argument which should be a Mapping subclass can be supplied toi update."
392- )
393- for k in kargs :
394- if k in dir ( self ) and not callable ( self . __getattr__ ( k )) :
395- self . __setattr__ ( k , kargs [ k ])
396- elif not k . startswith ( "_" ):
397- self . __setattr__ ( "template_" + k , kargs [ k ] )
387+ match other :
388+ case Mapping ():
389+ for k , val in other . items () :
390+ if k in dir ( self ) and not callable ( self . __getattr__ ( k )):
391+ self . __setattr__ ( k , val )
392+ elif not k . startswith ( "_" ):
393+ self . __setattr__ ( "template_" + k , val )
394+ case _ :
395+ raise SyntaxError (
396+ "Only one posotional argument which should be a Mapping subclass can be supplied toi update."
397+ )
398398
399399 def new_figure (self , figure = False , ** kargs ):
400400 """Create a new figure.
0 commit comments