13
13
14
14
import pandas as pd
15
15
import pandas .core .common as com
16
- from pandas .core .computation import expr , ops
16
+ from pandas .core .computation import expr , ops , scope as _scope
17
17
from pandas .core .computation .common import _ensure_decoded
18
18
from pandas .core .computation .expr import BaseExprVisitor
19
19
from pandas .core .computation .ops import UndefinedVariableError , is_term
20
20
21
21
from pandas .io .formats .printing import pprint_thing , pprint_thing_encoded
22
22
23
23
24
- class Scope (expr .Scope ):
24
+ class Scope (_scope .Scope ):
25
25
__slots__ = ("queryables" ,)
26
26
27
- def __init__ (self , level , global_dict = None , local_dict = None , queryables = None ):
27
+ def __init__ (self , level : int , global_dict = None , local_dict = None , queryables = None ):
28
28
super ().__init__ (level + 1 , global_dict = global_dict , local_dict = local_dict )
29
29
self .queryables = queryables or dict ()
30
30
@@ -40,6 +40,7 @@ def __init__(self, name, env, side=None, encoding=None):
40
40
def _resolve_name (self ):
41
41
# must be a queryables
42
42
if self .side == "left" :
43
+ # Note: The behavior of __new__ ensures that self.name is a str here
43
44
if self .name not in self .env .queryables :
44
45
raise NameError ("name {name!r} is not defined" .format (name = self .name ))
45
46
return self .name
0 commit comments