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): ...@@ -63,7 +63,7 @@ def ToGNString(value, allow_dicts = True):
raise GNException("Unsupported type when printing to GN.") 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. """Converts the input string from a GN serialized value to Python values.
For details on supported types see GNValueParser.Parse() below. For details on supported types see GNValueParser.Parse() below.
...@@ -99,11 +99,11 @@ def FromGNString(input): ...@@ -99,11 +99,11 @@ def FromGNString(input):
using string interpolation on a list (as in the top example) the embedded 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 strings will be quoted and escaped according to GN rules so the list can be
re-parsed to get the same result.""" re-parsed to get the same result."""
parser = GNValueParser(input) parser = GNValueParser(input_string)
return parser.Parse() return parser.Parse()
def FromGNArgs(input): def FromGNArgs(input_string):
"""Converts a string with a bunch of gn arg assignments into a Python dict. """Converts a string with a bunch of gn arg assignments into a Python dict.
Given a whitespace-separated list of Given a whitespace-separated list of
...@@ -120,7 +120,7 @@ def FromGNArgs(input): ...@@ -120,7 +120,7 @@ def FromGNArgs(input):
This routine is meant to handle only the simple sorts of values that This routine is meant to handle only the simple sorts of values that
arise in parsing --args. arise in parsing --args.
""" """
parser = GNValueParser(input) parser = GNValueParser(input_string)
return parser.ParseArgs() return parser.ParseArgs()
...@@ -237,22 +237,22 @@ class GNValueParser(object): ...@@ -237,22 +237,22 @@ class GNValueParser(object):
raise GNException("Unexpected token: " + self.input[self.cur:]) raise GNException("Unexpected token: " + self.input[self.cur:])
def _ParseIdent(self): def _ParseIdent(self):
id = '' ident = ''
next_char = self.input[self.cur] next_char = self.input[self.cur]
if not next_char.isalpha() and not next_char=='_': if not next_char.isalpha() and not next_char=='_':
raise GNException("Expected an identifier: " + self.input[self.cur:]) raise GNException("Expected an identifier: " + self.input[self.cur:])
id += next_char ident += next_char
self.cur += 1 self.cur += 1
next_char = self.input[self.cur] next_char = self.input[self.cur]
while next_char.isalpha() or next_char.isdigit() or next_char=='_': while next_char.isalpha() or next_char.isdigit() or next_char=='_':
id += next_char ident += next_char
self.cur += 1 self.cur += 1
next_char = self.input[self.cur] next_char = self.input[self.cur]
return id return ident
def ParseNumber(self): def ParseNumber(self):
self.ConsumeWhitespace() 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