@@ -22,7 +22,7 @@ def _isStringClass(self, c):
22
22
className = str (type (c ))
23
23
if className in ["<class '_ast.Str'>" , "<class 'str'>" ]:
24
24
return True
25
- elif ( className == "<class '_ast.Constant'>" and
25
+ elif ( className in [ "<class '_ast.Constant'>" , "<class 'ast.Constant'>" ] and
26
26
str (type (c .value )) == "<class 'str'>" ):
27
27
return True
28
28
else :
@@ -36,14 +36,15 @@ def _getStringValue(self, c):
36
36
37
37
def visit_Compare (self , node ):
38
38
opstype = str (type (node .ops [0 ]))
39
- if opstype in ["<class '_ast.Eq'>" ,"<class '_ast.NotEq'>" ]:
39
+ if opstype in ["<class '_ast.Eq'>" ,"<class '_ast.NotEq'>" ,
40
+ "<class 'ast.Eq'>" ,"<class 'ast.NotEq'>" ]:
40
41
left = node .left
41
42
right = node .comparators [0 ]
42
43
if self ._isStringClass (left ) and not self ._isStringClass (right ):
43
44
self .fullStrings .add (self ._getStringValue (left ))
44
45
elif (not self ._isStringClass (left )) and self ._isStringClass (right ):
45
46
self .fullStrings .add (self ._getStringValue (right ))
46
- elif opstype == "<class '_ast.In'>" :
47
+ elif opstype in [ "<class '_ast.In'>" , "<class 'ast.In'>" ] :
47
48
left = node .left
48
49
comparators = node .comparators
49
50
if self ._isStringClass (left ):
0 commit comments