@@ -120,27 +120,18 @@ def __repr__(self) -> str:
120120
121121
122122class DeprecatedOption (Option [_O ]): # pragma: no cover
123- def __init__ (self , new_opt : Option [_O ], name : str ) -> None :
124- # copy over attrs
125- attrs = new_opt .__dict__ .copy ()
126- attrs .pop ("_current" , None )
127- self .__dict__ .update (new_opt .__dict__ )
128- # then set the ones needed here
129- self ._name = name
130- self ._new_opt = new_opt
123+ def __init__ (self , message : str , * args : Any , ** kwargs : Any ) -> None :
124+ self ._deprecation_message = message
125+ super ().__init__ (* args , ** kwargs )
131126
132- @property # type: ignore
133- def _current (self ) -> _O :
127+ @Option . current . getter # type: ignore
128+ def current (self ) -> _O :
134129 warn (
135- f" { self .name !r } has been renamed to { self . _new_opt . name !r } " ,
130+ self ._deprecation_message ,
136131 DeprecationWarning ,
137132 stacklevel = _frame_depth_in_module () + 1 ,
138133 )
139- return self ._new_opt .current
140-
141- @_current .setter
142- def _current (self , new : _O ) -> None :
143- self ._new_opt .current = new
134+ return super ().current
144135
145136
146137def _frame_depth_in_module () -> int :
0 commit comments