@@ -4664,10 +4664,8 @@ def bad_node(self, node):
46644664 c_default = "NULL"
46654665 elif (isinstance (expr , ast .BinOp ) or
46664666 (isinstance (expr , ast .UnaryOp ) and
4667- not (isinstance (expr .operand , ast .Num ) or
4668- (hasattr (ast , 'Constant' ) and
4669- isinstance (expr .operand , ast .Constant ) and
4670- type (expr .operand .value ) in (int , float , complex )))
4667+ not (isinstance (expr .operand , ast .Constant ) and
4668+ type (expr .operand .value ) in {int , float , complex })
46714669 )):
46724670 c_default = kwargs .get ("c_default" )
46734671 if not (isinstance (c_default , str ) and c_default ):
@@ -4769,14 +4767,10 @@ def bad_node(self, node):
47694767 self .function .parameters [key ] = p
47704768
47714769 def parse_converter (self , annotation ):
4772- if (hasattr (ast , 'Constant' ) and
4773- isinstance (annotation , ast .Constant ) and
4770+ if (isinstance (annotation , ast .Constant ) and
47744771 type (annotation .value ) is str ):
47754772 return annotation .value , True , {}
47764773
4777- if isinstance (annotation , ast .Str ):
4778- return annotation .s , True , {}
4779-
47804774 if isinstance (annotation , ast .Name ):
47814775 return annotation .id , False , {}
47824776
0 commit comments