Ensure that the where is a Term or a list of Term. This makes sure that we are capturing the scope of variables that are passed create the terms here with a frame_level=2 (we are 2 levels down)
(where, scope_level: int)
| 171 | |
| 172 | |
| 173 | def _ensure_term(where, scope_level: int): |
| 174 | """ |
| 175 | Ensure that the where is a Term or a list of Term. |
| 176 | |
| 177 | This makes sure that we are capturing the scope of variables that are |
| 178 | passed create the terms here with a frame_level=2 (we are 2 levels down) |
| 179 | """ |
| 180 | # only consider list/tuple here as an ndarray is automatically a coordinate |
| 181 | # list |
| 182 | level = scope_level + 1 |
| 183 | if isinstance(where, (list, tuple)): |
| 184 | where = [ |
| 185 | Term(term, scope_level=level + 1) if maybe_expression(term) else term |
| 186 | for term in where |
| 187 | if term is not None |
| 188 | ] |
| 189 | elif maybe_expression(where): |
| 190 | where = Term(where, scope_level=level) |
| 191 | return where if where is None or len(where) else None |
| 192 | |
| 193 | |
| 194 | incompatibility_doc: Final = """ |
no test coverage detected