File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change 133
133
# the `@deprecated` tags.
134
134
from typing_extensions import deprecated
135
135
else :
136
+ _impl = None
136
137
try :
137
138
# preferred import of deprecated
138
- from typing_extensions import deprecated
139
- except ModuleNotFoundError :
139
+ from typing_extensions import deprecated as _impl
140
+ except Exception :
140
141
try :
141
- # Python 3.12+
142
- from typing import deprecated
143
- except ImportError :
144
- # shim if both are unavailable that turn `deprecated` into a no-op
145
- def deprecated (msg = None , * , since = None ):
146
- def wrapper (obj ): return obj
147
- return wrapper
142
+ from typing import deprecated as _impl # Python 3.13+
143
+ except Exception :
144
+ _impl = None
145
+
146
+ def deprecated (msg = None , * , since = None ):
147
+ if _impl is None :
148
+ def _noop (obj ): return obj
149
+ return _noop
150
+ if since is not None :
151
+ try :
152
+ return _impl (msg , since = since )
153
+ except TypeError :
154
+ pass # older typing_extensions: no 'since' keyword
155
+ return _impl (msg )
148
156
149
157
150
158
def _check_required_kwargs (** kwargs ):
You can’t perform that action at this time.
0 commit comments