MCPcopy
hub / github.com/pandas-dev/pandas / _ensure_term

Function _ensure_term

pandas/io/pytables.py:173–191  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

171
172
173def _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
194incompatibility_doc: Final = """

Callers 5

read_hdfFunction · 0.85
selectMethod · 0.85
select_as_coordinatesMethod · 0.85
select_as_multipleMethod · 0.85
removeMethod · 0.85

Calls 2

maybe_expressionFunction · 0.90
TermClass · 0.50

Tested by

no test coverage detected