Raise warning if a deprecated class is used in an isinstance check.
(old_name, new_class, next_version,
instancecheck=True)
| 107 | |
| 108 | |
| 109 | def _deprecate_class(old_name, new_class, next_version, |
| 110 | instancecheck=True): |
| 111 | """ |
| 112 | Raise warning if a deprecated class is used in an isinstance check. |
| 113 | """ |
| 114 | class _DeprecatedMeta(type): |
| 115 | def __instancecheck__(self, other): |
| 116 | warnings.warn( |
| 117 | _DEPR_MSG.format(old_name, next_version, new_class.__name__), |
| 118 | FutureWarning, |
| 119 | stacklevel=2 |
| 120 | ) |
| 121 | return isinstance(other, new_class) |
| 122 | |
| 123 | return _DeprecatedMeta(old_name, (new_class,), {}) |
| 124 | |
| 125 | |
| 126 | def _is_iterable(obj): |
nothing calls this directly
no test coverage detected