@@ -174,13 +174,13 @@ def __init__(self, axes, loc, label=None,
174174 ("_get_gridline" , "gridline" ),
175175 ("_get_text1" , "label1" ),
176176 ("_get_text2" , "label2" )]:
177- if getattr ( self , meth ) != getattr ( Tick , meth ). __get__ ( self ):
178- cbook . warn_deprecated (
179- "3.3" , message = f"Relying on { meth } to initialize "
180- f"Tick. { attr } is deprecated since %(since)s and will not "
181- f"work %(removal)s; please directly set the attribute in "
182- "the subclass' __init__ instead." )
183- setattr (self , attr , getattr ( self , meth ) ())
177+ overridden_method = cbook . _deprecate_method_override (
178+ getattr ( __class__ , meth ), self , since = "3.3" , message = "Relying "
179+ f" on { meth } to initialize Tick. { attr } is deprecated since "
180+ f" %(since)s and will not work %(removal)s; please directly "
181+ f" set the attribute in the subclass' __init__ instead." )
182+ if overridden_method :
183+ setattr (self , attr , overridden_method ())
184184 for artist in [self .tick1line , self .tick2line , self .gridline ,
185185 self .label1 , self .label2 ]:
186186 self ._set_artist_props (artist )
0 commit comments