@@ -4701,10 +4701,8 @@ def bad_node(self, node):
47014701 c_default = "NULL"
47024702 elif (isinstance (expr , ast .BinOp ) or
47034703 (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 })
47084706 )):
47094707 c_default = kwargs .get ("c_default" )
47104708 if not (isinstance (c_default , str ) and c_default ):
@@ -4806,14 +4804,10 @@ def bad_node(self, node):
48064804 self .function .parameters [key ] = p
48074805
48084806 def parse_converter (self , annotation ):
4809- if (hasattr (ast , 'Constant' ) and
4810- isinstance (annotation , ast .Constant ) and
4807+ if (isinstance (annotation , ast .Constant ) and
48114808 type (annotation .value ) is str ):
48124809 return annotation .value , True , {}
48134810
4814- if isinstance (annotation , ast .Str ):
4815- return annotation .s , True , {}
4816-
48174811 if isinstance (annotation , ast .Name ):
48184812 return annotation .id , False , {}
48194813
0 commit comments