@@ -4518,10 +4518,8 @@ def bad_node(self, node):
45184518 c_default = "NULL"
45194519 elif (isinstance (expr , ast .BinOp ) or
45204520 (isinstance (expr , ast .UnaryOp ) and
4521- not (isinstance (expr .operand , ast .Num ) or
4522- (hasattr (ast , 'Constant' ) and
4523- isinstance (expr .operand , ast .Constant ) and
4524- type (expr .operand .value ) in (int , float , complex )))
4521+ not (isinstance (expr .operand , ast .Constant ) and
4522+ type (expr .operand .value ) in {int , float , complex })
45254523 )):
45264524 c_default = kwargs .get ("c_default" )
45274525 if not (isinstance (c_default , str ) and c_default ):
@@ -4613,14 +4611,10 @@ def bad_node(self, node):
46134611 self .function .parameters [parameter_name ] = p
46144612
46154613 def parse_converter (self , annotation ):
4616- if (hasattr (ast , 'Constant' ) and
4617- isinstance (annotation , ast .Constant ) and
4614+ if (isinstance (annotation , ast .Constant ) and
46184615 type (annotation .value ) is str ):
46194616 return annotation .value , True , {}
46204617
4621- if isinstance (annotation , ast .Str ):
4622- return annotation .s , True , {}
4623-
46244618 if isinstance (annotation , ast .Name ):
46254619 return annotation .id , False , {}
46264620
0 commit comments