Commit 18ef930c authored by yyanagisawa's avatar yyanagisawa Committed by Commit bot

Fix pylint warnings: build/gn_helpers.py

************* Module gn_helpers
W: 68,17: Redefining built-in 'input' (redefined-builtin)
W:108,15: Redefining built-in 'input' (redefined-builtin)
W:242, 4: Redefining built-in 'id' (redefined-builtin)

Review-Url: https://codereview.chromium.org/2389353004
Cr-Commit-Position: refs/heads/master@{#423785}
parent f39dc09c
......@@ -63,7 +63,7 @@ def ToGNString(value, allow_dicts = True):
raise GNException("Unsupported type when printing to GN.")
def FromGNString(input):
def FromGNString(input_string):
"""Converts the input string from a GN serialized value to Python values.
For details on supported types see GNValueParser.Parse() below.
......@@ -99,11 +99,11 @@ def FromGNString(input):
using string interpolation on a list (as in the top example) the embedded
strings will be quoted and escaped according to GN rules so the list can be
re-parsed to get the same result."""
parser = GNValueParser(input)
parser = GNValueParser(input_string)
return parser.Parse()
def FromGNArgs(input):
def FromGNArgs(input_string):
"""Converts a string with a bunch of gn arg assignments into a Python dict.
Given a whitespace-separated list of
......@@ -120,7 +120,7 @@ def FromGNArgs(input):
This routine is meant to handle only the simple sorts of values that
arise in parsing --args.
"""
parser = GNValueParser(input)
parser = GNValueParser(input_string)
return parser.ParseArgs()
......@@ -237,22 +237,22 @@ class GNValueParser(object):
raise GNException("Unexpected token: " + self.input[self.cur:])
def _ParseIdent(self):
id = ''
ident = ''
next_char = self.input[self.cur]
if not next_char.isalpha() and not next_char=='_':
raise GNException("Expected an identifier: " + self.input[self.cur:])
id += next_char
ident += next_char
self.cur += 1
next_char = self.input[self.cur]
while next_char.isalpha() or next_char.isdigit() or next_char=='_':
id += next_char
ident += next_char
self.cur += 1
next_char = self.input[self.cur]
return id
return ident
def ParseNumber(self):
self.ConsumeWhitespace()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment