| 1 |
# RemovedInDjango60Warning: Remove this entire module. |
| 2 |
|
| 3 |
import warnings |
| 4 |
|
| 5 |
from django.utils.deprecation import RemovedInDjango60Warning |
| 6 |
|
| 7 |
|
| 8 |
def is_iterable(x): |
| 9 |
"An implementation independent way of checking for iterables" |
| 10 |
warnings.warn( |
| 11 |
"django.utils.itercompat.is_iterable() is deprecated. " |
| 12 |
"Use isinstance(..., collections.abc.Iterable) instead.", |
| 13 |
RemovedInDjango60Warning, |
| 14 |
stacklevel=2, |
| 15 |
) |
| 16 |
try: |
| 17 |
iter(x) |
| 18 |
except TypeError: |
| 19 |
return False |
| 20 |
else: |
| 21 |
return True |