Lines Matching refs:val
32 def py_to_gn(val):
33 """Convert val to a string that can be used as GN args."""
34 if isinstance(val, bool):
35 return 'true' if val else 'false'
36 elif '%s' % val == val:
38 return '"%s"' % val
39 elif isinstance(val, (list, tuple)):
40 return '[%s]' % (','.join(py_to_gn(x) for x in val))
41 elif isinstance(val, dict):
43 '%s=%s' % (k, py_to_gn(v)) for (k, v) in sorted(val.items()))
46 raise Exception('Converting %s to gn is not implemented.' % type(val))