style(cmake/Modules/cpplint.py)

This commit is contained in:
Favonia 2015-01-22 10:53:59 -05:00 committed by Leonardo de Moura
parent a2f30322a9
commit c1bfafd2a7

View file

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
# #
# Copyright (c) 2009 Google Inc. All rights reserved. # Copyright (c) 2009 Google Inc. All rights reserved.
# #
@ -198,7 +198,7 @@ Syntax: cpplint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...]
ignored. ignored.
Examples: Examples:
Assuing that src/.git exists, the header guard CPP variables for Assuming that src/.git exists, the header guard CPP variables for
src/chrome/browser/ui/browser.h are: src/chrome/browser/ui/browser.h are:
No flag => CHROME_BROWSER_UI_BROWSER_H_ No flag => CHROME_BROWSER_UI_BROWSER_H_
@ -439,7 +439,7 @@ def ParseNolintSuppressions(filename, raw_line, linenum, error):
def ResetNolintSuppressions(): def ResetNolintSuppressions():
"Resets the set of NOLINT suppressions to empty." """Resets the set of NOLINT suppressions to empty."""
_error_suppressions.clear() _error_suppressions.clear()
@ -458,19 +458,20 @@ def IsErrorSuppressedByNolint(category, linenum):
return (linenum in _error_suppressions.get(category, set()) or return (linenum in _error_suppressions.get(category, set()) or
linenum in _error_suppressions.get(None, set())) linenum in _error_suppressions.get(None, set()))
def Match(pattern, s): def Match(pattern, s):
"""Matches the string with the pattern, caching the compiled regexp.""" """Matches the string with the pattern, caching the compiled regexp."""
# The regexp compilation caching is inlined in both Match and Search for # The regexp compilation caching is inlined in both Match and Search for
# performance reasons; factoring it out into a separate function turns out # performance reasons; factoring it out into a separate function turns out
# to be noticeably expensive. # to be noticeably expensive.
if not pattern in _regexp_compile_cache: if pattern not in _regexp_compile_cache:
_regexp_compile_cache[pattern] = sre_compile.compile(pattern) _regexp_compile_cache[pattern] = sre_compile.compile(pattern)
return _regexp_compile_cache[pattern].match(s) return _regexp_compile_cache[pattern].match(s)
def Search(pattern, s): def Search(pattern, s):
"""Searches the string for the pattern, caching the compiled regexp.""" """Searches the string for the pattern, caching the compiled regexp."""
if not pattern in _regexp_compile_cache: if pattern not in _regexp_compile_cache:
_regexp_compile_cache[pattern] = sre_compile.compile(pattern) _regexp_compile_cache[pattern] = sre_compile.compile(pattern)
return _regexp_compile_cache[pattern].search(s) return _regexp_compile_cache[pattern].search(s)