12
12
13
13
from pandas .core .dtypes .common import is_list_like , is_scalar
14
14
15
- from pandas .core .base import StringMixin
16
15
import pandas .core .common as com
17
16
from pandas .core .computation .common import _ensure_decoded , _result_type_many
18
17
from pandas .core .computation .scope import _DEFAULT_GLOBALS
@@ -46,7 +45,7 @@ def __init__(self, name, is_local):
46
45
super ().__init__ (msg .format (name ))
47
46
48
47
49
- class Term ( StringMixin ) :
48
+ class Term :
50
49
51
50
def __new__ (cls , name , env , side = None , encoding = None ):
52
51
klass = Constant if not isinstance (name , str ) else cls
@@ -67,7 +66,7 @@ def __init__(self, name, env, side=None, encoding=None):
67
66
def local_name (self ):
68
67
return self .name .replace (_LOCAL_TAG , '' )
69
68
70
- def __str__ (self ):
69
+ def __repr__ (self ):
71
70
return pprint_thing (self .name )
72
71
73
72
def __call__ (self , * args , ** kwargs ):
@@ -166,16 +165,14 @@ def _resolve_name(self):
166
165
def name (self ):
167
166
return self .value
168
167
169
- def __str__ (self ):
170
- # in python 2 str() of float
171
- # can truncate shorter than repr()
168
+ def __repr__ (self ):
172
169
return repr (self .name )
173
170
174
171
175
172
_bool_op_map = {'not' : '~' , 'and' : '&' , 'or' : '|' }
176
173
177
174
178
- class Op ( StringMixin ) :
175
+ class Op :
179
176
180
177
"""Hold an operator of arbitrary arity
181
178
"""
@@ -188,7 +185,7 @@ def __init__(self, op, operands, *args, **kwargs):
188
185
def __iter__ (self ):
189
186
return iter (self .operands )
190
187
191
- def __str__ (self ):
188
+ def __repr__ (self ):
192
189
"""Print a generic n-ary operator and its operands using infix
193
190
notation"""
194
191
# recurse over the operands
@@ -506,7 +503,7 @@ def __call__(self, env):
506
503
operand = self .operand (env )
507
504
return self .func (operand )
508
505
509
- def __str__ (self ):
506
+ def __repr__ (self ):
510
507
return pprint_thing ('{0}({1})' .format (self .op , self .operand ))
511
508
512
509
@property
@@ -531,7 +528,7 @@ def __call__(self, env):
531
528
with np .errstate (all = 'ignore' ):
532
529
return self .func .func (* operands )
533
530
534
- def __str__ (self ):
531
+ def __repr__ (self ):
535
532
operands = map (str , self .operands )
536
533
return pprint_thing ('{0}({1})' .format (self .op , ',' .join (operands )))
537
534
0 commit comments