@@ -328,31 +328,6 @@ def _not_in(x, y):
328
328
_binary_ops_dict .update (d )
329
329
330
330
331
- def _cast_inplace (terms , acceptable_dtypes , dtype ) -> None :
332
- """
333
- Cast an expression inplace.
334
-
335
- Parameters
336
- ----------
337
- terms : Op
338
- The expression that should cast.
339
- acceptable_dtypes : list of acceptable numpy.dtype
340
- Will not cast if term's dtype in this list.
341
- dtype : str or numpy.dtype
342
- The dtype to cast to.
343
- """
344
- dt = np .dtype (dtype )
345
- for term in terms :
346
- if term .type in acceptable_dtypes :
347
- continue
348
-
349
- try :
350
- new_value = term .value .astype (dt )
351
- except AttributeError :
352
- new_value = dt .type (term .value )
353
- term .update (new_value )
354
-
355
-
356
331
def is_term (obj ) -> bool :
357
332
return isinstance (obj , Term )
358
333
@@ -509,32 +484,6 @@ def _disallow_scalar_only_bool_ops(self) -> None:
509
484
raise NotImplementedError ("cannot evaluate scalar only bool ops" )
510
485
511
486
512
- class Div (BinOp ):
513
- """
514
- Div operator to special case casting.
515
-
516
- Parameters
517
- ----------
518
- lhs, rhs : Term or Op
519
- The Terms or Ops in the ``/`` expression.
520
- """
521
-
522
- def __init__ (self , lhs , rhs ) -> None :
523
- super ().__init__ ("/" , lhs , rhs )
524
-
525
- if not is_numeric_dtype (lhs .return_type ) or not is_numeric_dtype (
526
- rhs .return_type
527
- ):
528
- raise TypeError (
529
- f"unsupported operand type(s) for { self .op } : "
530
- f"'{ lhs .return_type } ' and '{ rhs .return_type } '"
531
- )
532
-
533
- # do not upcast float32s to float64 un-necessarily
534
- acceptable_dtypes = [np .float32 , np .float64 ]
535
- _cast_inplace (com .flatten (self ), acceptable_dtypes , np .float64 )
536
-
537
-
538
487
UNARY_OPS_SYMS = ("+" , "-" , "~" , "not" )
539
488
_unary_ops_funcs = (operator .pos , operator .neg , operator .invert , operator .invert )
540
489
_unary_ops_dict = dict (zip (UNARY_OPS_SYMS , _unary_ops_funcs ))
0 commit comments