3
3
"""
4
4
5
5
import abc
6
+ from typing import Dict , Type
6
7
7
8
from pandas .core .computation .align import align_terms , reconstruct_object
8
9
from pandas .core .computation .ops import _mathops , _reductions
@@ -53,7 +54,7 @@ def convert(self) -> str:
53
54
"""
54
55
return printing .pprint_thing (self .expr )
55
56
56
- def evaluate (self ):
57
+ def evaluate (self ) -> object :
57
58
"""
58
59
Run the engine on the expression.
59
60
@@ -62,7 +63,7 @@ def evaluate(self):
62
63
63
64
Returns
64
65
-------
65
- obj : object
66
+ object
66
67
The result of the passed expression.
67
68
"""
68
69
if not self ._is_aligned :
@@ -101,12 +102,6 @@ class NumExprEngine(AbstractEngine):
101
102
102
103
has_neg_frac = True
103
104
104
- def __init__ (self , expr ):
105
- super ().__init__ (expr )
106
-
107
- def convert (self ) -> str :
108
- return str (super ().convert ())
109
-
110
105
def _evaluate (self ):
111
106
import numexpr as ne
112
107
@@ -128,14 +123,14 @@ class PythonEngine(AbstractEngine):
128
123
129
124
has_neg_frac = False
130
125
131
- def __init__ (self , expr ):
132
- super ().__init__ (expr )
133
-
134
126
def evaluate (self ):
135
127
return self .expr ()
136
128
137
- def _evaluate (self ):
129
+ def _evaluate (self ) -> None :
138
130
pass
139
131
140
132
141
- _engines = {"numexpr" : NumExprEngine , "python" : PythonEngine }
133
+ _engines : Dict [str , Type [AbstractEngine ]] = {
134
+ "numexpr" : NumExprEngine ,
135
+ "python" : PythonEngine ,
136
+ }
0 commit comments