Lines Matching refs:value
30 def to_gn_string(value: str, allow_dicts: bool = True) -> str:
31 """Returns a stringified GN equivalent of the Python value.
37 if isinstance(value, str):
38 if value.find('\n') >= 0:
41 value.replace('\\', '\\\\').replace('"', '\\"').replace('$', '\\$') + \
44 if isinstance(value, str):
45 return to_gn_string(value.encode('utf-8'))
47 if isinstance(value, bool):
48 if value:
52 if isinstance(value, list):
53 return '[ %s ]' % ', '.join(to_gn_string(v) for v in value)
55 if isinstance(value, dict):
59 for key in sorted(value):
62 result += "%s = %s\n" % (key, to_gn_string(value[key], False))
65 if isinstance(value, int):
66 return str(value)
72 """Converts the input string from a GN serialized value to Python values.
81 Which when interpreted as a command line gives the value:
96 args = [ str, "--value=$str" ]
98 asdf --value=asdf
141 def unescape_gn_string(value: list) -> str:
151 while i < len(value):
152 if value[i] == '\\':
153 if i < len(value) - 1:
155 next_char = value[i + 1]
159 result.append(value[i])
190 """Converts a string representing a printed GN value to the Python type.