@@ -163,14 +163,14 @@ def parse(cls, location, package_only=False):
163163                args  =  {}
164164                for  kw  in  statement .value .keywords :
165165                    arg_name  =  kw .arg 
166-                     if  isinstance (kw .value , ast .Str ):
167-                         args [arg_name ] =  kw .value .s 
166+                     if  isinstance (kw .value , ast .Constant )  and   isinstance ( kw . value . value ,  str ):
167+                         args [arg_name ] =  kw .value .value 
168168
169169                    if  isinstance (kw .value , ast .List ):
170170                        # We collect the elements of a list if the element is 
171171                        # not a function call 
172172                        args [arg_name ] =  [
173-                             elt .s  for  elt  in  kw .value .elts 
173+                             elt .value  for  elt  in  kw .value .elts 
174174                            if  not  isinstance (elt , ast .Call )
175175                        ]
176176                if  args :
@@ -351,17 +351,17 @@ def parse(cls, location, package_only=True):
351351                statement_keys  =  statement .value .keys 
352352                statement_values  =  statement .value .values 
353353                for  statement_k , statement_v  in  zip (statement_keys , statement_values ):
354-                     if  isinstance (statement_k , ast .Str ):
355-                         key_name  =  statement_k .s 
354+                     if  isinstance (statement_k , ast .Constant )  and   isinstance ( statement_k . value ,  str ):
355+                         key_name  =  statement_k .value 
356356                    # The list values in a `METADATA.bzl` file seem to only contain strings 
357357                    if  isinstance (statement_v , ast .List ):
358358                        value  =  []
359359                        for  e  in  statement_v .elts :
360-                             if  not  isinstance (e , ast .Str ):
360+                             if  not  ( isinstance (e , ast .Constant )  and   isinstance ( e . value ,  str ) ):
361361                                continue 
362-                             value .append (e .s )
363-                     if  isinstance (statement_v , ( ast .Str ,  ast . Constant ) ):
364-                         value  =  statement_v .s 
362+                             value .append (e .value )
363+                     if  isinstance (statement_v , ast .Constant ):
364+                         value  =  statement_v .value 
365365                    metadata_fields [key_name ] =  value 
366366
367367        parties  =  []
0 commit comments