@@ -4701,10 +4701,8 @@ def bad_node(self, node):
4701
4701
c_default = "NULL"
4702
4702
elif (isinstance (expr , ast .BinOp ) or
4703
4703
(isinstance (expr , ast .UnaryOp ) and
4704
- not (isinstance (expr .operand , ast .Num ) or
4705
- (hasattr (ast , 'Constant' ) and
4706
- isinstance (expr .operand , ast .Constant ) and
4707
- type (expr .operand .value ) in (int , float , complex )))
4704
+ not (isinstance (expr .operand , ast .Constant ) and
4705
+ type (expr .operand .value ) in {int , float , complex })
4708
4706
)):
4709
4707
c_default = kwargs .get ("c_default" )
4710
4708
if not (isinstance (c_default , str ) and c_default ):
@@ -4806,14 +4804,10 @@ def bad_node(self, node):
4806
4804
self .function .parameters [key ] = p
4807
4805
4808
4806
def parse_converter (self , annotation ):
4809
- if (hasattr (ast , 'Constant' ) and
4810
- isinstance (annotation , ast .Constant ) and
4807
+ if (isinstance (annotation , ast .Constant ) and
4811
4808
type (annotation .value ) is str ):
4812
4809
return annotation .value , True , {}
4813
4810
4814
- if isinstance (annotation , ast .Str ):
4815
- return annotation .s , True , {}
4816
-
4817
4811
if isinstance (annotation , ast .Name ):
4818
4812
return annotation .id , False , {}
4819
4813
0 commit comments