@@ -65,26 +65,26 @@ def set_numexpr_threads(n=None) -> None:
6565 ne .set_num_threads (n )
6666
6767
68- def _evaluate_standard (op , op_str , a , b ):
68+ def _evaluate_standard (op , op_str , left_op , right_op ):
6969 """
7070 Standard evaluation.
7171 """
7272 if _TEST_MODE :
7373 _store_test_result (False )
74- return op (a , b )
74+ return op (left_op , right_op )
7575
7676
77- def _can_use_numexpr (op , op_str , a , b , dtype_check ) -> bool :
77+ def _can_use_numexpr (op , op_str , left_op , right_op , dtype_check ) -> bool :
7878 """return a boolean if we WILL be using numexpr"""
7979 if op_str is not None :
8080 # required min elements (otherwise we are adding overhead)
81- if a .size > _MIN_ELEMENTS :
81+ if left_op .size > _MIN_ELEMENTS :
8282 # check for dtype compatibility
8383 dtypes : set [str ] = set ()
84- for o in [a , b ]:
84+ for operand in [left_op , right_op ]:
8585 # ndarray and Series Case
86- if hasattr (o , "dtype" ):
87- dtypes |= {o .dtype .name }
86+ if hasattr (operand , "dtype" ):
87+ dtypes |= {operand .dtype .name }
8888
8989 # allowed are a superset
9090 if not len (dtypes ) or _ALLOWED_DTYPES [dtype_check ] >= dtypes :
@@ -93,43 +93,43 @@ def _can_use_numexpr(op, op_str, a, b, dtype_check) -> bool:
9393 return False
9494
9595
96- def _evaluate_numexpr (op , op_str , a , b ):
96+ def _evaluate_numexpr (op , op_str , left_op , right_op ):
9797 result = None
9898
99- if _can_use_numexpr (op , op_str , a , b , "evaluate" ):
99+ if _can_use_numexpr (op , op_str , left_op , right_op , "evaluate" ):
100100 is_reversed = op .__name__ .strip ("_" ).startswith ("r" )
101101 if is_reversed :
102102 # we were originally called by a reversed op method
103- a , b = b , a
103+ left_op , right_op = right_op , left_op
104104
105- a_value = a
106- b_value = b
105+ left_value = left_op
106+ right_value = right_op
107107
108108 try :
109109 result = ne .evaluate (
110- f"a_value { op_str } b_value " ,
111- local_dict = {"a_value" : a_value , "b_value" : b_value },
110+ f"left_value { op_str } right_value " ,
111+ local_dict = {"a_value" : left_value , "b_value" : right_value },
112112 casting = "safe" ,
113113 )
114114 except TypeError :
115115 # numexpr raises eg for array ** array with integers
116116 # (https://github.com/pydata/numexpr/issues/379)
117117 pass
118118 except NotImplementedError :
119- if _bool_arith_fallback (op_str , a , b ):
119+ if _bool_arith_fallback (op_str , left_op , right_op ):
120120 pass
121121 else :
122122 raise
123123
124124 if is_reversed :
125125 # reverse order to original for fallback
126- a , b = b , a
126+ left_op , right_op = right_op , left_op
127127
128128 if _TEST_MODE :
129129 _store_test_result (result is not None )
130130
131131 if result is None :
132- result = _evaluate_standard (op , op_str , a , b )
132+ result = _evaluate_standard (op , op_str , left_op , right_op )
133133
134134 return result
135135
@@ -224,24 +224,24 @@ def _bool_arith_fallback(op_str, a, b) -> bool:
224224 return False
225225
226226
227- def evaluate (op , a , b , use_numexpr : bool = True ):
227+ def evaluate (op , left_op , right_op , use_numexpr : bool = True ):
228228 """
229229 Evaluate and return the expression of the op on a and b.
230230
231231 Parameters
232232 ----------
233233 op : the actual operand
234- a : left operand
235- b : right operand
234+ left_op : left operand
235+ right_op : right operand
236236 use_numexpr : bool, default True
237237 Whether to try to use numexpr.
238238 """
239239 op_str = _op_str_mapping [op ]
240240 if op_str is not None :
241241 if use_numexpr :
242242 # error: "None" not callable
243- return _evaluate (op , op_str , a , b ) # type: ignore[misc]
244- return _evaluate_standard (op , op_str , a , b )
243+ return _evaluate (op , op_str , left_op , right_op ) # type: ignore[misc]
244+ return _evaluate_standard (op , op_str , left_op , right_op )
245245
246246
247247def where (cond , a , b , use_numexpr : bool = True ):
0 commit comments