Determine if the object is an iterable sequence and is not a string.
(obj: Any)
| 143 | |
| 144 | |
| 145 | def issequenceiterable(obj: Any) -> bool: |
| 146 | """ |
| 147 | Determine if the object is an iterable sequence and is not a string. |
| 148 | """ |
| 149 | try: |
| 150 | if hasattr(obj, "ndim") and obj.ndim == 0: |
| 151 | return False # a 0-d tensor is not iterable |
| 152 | except Exception: |
| 153 | return False |
| 154 | return isinstance(obj, Iterable) and not isinstance(obj, (str, bytes)) |
| 155 | |
| 156 | |
| 157 | def is_immutable(obj: Any) -> bool: |
no outgoing calls
no test coverage detected
searching dependent graphs…