Skip to content

Commit 719fc0f

Browse files
authored
FIX: ruff checks in expressions/pytables (#60541)
* FIX: ruff checks in expressions/pytables * swap condition * more pre-commit
1 parent ca91dd4 commit 719fc0f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

pandas/core/computation/expressions.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def _evaluate_numexpr(op, op_str, left_op, right_op):
108108
try:
109109
result = ne.evaluate(
110110
f"left_value {op_str} right_value",
111-
local_dict={"left_value": left_value, "right_value": right_op},
111+
local_dict={"left_value": left_value, "right_value": right_value},
112112
casting="safe",
113113
)
114114
except TypeError:
@@ -257,7 +257,10 @@ def where(cond, left_op, right_op, use_numexpr: bool = True):
257257
Whether to try to use numexpr.
258258
"""
259259
assert _where is not None
260-
return _where(cond, left_op, right_op) if use_numexpr else _where_standard(cond, left_op, right_op)
260+
if use_numexpr:
261+
return _where(cond, left_op, right_op)
262+
else:
263+
return _where_standard(cond, left_op, right_op)
261264

262265

263266
def set_test_mode(v: bool = True) -> None:

pandas/core/computation/pytables.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,9 @@ def stringify(value):
274274
# string quoting
275275
return TermValue(conv_val, stringify(conv_val), "string")
276276
else:
277-
raise TypeError(f"Cannot compare {conv_val} of type {type(conv_val)} to {kind} column")
277+
raise TypeError(
278+
f"Cannot compare {conv_val} of type {type(conv_val)} to {kind} column"
279+
)
278280

279281
def convert_values(self) -> None:
280282
pass

0 commit comments

Comments
 (0)