def Func(arg_0, arg_1):
    """Creates a RootTupleInfo"""
    arg_2 = random.getrandbits(TupleHelper.MAX_SFIXED64_RAND_BITS)
    return RootTupleInfo(arg_0=arg_0, arg_1=arg_1,
                         insertion_time=time.time(), arg_2=arg_2)


def Func(arg_0):
  """Updates the list of global error suppressions.

  Parses any lint directives in the file that have global effect.

  Args:
    lines: An array of strings, each representing a line of the file, with the
           last element being empty if the file is terminated with a newline.
  """
  for arg_1 in arg_0:
    if _SEARCH_C_FILE.search(arg_1):
      for arg_2 in _DEFAULT_C_SUPPRESSED_CATEGORIES:
        arg_3[arg_2] = True
    if _SEARCH_KERNEL_FILE.search(arg_1):
      for arg_2 in _DEFAULT_KERNEL_SUPPRESSED_CATEGORIES:
        arg_3[arg_2] = True


def Func(arg_0, arg_1):
  """Funces the string for the pattern, caching the compiled regexp."""
  if arg_0 not in arg_2:
    arg_2[arg_0] = sre_compile.compile(arg_0)
  return arg_2[arg_0].search(arg_1)


def Func(arg_0):
  """Removes C++11 raw strings from lines.

    Before:
      static const char kData[] = R"(
          multi-line string
          )";

    After:
      static const char kData[] = ""
          (replaced by blank line)
          "";

  Args:
    raw_lines: list of raw lines.

  Returns:
    list of lines with C++11 raw strings replaced by empty strings.
  """

  arg_1 = None
  arg_2 = []
  for arg_3 in arg_0:
    if arg_1:
      # Inside a raw string, look for the end
      arg_4 = arg_3.find(arg_1)
      if arg_4 >= 0:
        # Found the end of the string, match leading space for this
        # line and resume copying the original lines, and also insert
        # a "" on the last line.
        arg_5 = Match(r'^(\s*)\S', arg_3)
        arg_3 = arg_5.group(1) + '""' + arg_3[arg_4 + len(arg_1):]
        arg_1 = None
      else:
        # Haven't found the end yet, append a blank line.
        arg_3 = '""'

    # Look for beginning of a raw string, and replace them with
    # empty strings.  This is done in a loop to handle multiple raw
    # strings on the same line.
    while arg_1 is None:
      # Look for beginning of a raw string.
      # See 2.14.15 [lex.string] for syntax.
      #
      # Once we have matched a raw string, we check the prefix of the
      # line to make sure that the line is not part of a single line
      # comment.  It's done this way because we remove raw strings
      # before removing comments as opposed to removing comments
      # before removing raw strings.  This is because there are some
      # cpplint checks that requires the comments to be preserved, but
      # we don't want to check comments that are inside raw strings.
      arg_6 = Match(r'^(.*?)\b(?:R|u8R|uR|UR|LR)"([^\s\\()]*)\((.*)$', arg_3)
      if (arg_6 and
          not Match(r'^([^\'"]|\'(\\.|[^\'])*\'|"(\\.|[^"])*")*//',
                    arg_6.group(1))):
        arg_1 = ')' + arg_6.group(2) + '"'

        arg_4 = arg_6.group(3).find(arg_1)
        if arg_4 >= 0:
          # Raw string ended on same line
          arg_3 = (arg_6.group(1) + '""' +
                  arg_6.group(3)[arg_4 + len(arg_1):])
          arg_1 = None
        else:
          # Start of a multi-line raw string
          arg_3 = arg_6.group(1) + '""'
      else:
        break

    arg_2.append(arg_3)

  # TODO(unknown): if delimiter is not None here, we might want to
  # emit a warning for unterminated string.
  return arg_2


def Func(arg_0, arg_1):
  """We are inside a comment, find the end marker."""
  while arg_1 < len(arg_0):
    if arg_0[arg_1].strip().endswith('*/'):
      return arg_1
    arg_1 += 1
  return len(arg_0)


def Func(arg_0, arg_1, arg_2):
  """Clears a range of lines for multi-line comments."""
  # Having // dummy comments makes the lines non-empty, so we will not get
  # unnecessary blank line warnings later in the code.
  for arg_3 in range(arg_1, arg_2):
    arg_0[arg_3] = '/**/'


def Func(arg_0, arg_1, arg_2):
  """Find the position just after the end of current parenthesized expression.

  Args:
    line: a CleansedLines line.
    startpos: start searching at this position.
    stack: nesting stack at startpos.

  Returns:
    On finding matching end: (index just after matching end, None)
    On finding an unclosed expression: (-1, None)
    Otherwise: (-1, new stack at end of this line)
  """
  for arg_3 in xrange(arg_1, len(arg_0)):
    arg_4 = arg_0[arg_3]
    if arg_4 in '([{':
      # Found start of parenthesized expression, push to expression stack
      arg_2.append(arg_4)
    elif arg_4 == '<':
      # Found potential start of template argument list
      if arg_3 > 0 and arg_0[arg_3 - 1] == '<':
        # Left shift operator
        if arg_2 and arg_2[-1] == '<':
          arg_2.pop()
          if not arg_2:
            return (-1, None)
      elif arg_3 > 0 and Search(r'\boperator\s*$', arg_0[0:arg_3]):
        # operator<, don't add to stack
        continue
      else:
        # Tentative start of template argument list
        arg_2.append('<')
    elif arg_4 in ')]}':
      # Found end of parenthesized expression.
      #
      # If we are currently expecting a matching '>', the pending '<'
      # must have been an operator.  Remove them from expression stack.
      while arg_2 and arg_2[-1] == '<':
        arg_2.pop()
      if not arg_2:
        return (-1, None)
      if ((arg_2[-1] == '(' and arg_4 == ')') or
          (arg_2[-1] == '[' and arg_4 == ']') or
          (arg_2[-1] == '{' and arg_4 == '}')):
        arg_2.pop()
        if not arg_2:
          return (arg_3 + 1, None)
      else:
        # Mismatched parentheses
        return (-1, None)
    elif arg_4 == '>':
      # Found potential end of template argument list.

      # Ignore "->" and operator functions
      if (arg_3 > 0 and
          (arg_0[arg_3 - 1] == '-' or Search(r'\boperator\s*$', arg_0[0:arg_3 - 1]))):
        continue

      # Pop the stack if there is a matching '<'.  Otherwise, ignore
      # this '>' since it must be an operator.
      if arg_2:
        if arg_2[-1] == '<':
          arg_2.pop()
          if not arg_2:
            return (arg_3 + 1, None)
    elif arg_4 == ';':
      # Found something that look like end of statements.  If we are currently
      # expecting a '>', the matching '<' must have been an operator, since
      # template argument list should not contain statements.
      while arg_2 and arg_2[-1] == '<':
        arg_2.pop()
      if not arg_2:
        return (-1, None)

  # Did not find end of expression or unbalanced parentheses on this line
  return (-1, arg_2)


def Func(arg_0, arg_1, arg_2):
  """Find position at the matching start of current expression.

  This is almost the reverse of FindEndOfExpressionInLine, but note
  that the input position and returned position differs by 1.

  Args:
    line: a CleansedLines line.
    endpos: start searching at this position.
    stack: nesting stack at endpos.

  Returns:
    On finding matching start: (index at matching start, None)
    On finding an unclosed expression: (-1, None)
    Otherwise: (-1, new stack at beginning of this line)
  """
  arg_3 = arg_1
  while arg_3 >= 0:
    arg_4 = arg_0[arg_3]
    if arg_4 in ')]}':
      # Found end of expression, push to expression stack
      arg_2.append(arg_4)
    elif arg_4 == '>':
      # Found potential end of template argument list.
      #
      # Ignore it if it's a "->" or ">=" or "operator>"
      if (arg_3 > 0 and
          (arg_0[arg_3 - 1] == '-' or
           Match(r'\s>=\s', arg_0[arg_3 - 1:]) or
           Search(r'\boperator\s*$', arg_0[0:arg_3]))):
        arg_3 -= 1
      else:
        arg_2.append('>')
    elif arg_4 == '<':
      # Found potential start of template argument list
      if arg_3 > 0 and arg_0[arg_3 - 1] == '<':
        # Left shift operator
        arg_3 -= 1
      else:
        # If there is a matching '>', we can pop the expression stack.
        # Otherwise, ignore this '<' since it must be an operator.
        if arg_2 and arg_2[-1] == '>':
          arg_2.pop()
          if not arg_2:
            return (arg_3, None)
    elif arg_4 in '([{':
      # Found start of expression.
      #
      # If there are any unmatched '>' on the stack, they must be
      # operators.  Remove those.
      while arg_2 and arg_2[-1] == '>':
        arg_2.pop()
      if not arg_2:
        return (-1, None)
      if ((arg_4 == '(' and arg_2[-1] == ')') or
          (arg_4 == '[' and arg_2[-1] == ']') or
          (arg_4 == '{' and arg_2[-1] == '}')):
        arg_2.pop()
        if not arg_2:
          return (arg_3, None)
      else:
        # Mismatched parentheses
        return (-1, None)
    elif arg_4 == ';':
      # Found something that look like end of statements.  If we are currently
      # expecting a '<', the matching '>' must have been an operator, since
      # template argument list should not contain statements.
      while arg_2 and arg_2[-1] == '>':
        arg_2.pop()
      if not arg_2:
        return (-1, None)

    arg_3 -= 1

  return (-1, arg_2)


def Func(arg_0, arg_1, arg_2):
  """If input points to ) or } or ] or >, finds the position that opens it.

  If lines[linenum][pos] points to a ')' or '}' or ']' or '>', finds the
  linenum/pos that correspond to the opening of the expression.

  Args:
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
    pos: A position on the line.

  Returns:
    A tuple (line, linenum, pos) pointer *at* the opening brace, or
    (line, 0, -1) if we never find the matching opening brace.  Note
    we ignore strings and comments when matching; and the line we
    return is the 'cleansed' line at linenum.
  """
  arg_3 = arg_0.elided[arg_1]
  if arg_3[arg_2] not in ')}]>':
    return (arg_3, 0, -1)

  # Check last line
  (arg_4, arg_5) = FindStartOfExpressionInLine(arg_3, arg_2, [])
  if arg_4 > -1:
    return (arg_3, arg_1, arg_4)

  # Continue scanning backward
  while arg_5 and arg_1 > 0:
    arg_1 -= 1
    arg_3 = arg_0.elided[arg_1]
    (arg_4, arg_5) = FindStartOfExpressionInLine(arg_3, len(arg_3) - 1, arg_5)
    if arg_4 > -1:
      return (arg_3, arg_1, arg_4)

  # Did not find start of expression before beginning of file, give up
  return (arg_3, 0, -1)


def Func(arg_0, arg_1, arg_2):
  """Logs an error if no Copyright message appears at the top of the file."""

  # We'll say it should occur by line 10. Don't forget there's a
  # dummy line at the front.
  for arg_3 in range(1, min(len(arg_1), 11)):
    if re.search(r'Copyright', arg_1[arg_3], re.I): break
  else:                       # means no copyright line was found
    arg_2(arg_0, 0, 'legal/copyright', 5,
          'No copyright message found.  '
          'You should have a line: "Copyright [year] <Copyright Owner>"')


def Func(arg_0):
  """Returns the CPP variable that should be used as a header guard.

  Args:
    filename: The name of a C++ header file.

  Returns:
    The CPP variable that should be used as a header guard in the
    named file.

  """

  # Restores original filename in case that cpplint is invoked from Emacs's
  # flymake.
  arg_0 = re.sub(r'_flymake\.h$', '.h', arg_0)
  arg_0 = re.sub(r'/\.flymake/([^/]*)$', r'/\1', arg_0)
  # Replace 'c++' with 'cpp'.
  arg_0 = arg_0.replace('C++', 'cpp').replace('c++', 'cpp')

  arg_1 = FileInfo(arg_0)
  arg_2 = arg_1.RepositoryName()
  if _root:
    arg_3 = os.sep
    # On Windows using directory separator will leave us with
    # "bogus escape error" unless we properly escape regex.
    if arg_3 == '\\':
      arg_3 += '\\'
    arg_2 = re.sub('^' + _root + arg_3, '', arg_2)
  return re.sub(r'[^a-zA-Z0-9]', '_', arg_2).upper() + '_'


def Func(arg_0, arg_1, arg_2):
  """Checks that the file contains a header guard.

  Logs an error if no #ifndef header guard is present.  For other
  headers, checks that the full pathname is used.

  Args:
    filename: The name of the C++ header file.
    clean_lines: A CleansedLines instance containing the file.
    error: The function to call with any errors found.
  """

  # Don't check for header guards if there are error suppression
  # comments somewhere in this file.
  #
  # Because this is silencing a warning for a nonexistent line, we
  # only support the very specific NOLINT(build/header_guard) syntax,
  # and not the general NOLINT or NOLINT(*) syntax.
  arg_3 = arg_1.lines_without_raw_strings
  for arg_4 in arg_3:
    if Search(r'//\s*NOLINT\(build/header_guard\)', arg_4):
      return

  # Allow pragma once instead of header guards
  for arg_4 in arg_3:
    if Search(r'^\s*#pragma\s+once', arg_4):
      return

  arg_5 = GetHeaderGuardCPPVariable(arg_0)

  arg_6 = ''
  arg_7 = 0
  arg_8 = ''
  arg_9 = ''
  arg_10 = 0
  for arg_11, arg_12 in enumerate(arg_3):
    arg_13 = arg_12.split()
    if len(arg_13) >= 2:
      # find the first occurrence of #ifndef and #define, save arg
      if not arg_6 and arg_13[0] == '#ifndef':
        # set ifndef to the header guard presented on the #ifndef line.
        arg_6 = arg_13[1]
        arg_7 = arg_11
      if not arg_8 and arg_13[0] == '#define':
        arg_8 = arg_13[1]
    # find the last occurrence of #endif, save entire line
    if arg_12.startswith('#endif'):
      arg_9 = arg_12
      arg_10 = arg_11

  if not arg_6 or not arg_8 or arg_6 != arg_8:
    arg_2(arg_0, 0, 'build/header_guard', 5,
          'No #ifndef header guard found, suggested CPP variable is: %s' %
          arg_5)
    return

  # The guard should be PATH_FILE_H_, but we also allow PATH_FILE_H__
  # for backward compatibility.
  if arg_6 != arg_5:
    arg_14 = 0
    if arg_6 != arg_5 + '_':
      arg_14 = 5

    ParseNolintSuppressions(arg_0, arg_3[arg_7], arg_7,
                            arg_2)
    arg_2(arg_0, arg_7, 'build/header_guard', arg_14,
          '#ifndef header guard has wrong style, please use: %s' % arg_5)

  # Check for "//" comments on endif line.
  ParseNolintSuppressions(arg_0, arg_3[arg_10], arg_10,
                          arg_2)
  arg_15 = Match(r'#endif\s*//\s*' + arg_5 + r'(_)?\b', arg_9)
  if arg_15:
    if arg_15.group(1) == '_':
      # Issue low severity warning for deprecated double trailing underscore
      arg_2(arg_0, arg_10, 'build/header_guard', 0,
            '#endif line should be "#endif  // %s"' % arg_5)
    return

  # Didn't find the corresponding "//" comment.  If this file does not
  # contain any "//" comments at all, it could be that the compiler
  # only wants "/**/" comments, look for those instead.
  arg_16 = True
  for arg_4 in xrange(1, len(arg_3) - 1):
    arg_12 = arg_3[arg_4]
    if Match(r'^(?:(?:\'(?:\.|[^\'])*\')|(?:"(?:\.|[^"])*")|[^\'"])*//', arg_12):
      arg_16 = False
      break

  if arg_16:
    arg_15 = Match(r'#endif\s*/\*\s*' + arg_5 + r'(_)?\s*\*/', arg_9)
    if arg_15:
      if arg_15.group(1) == '_':
        # Low severity warning for double trailing underscore
        arg_2(arg_0, arg_10, 'build/header_guard', 0,
              '#endif line should be "#endif  /* %s */"' % arg_5)
      return

  # Didn't find anything
  arg_2(arg_0, arg_10, 'build/header_guard', 5,
        '#endif line should be "#endif  // %s"' % arg_5)


def Func(arg_0, arg_1, arg_2):
  """Logs an error if a source file does not include its header."""

  # Do not check test files
  arg_3 = FileInfo(arg_0)
  if Search(_TEST_FILE_SUFFIX, arg_3.BaseName()):
    return

  for arg_4 in GetHeaderExtensions():
      arg_5 = arg_0[0:len(arg_0) - len(arg_3.Extension())]
      arg_6 = arg_5 + '.' + arg_4
      if not os.path.exists(arg_6):
        continue
      arg_7 = FileInfo(arg_6).RepositoryName()
      arg_8 = None
      for arg_9 in arg_1.include_list:
        for arg_10 in arg_9:
          if arg_7 in arg_10[0] or arg_10[0] in arg_7:
            return
          if not arg_8:
            arg_8 = arg_10[1]

      arg_2(arg_0, arg_8, 'build/include', 5,
            '%s should include its header file %s' % (arg_3.RepositoryName(),
                                                      arg_7))


def Func(arg_0, arg_1, arg_2):
  """Logs an error for each line containing bad characters.

  Two kinds of bad characters:

  1. Unicode replacement characters: These indicate that either the file
  contained invalid UTF-8 (likely) or Unicode replacement characters (which
  it shouldn't).  Note that it's possible for this to throw off line
  numbering if the invalid UTF-8 occurred adjacent to a newline.

  2. NUL bytes.  These are problematic for some tools.

  Args:
    filename: The name of the current file.
    lines: An array of strings, each representing a line of the file.
    error: The function to call with any errors found.
  """
  for arg_3, arg_4 in enumerate(arg_1):
    if unicode_escape_decode('\ufffd') in arg_4:
      arg_2(arg_0, arg_3, 'readability/utf8', 5,
            'Line contains invalid UTF-8 (or Unicode replacement character).')
    if '\0' in arg_4:
      arg_2(arg_0, arg_3, 'readability/nul', 5, 'Line contains NUL byte.')


def Func(arg_0, arg_1, arg_2, arg_3):
  """Checks for calls to thread-unsafe functions.

  Much code has been originally written without consideration of
  multi-threading. Also, engineers are relying on their old experience;
  they have learned posix before threading extensions were added. These
  tests guide the engineers to use thread-safe functions (when using
  posix directly).

  Args:
    filename: The name of the current file.
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
    error: The function to call with any errors found.
  """
  arg_4 = arg_1.elided[arg_2]
  for arg_5, arg_6, arg_7 in _THREADING_LIST:
    # Additional pattern matching check to confirm that this is the
    # function we are looking for
    if Search(arg_7, arg_4):
      arg_3(arg_0, arg_2, 'runtime/threadsafe_fn', 2,
            'Consider using ' + arg_6 +
            '...) instead of ' + arg_5 +
            '...) for improved thread safety.')


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
  """Checks for the correctness of various spacing issues in the code.

  Things we check for: spaces around operators, spaces after
  if/for/while/switch, no spaces around parens in function calls, two
  spaces between code and comment, don't start a block with a blank
  line, don't end a function with a blank line, don't add a blank line
  after public/protected/private, don't have too many blank lines in a row.

  Args:
    filename: The name of the current file.
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
    nesting_state: A NestingState instance which maintains information about
                   the current stack of nested blocks being parsed.
    error: The function to call with any errors found.
  """

  # Don't use "elided" lines here, otherwise we can't check commented lines.
  # Don't want to use "raw" either, because we don't want to check inside C++11
  # raw strings,
  arg_5 = arg_1.lines_without_raw_strings
  arg_6 = arg_5[arg_2]

  # Before nixing comments, check if the line is blank for no good
  # reason.  This includes the first line after a block is opened, and
  # blank lines at the end of a function (ie, right before a line like '}'
  #
  # Skip all the blank line checks if we are immediately inside a
  # namespace body.  In other words, don't issue blank line warnings
  # for this block:
  #   namespace {
  #
  #   }
  #
  # A warning about missing end of namespace comments will be issued instead.
  #
  # Also skip blank line checks for 'extern "C"' blocks, which are formatted
  # like namespaces.
  if (IsBlankLine(arg_6) and
      not arg_3.InNamespaceBody() and
      not arg_3.InExternC()):
    arg_7 = arg_1.elided
    arg_8 = arg_7[arg_2 - 1]
    arg_9 = arg_8.rfind('{')
    # TODO(unknown): Don't complain if line before blank line, and line after,
    #                both start with alnums and are indented the same amount.
    #                This ignores whitespace at the start of a namespace block
    #                because those are not usually indented.
    if arg_9 != -1 and arg_8[arg_9:].find('}') == -1:
      # OK, we have a blank line at the start of a code block.  Before we
      # complain, we check if it is an exception to the rule: The previous
      # non-empty line has the parameters of a function header that are indented
      # 4 spaces (because they did not fit in a 80 column line when placed on
      # the same line as the function name).  We also check for the case where
      # the previous line is indented 6 spaces, which may happen when the
      # initializers of a constructor do not fit into a 80 column line.
      arg_10 = False
      if Match(r' {6}\w', arg_8):  # Initializer list?
        # We are looking for the opening column of initializer list, which
        # should be indented 4 spaces to cause 6 space indentation afterwards.
        arg_11 = arg_2-2
        while (arg_11 >= 0
               and Match(r' {6}\w', arg_7[arg_11])):
          arg_11 -= 1
        arg_10 = (arg_11 >= 0
                     and arg_7[arg_11][:5] == '    :')
      else:
        # Search for the function arguments or an initializer list.  We use a
        # simple heuristic here: If the line is indented 4 spaces; and we have a
        # closing paren, without the opening paren, followed by an opening brace
        # or colon (for initializer lists) we assume that it is the last line of
        # a function header.  If we have a colon indented 4 spaces, it is an
        # initializer list.
        arg_10 = (Match(r' {4}\w[^\(]*\)\s*(const\s*)?(\{\s*$|:)',
                           arg_8)
                     or Match(r' {4}:', arg_8))

      if not arg_10:
        arg_4(arg_0, arg_2, 'whitespace/blank_line', 2,
              'Redundant blank line at the start of a code block '
              'should be deleted.')
    # Ignore blank lines at the end of a block in a long if-else
    # chain, like this:
    #   if (condition1) {
    #     // Something followed by a blank line
    #
    #   } else if (condition2) {
    #     // Something else
    #   }
    if arg_2 + 1 < arg_1.NumLines():
      arg_12 = arg_5[arg_2 + 1]
      if (arg_12
          and Match(r'\s*}', arg_12)
          and arg_12.find('} else ') == -1):
        arg_4(arg_0, arg_2, 'whitespace/blank_line', 3,
              'Redundant blank line at the end of a code block '
              'should be deleted.')

    arg_13 = Match(r'\s*(public|protected|private):', arg_8)
    if arg_13:
      arg_4(arg_0, arg_2, 'whitespace/blank_line', 3,
            'Do not leave a blank line after "%s:"' % arg_13.group(1))

  # Next, check comments
  arg_14 = 0
  if arg_2 + 1 < arg_1.NumLines():
    arg_12 = arg_5[arg_2 + 1]
    arg_14 = len(arg_12) - len(arg_12.lstrip())
  CheckComment(arg_6, arg_0, arg_2, arg_14, arg_4)

  # get rid of comments and strings
  arg_6 = arg_1.elided[arg_2]

  # You shouldn't have spaces before your brackets, except maybe after
  # 'delete []' or 'return []() {};'
  if Search(r'\w\s+\[', arg_6) and not Search(r'(?:delete|return)\s+\[', arg_6):
    arg_4(arg_0, arg_2, 'whitespace/braces', 5,
          'Extra space before [')

  # In range-based for, we wanted spaces before and after the colon, but
  # not around "::" tokens that might appear.
  if (Search(r'for *\(.*[^:]:[^: ]', arg_6) or
      Search(r'for *\(.*[^: ]:[^:]', arg_6)):
    arg_4(arg_0, arg_2, 'whitespace/forcolon', 2,
          'Missing space around colon in range-based for loop')


def Func(arg_0, arg_1, arg_2, arg_3):
  """Checks for horizontal spacing around parentheses.

  Args:
    filename: The name of the current file.
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
    error: The function to call with any errors found.
  """
  arg_4 = arg_1.elided[arg_2]

  # No spaces after an if, while, switch, or for
  arg_5 = Search(r' (if\(|for\(|while\(|switch\()', arg_4)
  if arg_5:
    arg_3(arg_0, arg_2, 'whitespace/parens', 5,
          'Missing space before ( in %s' % arg_5.group(1))

  # For if/for/while/switch, the left and right parens should be
  # consistent about how many spaces are inside the parens, and
  # there should either be zero or one spaces inside the parens.
  # We don't want: "if ( foo)" or "if ( foo   )".
  # Exception: "for ( ; foo; bar)" and "for (foo; bar; )" are allowed.
  arg_5 = Search(r'\b(if|for|while|switch)\s*'
                 r'\(([ ]*)(.).*[^ ]+([ ]*)\)\s*{\s*$',
                 arg_4)
  if arg_5:
    if len(arg_5.group(2)) != len(arg_5.group(4)):
      if not (arg_5.group(3) == ';' and
              len(arg_5.group(2)) == 1 + len(arg_5.group(4)) or
              not arg_5.group(2) and Search(r'\bfor\s*\(.*; \)', arg_4)):
        arg_3(arg_0, arg_2, 'whitespace/parens', 5,
              'Mismatching spaces inside () in %s' % arg_5.group(1))
    if len(arg_5.group(2)) not in [0, 1]:
      arg_3(arg_0, arg_2, 'whitespace/parens', 5,
            'Should have zero or one spaces inside ( and ) in %s' %
            arg_5.group(1))


def Func(arg_0, arg_1, arg_2):
  """Check if expression looks like a type name, returns true if so.

  Args:
    clean_lines: A CleansedLines instance containing the file.
    nesting_state: A NestingState instance which maintains information about
                   the current stack of nested blocks being parsed.
    expr: The expression to check.
  Returns:
    True, if token looks like a type.
  """
  # Keep only the last token in the expression
  arg_3 = Match(r'^.*(\b\S+)$', arg_2)
  if arg_3:
    arg_4 = arg_3.group(1)
  else:
    arg_4 = arg_2

  # Match native types and stdint types
  if _TYPES.match(arg_4):
    return True

  # Try a bit harder to match templated types.  Walk up the nesting
  # stack until we find something that resembles a typename
  # declaration for what we are looking for.
  arg_5 = (r'\b(?:typename|class|struct)\s+' + re.escape(arg_4) +
                      r'\b')
  arg_6 = len(arg_1.stack) - 1
  while arg_6 >= 0:
    if isinstance(arg_1.stack[arg_6], _NamespaceInfo):
      return False

    # Found where the opening brace is.  We want to scan from this
    # line up to the beginning of the function, minus a few lines.
    #   template <typename Type1,  // stop scanning here
    #             ...>
    #   class C
    #     : public ... {  // start scanning here
    arg_7 = arg_1.stack[arg_6].starting_linenum

    arg_8 = 0
    if arg_6 > 0:
      arg_8 = arg_1.stack[arg_6 - 1].starting_linenum
    arg_9 = arg_7
    while arg_9 >= arg_8:
      if arg_0.elided[arg_9].find('template') >= 0:
        break
      arg_9 -= 1
    if arg_9 < arg_8:
      # Didn't find any "template" keyword before reaching the next block,
      # there are probably no template things to check for this block
      arg_6 -= 1
      continue

    # Look for typename in the specified range
    for arg_10 in xrange(arg_9, arg_7 + 1, 1):
      if Search(arg_5, arg_0.elided[arg_10]):
        return True
    arg_6 -= 1

  return False


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
  """Checks for additional blank line issues related to sections.

  Currently the only thing checked here is blank line before protected/private.

  Args:
    filename: The name of the current file.
    clean_lines: A CleansedLines instance containing the file.
    class_info: A _ClassInfo objects.
    linenum: The number of the line to check.
    error: The function to call with any errors found.
  """
  # Skip checks if the class is small, where small means 25 lines or less.
  # 25 lines seems like a good cutoff since that's the usual height of
  # terminals, and any class that can't fit in one screen can't really
  # be considered "small".
  #
  # Also skip checks if we are on the first line.  This accounts for
  # classes that look like
  #   class Foo { public: ... };
  #
  # If we didn't find the end of the class, last_line would be zero,
  # and the check will be skipped by the first condition.
  if (arg_2.last_line - arg_2.starting_linenum <= 24 or
      arg_3 <= arg_2.starting_linenum):
    return

  arg_5 = Match(r'\s*(public|protected|private):', arg_1.lines[arg_3])
  if arg_5:
    # Issue warning if the line before public/protected/private was
    # not a blank line, but don't do this if the previous line contains
    # "class" or "struct".  This can happen two ways:
    #  - We are at the beginning of the class.
    #  - We are forward-declaring an inner class that is semantically
    #    private, but needed to be public for implementation reasons.
    # Also ignores cases where the previous line ends with a backslash as can be
    # common when defining classes in C macros.
    arg_6 = arg_1.lines[arg_3 - 1]
    if (not IsBlankLine(arg_6) and
        not Search(r'\b(class|struct)\b', arg_6) and
        not Search(r'\\$', arg_6)):
      # Try a bit harder to find the beginning of the class.  This is to
      # account for multi-line base-specifier lists, e.g.:
      #   class Derived
      #       : public Base {
      arg_7 = arg_2.starting_linenum
      for arg_8 in range(arg_2.starting_linenum, arg_3):
        if Search(r'\{\s*$', arg_1.lines[arg_8]):
          arg_7 = arg_8
          break
      if arg_7 < arg_3 - 1:
        arg_4(arg_0, arg_3, 'whitespace/blank_line', 3,
              '"%s:" should be preceded by a blank line' % arg_5.group(1))


def Func(arg_0, arg_1):
  """Return the most recent non-blank line and its line number.

  Args:
    clean_lines: A CleansedLines instance containing the file contents.
    linenum: The number of the line to check.

  Returns:
    A tuple with two elements.  The first element is the contents of the last
    non-blank line before the current line, or the empty string if this is the
    first non-blank line.  The second is the line number of that line, or -1
    if this is the first non-blank line.
  """

  arg_2 = arg_1 - 1
  while arg_2 >= 0:
    arg_3 = arg_0.elided[arg_2]
    if not IsBlankLine(arg_3):     # if not a blank line...
      return (arg_3, arg_2)
    arg_2 -= 1
  return ('', -1)


def Func(arg_0, arg_1, arg_2, arg_3):
  """Looks for redundant trailing semicolon.

  Args:
    filename: The name of the current file.
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
    error: The function to call with any errors found.
  """

  arg_4 = arg_1.elided[arg_2]

  # Block bodies should not be followed by a semicolon.  Due to C++11
  # brace initialization, there are more places where semicolons are
  # required than not, so we use a whitelist approach to check these
  # rather than a blacklist.  These are the places where "};" should
  # be replaced by just "}":
  # 1. Some flavor of block following closing parenthesis:
  #    for (;;) {};
  #    while (...) {};
  #    switch (...) {};
  #    Function(...) {};
  #    if (...) {};
  #    if (...) else if (...) {};
  #
  # 2. else block:
  #    if (...) else {};
  #
  # 3. const member function:
  #    Function(...) const {};
  #
  # 4. Block following some statement:
  #    x = 42;
  #    {};
  #
  # 5. Block at the beginning of a function:
  #    Function(...) {
  #      {};
  #    }
  #
  #    Note that naively checking for the preceding "{" will also match
  #    braces inside multi-dimensional arrays, but this is fine since
  #    that expression will not contain semicolons.
  #
  # 6. Block following another block:
  #    while (true) {}
  #    {};
  #
  # 7. End of namespaces:
  #    namespace {};
  #
  #    These semicolons seems far more common than other kinds of
  #    redundant semicolons, possibly due to people converting classes
  #    to namespaces.  For now we do not warn for this case.
  #
  # Try matching case 1 first.
  arg_5 = Match(r'^(.*\)\s*)\{', arg_4)
  if arg_5:
    # Matched closing parenthesis (case 1).  Check the token before the
    # matching opening parenthesis, and don't warn if it looks like a
    # macro.  This avoids these false positives:
    #  - macro that defines a base class
    #  - multi-line macro that defines a base class
    #  - macro that defines the whole class-head
    #
    # But we still issue warnings for macros that we know are safe to
    # warn, specifically:
    #  - TEST, TEST_F, TEST_P, MATCHER, MATCHER_P
    #  - TYPED_TEST
    #  - INTERFACE_DEF
    #  - EXCLUSIVE_LOCKS_REQUIRED, SHARED_LOCKS_REQUIRED, LOCKS_EXCLUDED:
    #
    # We implement a whitelist of safe macros instead of a blacklist of
    # unsafe macros, even though the latter appears less frequently in
    # google code and would have been easier to implement.  This is because
    # the downside for getting the whitelist wrong means some extra
    # semicolons, while the downside for getting the blacklist wrong
    # would result in compile errors.
    #
    # In addition to macros, we also don't want to warn on
    #  - Compound literals
    #  - Lambdas
    #  - alignas specifier with anonymous structs
    #  - decltype
    arg_6 = arg_5.group(1).rfind(')')
    arg_7 = ReverseCloseExpression(
        arg_1, arg_2, arg_6)
    if arg_7[2] > -1:
      arg_8 = arg_7[0][0:arg_7[2]]
      arg_9 = Search(r'\b([A-Z_][A-Z0-9_]*)\s*$', arg_8)
      arg_10 = Match(r'^(.*\])\s*$', arg_8)
      if ((arg_9 and
           arg_9.group(1) not in (
               'TEST', 'TEST_F', 'MATCHER', 'MATCHER_P', 'TYPED_TEST',
               'EXCLUSIVE_LOCKS_REQUIRED', 'SHARED_LOCKS_REQUIRED',
               'LOCKS_EXCLUDED', 'INTERFACE_DEF')) or
          (arg_10 and not Search(r'\boperator\s*\[\s*\]', arg_10.group(1))) or
          Search(r'\b(?:struct|union)\s+alignas\s*$', arg_8) or
          Search(r'\bdecltype$', arg_8) or
          Search(r'\s+=\s*$', arg_8)):
        arg_5 = None
    if (arg_5 and
        arg_7[1] > 1 and
        Search(r'\]\s*$', arg_1.elided[arg_7[1] - 1])):
      # Multi-line lambda-expression
      arg_5 = None

  else:
    # Try matching cases 2-3.
    arg_5 = Match(r'^(.*(?:else|\)\s*const)\s*)\{', arg_4)
    if not arg_5:
      # Try matching cases 4-6.  These are always matched on separate lines.
      #
      # Note that we can't simply concatenate the previous line to the
      # current line and do a single match, otherwise we may output
      # duplicate warnings for the blank line case:
      #   if (cond) {
      #     // blank line
      #   }
      arg_11 = GetPreviousNonBlankLine(arg_1, arg_2)[0]
      if arg_11 and Search(r'[;{}]\s*$', arg_11):
        arg_5 = Match(r'^(\s*)\{', arg_4)

  # Check matching closing brace
  if arg_5:
    (arg_12, arg_13, arg_14) = CloseExpression(
        arg_1, arg_2, len(arg_5.group(1)))
    if arg_14 > -1 and Match(r'^\s*;', arg_12[arg_14:]):
      # Current {} pair is eligible for semicolon check, and we have found
      # the redundant semicolon, output warning here.
      #
      # Note: because we are scanning forward for opening braces, and
      # outputting warnings for the matching closing brace, if there are
      # nested blocks with trailing semicolons, we will get the error
      # messages in reversed order.

      # We need to check the line forward for NOLINT
      arg_15 = arg_1.raw_lines
      ParseNolintSuppressions(arg_0, arg_15[arg_13-1], arg_13-1,
                              arg_3)
      ParseNolintSuppressions(arg_0, arg_15[arg_13], arg_13,
                              arg_3)

      arg_3(arg_0, arg_13, 'readability/braces', 4,
            "You don't need a ; after a }")


def Func(arg_0):
  """Find a replaceable CHECK-like macro.

  Args:
    line: line to search on.
  Returns:
    (macro name, start position), or (None, -1) if no replaceable
    macro is found.
  """
  for arg_1 in _CHECK_MACROS:
    arg_2 = arg_0.find(arg_1)
    if arg_2 >= 0:
      # Find opening parenthesis.  Do a regular expression match here
      # to make sure that we are matching the expected CHECK macro, as
      # opposed to some other macro that happens to contain the CHECK
      # substring.
      arg_3 = Match(r'^(.*\b' + arg_1 + r'\s*)\(', arg_0)
      if not arg_3:
        continue
      return (arg_1, len(arg_3.group(1)))
  return (None, -1)


def Func(arg_0, arg_1, arg_2, arg_3):
  """Checks the use of CHECK and EXPECT macros.

  Args:
    filename: The name of the current file.
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
    error: The function to call with any errors found.
  """

  # Decide the set of replacement macros that should be suggested
  arg_4 = arg_1.elided
  (arg_5, arg_6) = FindCheckMacro(arg_4[arg_2])
  if not arg_5:
    return

  # Find end of the boolean expression by matching parentheses
  (arg_7, arg_8, arg_9) = CloseExpression(
      arg_1, arg_2, arg_6)
  if arg_9 < 0:
    return

  # If the check macro is followed by something other than a
  # semicolon, assume users will log their own custom error messages
  # and don't suggest any replacements.
  if not Match(r'\s*;', arg_7[arg_9:]):
    return

  if arg_2 == arg_8:
    arg_10 = arg_4[arg_2][arg_6 + 1:arg_9 - 1]
  else:
    arg_10 = arg_4[arg_2][arg_6 + 1:]
    for arg_11 in xrange(arg_2 + 1, arg_8):
      arg_10 += arg_4[arg_11]
    arg_10 += arg_7[0:arg_9 - 1]

  # Parse expression so that we can take parentheses into account.
  # This avoids false positives for inputs like "CHECK((a < 4) == b)",
  # which is not replaceable by CHECK_LE.
  arg_12 = ''
  arg_13 = ''
  arg_14 = None
  while arg_10:
    arg_15 = Match(r'^\s*(<<|<<=|>>|>>=|->\*|->|&&|\|\||'
                    r'==|!=|>=|>|<=|<|\()(.*)$', arg_10)
    if arg_15:
      arg_16 = arg_15.group(1)
      if arg_16 == '(':
        # Parenthesized operand
        arg_10 = arg_15.group(2)
        (arg_17, arg_18) = FindEndOfExpressionInLine(arg_10, 0, ['('])
        if arg_17 < 0:
          return  # Unmatched parenthesis
        arg_12 += '(' + arg_10[0:arg_17]
        arg_10 = arg_10[arg_17:]
      elif arg_16 in ('&&', '||'):
        # Logical and/or operators.  This means the expression
        # contains more than one term, for example:
        #   CHECK(42 < a && a < b);
        #
        # These are not replaceable with CHECK_LE, so bail out early.
        return
      elif arg_16 in ('<<', '<<=', '>>', '>>=', '->*', '->'):
        # Non-relational operator
        arg_12 += arg_16
        arg_10 = arg_15.group(2)
      else:
        # Relational operator
        arg_14 = arg_16
        arg_13 = arg_15.group(2)
        break
    else:
      # Unparenthesized operand.  Instead of appending to lhs one character
      # at a time, we do another regular expression match to consume several
      # characters at once if possible.  Trivial benchmark shows that this
      # is more efficient when the operands are longer than a single
      # character, which is generally the case.
      arg_15 = Match(r'^([^-=!<>()&|]+)(.*)$', arg_10)
      if not arg_15:
        arg_15 = Match(r'^(\s*\S)(.*)$', arg_10)
        if not arg_15:
          break
      arg_12 += arg_15.group(1)
      arg_10 = arg_15.group(2)

  # Only apply checks if we got all parts of the boolean expression
  if not (arg_12 and arg_14 and arg_13):
    return

  # Check that rhs do not contain logical operators.  We already know
  # that lhs is fine since the loop above parses out && and ||.
  if arg_13.find('&&') > -1 or arg_13.find('||') > -1:
    return

  # At least one of the operands must be a constant literal.  This is
  # to avoid suggesting replacements for unprintable things like
  # CHECK(variable != iterator)
  #
  # The following pattern matches decimal, hex integers, strings, and
  # characters (in that order).
  arg_12 = arg_12.strip()
  arg_13 = arg_13.strip()
  arg_19 = r'^([-+]?(\d+|0[xX][0-9a-fA-F]+)[lLuU]{0,3}|".*"|\'.*\')$'
  if Match(arg_19, arg_12) or Match(arg_19, arg_13):
    # Note: since we know both lhs and rhs, we can provide a more
    # descriptive error message like:
    #   Consider using CHECK_EQ(x, 42) instead of CHECK(x == 42)
    # Instead of:
    #   Consider using CHECK_EQ instead of CHECK(a == b)
    #
    # We are still keeping the less descriptive message because if lhs
    # or rhs gets long, the error message might become unreadable.
    arg_3(arg_0, arg_2, 'readability/check', 2,
          'Consider using %s instead of %s(a %s b)' % (
              _CHECK_REPLACEMENT[arg_5][arg_14],
              arg_5, arg_14))


def Func(arg_0, arg_1, arg_2, arg_3):
  """Check alternative keywords being used in boolean expressions.

  Args:
    filename: The name of the current file.
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
    error: The function to call with any errors found.
  """
  arg_4 = arg_1.elided[arg_2]

  # Avoid preprocessor lines
  if Match(r'^\s*#', arg_4):
    return

  # Last ditch effort to avoid multi-line comments.  This will not help
  # if the comment started before the current line or ended after the
  # current line, but it catches most of the false positives.  At least,
  # it provides a way to workaround this warning for people who use
  # multi-line comments in preprocessor macros.
  #
  # TODO(unknown): remove this once cpplint has better support for
  # multi-line comments.
  if arg_4.find('/*') >= 0 or arg_4.find('*/') >= 0:
    return

  for arg_5 in _ALT_TOKEN_REPLACEMENT_PATTERN.finditer(arg_4):
    arg_3(arg_0, arg_2, 'readability/alt_tokens', 2,
          'Use operator %s instead of %s' % (
              _ALT_TOKEN_REPLACEMENT[arg_5.group(1)], arg_5.group(1)))


def Func(arg_0):
  """Determines the width of the line in column positions.

  Args:
    line: A string, which may be a Unicode string.

  Returns:
    The width of the line in column positions, accounting for Unicode
    combining characters and wide characters.
  """
  if isinstance(arg_0, unicode):
    arg_1 = 0
    for arg_2 in unicodedata.normalize('NFC', arg_0):
      if unicodedata.east_asian_width(arg_2) in ('W', 'F'):
        arg_1 += 2
      elif not unicodedata.combining(arg_2):
        arg_1 += 1
    return arg_1
  else:
    return len(arg_0)


def Func(arg_0):
  """Drops common suffixes like _test.cc or -inl.h from filename.

  For example:
    >>> Func('foo/foo-inl.h')
    'foo/foo'
    >>> Func('foo/bar/foo.cc')
    'foo/bar/foo'
    >>> Func('foo/foo_internal.h')
    'foo/foo'
    >>> Func('foo/foo_unusualinternal.h')
    'foo/foo_unusualinternal'

  Args:
    filename: The input filename.

  Returns:
    The filename with the common suffix removed.
  """
  for arg_1 in itertools.chain(
      ('%s.%s' % (test_suffix.lstrip('_'), ext)
       for test_suffix, ext in itertools.product(_test_suffixes, GetNonHeaderExtensions())),
      ('%s.%s' % (arg_1, ext)
       for arg_1, ext in itertools.product(['inl', 'imp', 'internal'], GetHeaderExtensions()))):
    if (arg_0.endswith(arg_1) and len(arg_0) > len(arg_1) and
        arg_0[-len(arg_1) - 1] in ('-', '_')):
      return arg_0[:-len(arg_1) - 1]
  return os.path.splitext(arg_0)[0]


def Func(arg_0, arg_1, arg_2):
  """Figures out what kind of header 'include' is.

  Args:
    fileinfo: The current file cpplint is running over. A FileInfo instance.
    include: The path to a #included file.
    is_system: True if the #include used <> rather than "".

  Returns:
    One of the _XXX_HEADER constants.

  For example:
    >>> Func(FileInfo('foo/foo.cc'), 'stdio.h', True)
    _C_SYS_HEADER
    >>> Func(FileInfo('foo/foo.cc'), 'string', True)
    _CPP_SYS_HEADER
    >>> Func(FileInfo('foo/foo.cc'), 'foo/foo.h', False)
    _LIKELY_MY_HEADER
    >>> Func(FileInfo('foo/foo_unknown_extension.cc'),
    ...                  'bar/foo_other_ext.h', False)
    _POSSIBLE_MY_HEADER
    >>> Func(FileInfo('foo/foo.cc'), 'foo/bar.h', False)
    _OTHER_HEADER
  """
  # This is a list of all standard c++ header files, except
  # those already checked for above.
  arg_3 = arg_1 in _CPP_HEADERS

  # Headers with C++ extensions shouldn't be considered C system headers
  if arg_2 and os.path.splitext(arg_1)[1] in ['.hpp', '.hxx', '.h++']:
      arg_2 = False

  if arg_2:
    if arg_3:
      return _CPP_SYS_HEADER
    else:
      return _C_SYS_HEADER

  # If the target file and the include we're checking share a
  # basename when we drop common extensions, and the include
  # lives in . , then it's likely to be owned by the target file.
  arg_4, arg_5 = (
      os.path.split(_DropCommonSuffixes(arg_0.RepositoryName())))
  arg_6, arg_7 = os.path.split(_DropCommonSuffixes(arg_1))
  arg_8 = os.path.normpath(arg_4 + '/../public')
  arg_8 = arg_8.replace('\\', '/')
  if arg_5 == arg_7 and (
      arg_6 == arg_4 or
      arg_6 == arg_8):
    return _LIKELY_MY_HEADER

  # If the target and include share some initial basename
  # component, it's possible the target is implementing the
  # include, so it's allowed to be first, but we'll never
  # complain if it's not there.
  arg_9 = _RE_FIRST_COMPONENT.match(arg_5)
  arg_10 = _RE_FIRST_COMPONENT.match(arg_7)
  if (arg_9 and arg_10 and
      arg_9.group(0) ==
      arg_10.group(0)):
    return _POSSIBLE_MY_HEADER

  return _OTHER_HEADER


def Func(arg_0, arg_1, arg_2, arg_3):
  """Check for unsafe global or static objects.

  Args:
    filename: The name of the current file.
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
    error: The function to call with any errors found.
  """
  arg_4 = arg_1.elided[arg_2]

  # Match two lines at a time to support multiline declarations
  if arg_2 + 1 < arg_1.NumLines() and not Search(r'[;({]', arg_4):
    arg_4 += arg_1.elided[arg_2 + 1].strip()

  # Check for people declaring static/global STL strings at the top level.
  # This is dangerous because the C++ language does not guarantee that
  # globals with constructors are initialized before the first access, and
  # also because globals can be destroyed when some threads are still running.
  # TODO(unknown): Generalize this to also find static unique_ptr instances.
  # TODO(unknown): File bugs for clang-tidy to find these.
  arg_5 = Match(
      r'((?:|static +)(?:|const +))(?::*std::)?string( +const)? +'
      r'([a-zA-Z0-9_:]+)\b(.*)',
      arg_4)

  # Remove false positives:
  # - String pointers (as opposed to values).
  #    string *pointer
  #    const string *pointer
  #    string const *pointer
  #    string *const pointer
  #
  # - Functions and template specializations.
  #    string Function<Type>(...
  #    string Class<Type>::Method(...
  #
  # - Operators.  These are matched separately because operator names
  #   cross non-word boundaries, and trying to match both operators
  #   and functions at the same time would decrease accuracy of
  #   matching identifiers.
  #    string Class::operator*()
  if (arg_5 and
      not Search(r'\bstring\b(\s+const)?\s*[\*\&]\s*(const\s+)?\w', arg_4) and
      not Search(r'\boperator\W', arg_4) and
      not Match(r'\s*(<.*>)?(::[a-zA-Z0-9_]+)*\s*\(([^"]|$)', arg_5.group(4))):
    if Search(r'\bconst\b', arg_4):
      arg_3(arg_0, arg_2, 'runtime/string', 4,
            'For a static/global string constant, use a C style string '
            'instead: "%schar%s %s[]".' %
            (arg_5.group(1), arg_5.group(2) or '', arg_5.group(3)))
    else:
      arg_3(arg_0, arg_2, 'runtime/string', 4,
            'Static/global string variables are not permitted.')

  if (Search(r'\b([A-Za-z0-9_]*_)\(\1\)', arg_4) or
      Search(r'\b([A-Za-z0-9_]*_)\(CHECK_NOTNULL\(\1\)\)', arg_4)):
    arg_3(arg_0, arg_2, 'runtime/init', 4,
          'You seem to be initializing a member variable with itself.')


def Func(arg_0, arg_1, arg_2, arg_3):
  """Check for printf related issues.

  Args:
    filename: The name of the current file.
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
    error: The function to call with any errors found.
  """
  arg_4 = arg_1.elided[arg_2]

  # When snprintf is used, the second argument shouldn't be a literal.
  arg_5 = Search(r'snprintf\s*\(([^,]*),\s*([0-9]*)\s*,', arg_4)
  if arg_5 and arg_5.group(2) != '0':
    # If 2nd arg is zero, snprintf is used to calculate size.
    arg_3(arg_0, arg_2, 'runtime/printf', 3,
          'If you can, use sizeof(%s) instead of %s as the 2nd arg '
          'to snprintf.' % (arg_5.group(1), arg_5.group(2)))

  # Check if some verboten C functions are being used.
  if Search(r'\bsprintf\s*\(', arg_4):
    arg_3(arg_0, arg_2, 'runtime/printf', 5,
          'Never use sprintf. Use snprintf instead.')
  arg_5 = Search(r'\b(strcpy|strcat)\s*\(', arg_4)
  if arg_5:
    arg_3(arg_0, arg_2, 'runtime/printf', 4,
          'Almost always, snprintf is better than %s' % arg_5.group(1))


def Func(arg_0, arg_1):
  """Check if current line is inside constructor initializer list.

  Args:
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
  Returns:
    True if current line appears to be inside constructor initializer
    list, False otherwise.
  """
  for arg_2 in xrange(arg_1, 1, -1):
    arg_3 = arg_0.elided[arg_2]
    if arg_2 == arg_1:
      arg_4 = Match(r'^(.*)\{\s*$', arg_3)
      if arg_4:
        arg_3 = arg_4.group(1)

    if Search(r'\s:\s*\w+[({]', arg_3):
      # A lone colon tend to indicate the start of a constructor
      # initializer list.  It could also be a ternary operator, which
      # also tend to appear in constructor initializer lists as
      # opposed to parameter lists.
      return True
    if Search(r'\}\s*,\s*$', arg_3):
      # A closing brace followed by a comma is probably the end of a
      # brace-initialized member in constructor initializer list.
      return True
    if Search(r'[{};]\s*$', arg_3):
      # Found one of the following:
      # - A closing brace or semicolon, probably the end of the previous
      #   function.
      # - An opening brace, probably the start of current class or namespace.
      #
      # Current line is probably not inside an initializer list since
      # we saw one of those things without seeing the starting colon.
      return False

  # Got to the beginning of the file without seeing the start of
  # constructor initializer list.
  return False


def Func(arg_0, arg_1, arg_2,
                              arg_3, arg_4):
  """Check for non-const references.

  Separate from CheckLanguage since it scans backwards from current
  line, instead of scanning forward.

  Args:
    filename: The name of the current file.
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
    nesting_state: A NestingState instance which maintains information about
                   the current stack of nested blocks being parsed.
    error: The function to call with any errors found.
  """
  # Do nothing if there is no '&' on current line.
  arg_5 = arg_1.elided[arg_2]
  if '&' not in arg_5:
    return

  # If a function is inherited, current function doesn't have much of
  # a choice, so any non-const references should not be blamed on
  # derived function.
  if IsDerivedFunction(arg_1, arg_2):
    return

  # Don't warn on out-of-line method definitions, as we would warn on the
  # in-line declaration, if it isn't marked with 'override'.
  if IsOutOfLineMethodDefinition(arg_1, arg_2):
    return

  # Long type names may be broken across multiple lines, usually in one
  # of these forms:
  #   LongType
  #       ::LongTypeContinued &identifier
  #   LongType::
  #       LongTypeContinued &identifier
  #   LongType<
  #       ...>::LongTypeContinued &identifier
  #
  # If we detected a type split across two lines, join the previous
  # line to current line so that we can match const references
  # accordingly.
  #
  # Note that this only scans back one line, since scanning back
  # arbitrary number of lines would be expensive.  If you have a type
  # that spans more than 2 lines, please use a typedef.
  if arg_2 > 1:
    arg_6 = None
    if Match(r'\s*::(?:[\w<>]|::)+\s*&\s*\S', arg_5):
      # previous_line\n + ::current_line
      arg_6 = Search(r'\b((?:const\s*)?(?:[\w<>]|::)+[\w<>])\s*$',
                        arg_1.elided[arg_2 - 1])
    elif Match(r'\s*[a-zA-Z_]([\w<>]|::)+\s*&\s*\S', arg_5):
      # previous_line::\n + current_line
      arg_6 = Search(r'\b((?:const\s*)?(?:[\w<>]|::)+::)\s*$',
                        arg_1.elided[arg_2 - 1])
    if arg_6:
      arg_5 = arg_6.group(1) + arg_5.lstrip()
    else:
      # Check for templated parameter that is split across multiple lines
      arg_7 = arg_5.rfind('>')
      if arg_7 > -1:
        (arg_8, arg_9, arg_10) = ReverseCloseExpression(
            arg_1, arg_2, arg_7)
        if arg_10 > -1 and arg_9 < arg_2:
          # Found the matching < on an earlier line, collect all
          # pieces up to current line.
          arg_5 = ''
          for arg_11 in xrange(arg_9, arg_2 + 1):
            arg_5 += arg_1.elided[arg_11].strip()

  # Check for non-const references in function parameters.  A single '&' may
  # found in the following places:
  #   inside expression: binary & for bitwise AND
  #   inside expression: unary & for taking the address of something
  #   inside declarators: reference parameter
  # We will exclude the first two cases by checking that we are not inside a
  # function body, including one that was just introduced by a trailing '{'.
  # TODO(unknown): Doesn't account for 'catch(Exception& e)' [rare].
  if (arg_3.previous_stack_top and
      not (isinstance(arg_3.previous_stack_top, _ClassInfo) or
           isinstance(arg_3.previous_stack_top, _NamespaceInfo))):
    # Not at toplevel, not within a class, and not within a namespace
    return

  # Avoid initializer lists.  We only need to scan back from the
  # current line for something that starts with ':'.
  #
  # We don't need to check the current line, since the '&' would
  # appear inside the second set of parentheses on the current line as
  # opposed to the first set.
  if arg_2 > 0:
    for arg_11 in xrange(arg_2 - 1, max(0, arg_2 - 10), -1):
      arg_12 = arg_1.elided[arg_11]
      if not Search(r'[),]\s*$', arg_12):
        break
      if Match(r'^\s*:\s+\S', arg_12):
        return

  # Avoid preprocessors
  if Search(r'\\\s*$', arg_5):
    return

  # Avoid constructor initializer lists
  if IsInitializerList(arg_1, arg_2):
    return

  # We allow non-const references in a few standard places, like functions
  # called "swap()" or iostream operators like "<<" or ">>".  Do not check
  # those function parameters.
  #
  # We also accept & in static_assert, which looks like a function but
  # it's actually a declaration expression.
  arg_13 = (r'(?:[sS]wap(?:<\w:+>)?|'
                           r'operator\s*[<>][<>]|'
                           r'static_assert|COMPILE_ASSERT'
                           r')\s*\(')
  if Search(arg_13, arg_5):
    return
  elif not Search(r'\S+\([^)]*$', arg_5):
    # Don't see a whitelisted function on this line.  Actually we
    # didn't see any function name on this line, so this is likely a
    # multi-line parameter list.  Try a bit harder to catch this case.
    for arg_11 in xrange(2):
      if (arg_2 > arg_11 and
          Search(arg_13, arg_1.elided[arg_2 - arg_11 - 1])):
        return

  arg_14 = ReplaceAll(r'{[^}]*}', ' ', arg_5)  # exclude function body
  for arg_15 in re.findall(_RE_PATTERN_REF_PARAM, arg_14):
    if (not Match(_RE_PATTERN_CONST_REF_PARAM, arg_15) and
        not Match(_RE_PATTERN_REF_STREAM_PARAM, arg_15)):
      arg_4(arg_0, arg_2, 'runtime/references', 2,
            'Is this a non-const reference? '
            'If so, make const or use a pointer: ' +
            ReplaceAll(' *<', '<', arg_15))


def Func(arg_0, arg_1):
  """Check if these two filenames belong to the same module.

  The concept of a 'module' here is a as follows:
  foo.h, foo-inl.h, foo.cc, foo_test.cc and foo_unittest.cc belong to the
  same 'module' if they are in the same directory.
  some/path/public/xyzzy and some/path/internal/xyzzy are also considered
  to belong to the same module here.

  If the filename_cc contains a longer path than the filename_h, for example,
  '/absolute/path/to/base/sysinfo.cc', and this file would include
  'base/sysinfo.h', this function also produces the prefix needed to open the
  header. This is used by the caller of this function to more robustly open the
  header file. We don't have access to the real include paths in this context,
  so we need this guesswork here.

  Known bugs: tools/base/bar.cc and base/bar.h belong to the same module
  according to this implementation. Because of this, this function gives
  some false positives. This should be sufficiently rare in practice.

  Args:
    filename_cc: is the path for the source (e.g. .cc) file
    filename_h: is the path for the header path

  Returns:
    Tuple with a bool and a string:
    bool: True if filename_cc and filename_h belong to the same module.
    string: the additional prefix needed to open the header file.
  """
  arg_2 = FileInfo(arg_0)
  if not arg_2.Extension().lstrip('.') in GetNonHeaderExtensions():
    return (False, '')

  arg_3 = FileInfo(arg_1)
  if not arg_3.Extension().lstrip('.') in GetHeaderExtensions():
    return (False, '')

  arg_0 = arg_0[:-(len(arg_2.Extension()))]
  arg_4 = Search(_TEST_FILE_SUFFIX, arg_2.BaseName())
  if arg_4:
    arg_0 = arg_0[:-len(arg_4.group(1))]

  arg_0 = arg_0.replace('/public/', '/')
  arg_0 = arg_0.replace('/internal/', '/')

  arg_1 = arg_1[:-(len(arg_3.Extension()))]
  if arg_1.endswith('-inl'):
    arg_1 = arg_1[:-len('-inl')]
  arg_1 = arg_1.replace('/public/', '/')
  arg_1 = arg_1.replace('/internal/', '/')

  arg_5 = arg_0.endswith(arg_1)
  arg_6 = ''
  if arg_5:
    arg_6 = arg_0[:-len(arg_1)]
  return arg_5, arg_6


def Func(arg_0, arg_1, arg_2, arg_3):
  """Check that make_pair's template arguments are deduced.

  G++ 4.6 in C++11 mode fails badly if make_pair's template arguments are
  specified explicitly, and such use isn't intended in any case.

  Args:
    filename: The name of the current file.
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
    error: The function to call with any errors found.
  """
  arg_4 = arg_1.elided[arg_2]
  arg_5 = _RE_PATTERN_EXPLICIT_MAKEPAIR.search(arg_4)
  if arg_5:
    arg_3(arg_0, arg_2, 'build/explicit_make_pair',
          4,  # 4 = high confidence
          'For C++11-compatibility, omit template arguments from make_pair'
          ' OR use pair directly OR if appropriate, construct a pair directly')


def Func(arg_0, arg_1, arg_2, arg_3):
  """Check if line contains a redundant "virtual" function-specifier.

  Args:
    filename: The name of the current file.
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
    error: The function to call with any errors found.
  """
  # Look for "virtual" on current line.
  arg_4 = arg_1.elided[arg_2]
  arg_5 = Match(r'^(.*)(\bvirtual\b)(.*)$', arg_4)
  if not arg_5: return

  # Ignore "virtual" keywords that are near access-specifiers.  These
  # are only used in class base-specifier and do not apply to member
  # functions.
  if (Search(r'\b(public|protected|private)\s+$', arg_5.group(1)) or
      Match(r'^\s+(public|protected|private)\b', arg_5.group(3))):
    return

  # Ignore the "virtual" keyword from virtual base classes.  Usually
  # there is a column on the same line in these cases (virtual base
  # classes are rare in google3 because multiple inheritance is rare).
  if Match(r'^.*[^:]:[^:].*$', arg_4): return

  # Look for the next opening parenthesis.  This is the start of the
  # parameter list (possibly on the next line shortly after virtual).
  # TODO(unknown): doesn't work if there are virtual functions with
  # decltype() or other things that use parentheses, but csearch suggests
  # that this is rare.
  arg_6 = -1
  arg_7 = -1
  arg_8 = len(arg_5.group(2))
  for arg_9 in xrange(arg_2, min(arg_2 + 3, arg_1.NumLines())):
    arg_4 = arg_1.elided[arg_9][arg_8:]
    arg_10 = Match(r'^([^(]*)\(', arg_4)
    if arg_10:
      # Match parentheses to find the end of the parameter list
      (arg_11, arg_7, arg_6) = CloseExpression(
          arg_1, arg_9, arg_8 + len(arg_10.group(1)))
      break
    arg_8 = 0

  if arg_6 < 0:
    return  # Couldn't find end of parameter list, give up

  # Look for "override" or "final" after the parameter list
  # (possibly on the next few lines).
  for arg_12 in xrange(arg_7, min(arg_7 + 3, arg_1.NumLines())):
    arg_4 = arg_1.elided[arg_12][arg_6:]
    arg_13 = Search(r'\b(override|final)\b', arg_4)
    if arg_13:
      arg_3(arg_0, arg_2, 'readability/inheritance', 4,
            ('"virtual" is redundant since function is '
             'already declared as "%s"' % arg_13.group(1)))

    # Set end_col to check whole lines after we are done with the
    # first line.
    arg_6 = 0
    if Search(r'[^\w]\s*$', arg_4):
      break


def Func(arg_0, arg_1, arg_2, arg_3):
  """Flag those C++14 features that we restrict.

  Args:
    filename: The name of the current file.
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
    error: The function to call with any errors found.
  """
  arg_4 = arg_1.elided[arg_2]

  arg_5 = Match(r'\s*#\s*include\s+[<"]([^<"]+)[">]', arg_4)

  # Flag unapproved C++14 headers.
  if arg_5 and arg_5.group(1) in ('scoped_allocator', 'shared_mutex'):
    arg_3(arg_0, arg_2, 'build/c++14', 5,
          ('<%s> is an unapproved C++14 header.') % arg_5.group(1))


def Func(arg_0, arg_1, arg_2, arg_3,
                    arg_4=None):
  """Performs lint checks and reports any errors to the given error function.

  Args:
    filename: Filename of the file that is being processed.
    file_extension: The extension (dot not included) of the file.
    lines: An array of strings, each representing a line of the file, with the
           last element being empty if the file is terminated with a newline.
    error: A callable to which errors are reported, which takes 4 arguments:
           filename, line number, error level, and message
    extra_check_functions: An array of additional check functions that will be
                           run on each source line. Each function takes 4
                           arguments: filename, clean_lines, line, error
  """
  arg_2 = (['// marker so line numbers and indices both start at 1'] + arg_2 +
           ['// marker so line numbers end in a known way'])

  arg_5 = _IncludeState()
  arg_6 = _FunctionState()
  arg_7 = NestingState()

  ResetNolintSuppressions()

  CheckForCopyright(arg_0, arg_2, arg_3)
  ProcessGlobalSuppresions(arg_2)
  RemoveMultiLineComments(arg_0, arg_2, arg_3)
  arg_8 = CleansedLines(arg_2)

  if arg_1 in GetHeaderExtensions():
    CheckForHeaderGuard(arg_0, arg_8, arg_3)

  for arg_9 in range(arg_8.NumLines()):
    ProcessLine(arg_0, arg_1, arg_8, arg_9,
                arg_5, arg_6, arg_7, arg_3,
                arg_4)
    FlagCxx11Features(arg_0, arg_8, arg_9, arg_3)
  arg_7.CheckCompletedBlocks(arg_0, arg_3)

  CheckForIncludeWhatYouUse(arg_0, arg_8, arg_5, arg_3)

  # Check that the .cc file has included its header if it exists.
  if _IsSourceExtension(arg_1):
    CheckHeaderFileIncluded(arg_0, arg_5, arg_3)

  # We check here rather than inside ProcessLine so that we see raw
  # lines rather than "cleaned" lines.
  CheckForBadCharacters(arg_0, arg_2, arg_3)

  CheckForNewlineAtEOF(arg_0, arg_2, arg_3)


def Func(arg_0):
  """ Loads the configuration files and processes the config overrides.

  Args:
    filename: The name of the file being processed by the linter.

  Returns:
    False if the current |filename| should not be processed further.
  """

  arg_1 = os.path.abspath(arg_0)
  arg_2 = []
  arg_3 = True
  while arg_3:
    arg_4, arg_5 = os.path.split(arg_1)
    if not arg_5:
      break  # Reached the root directory.

    arg_6 = os.path.join(arg_4, "CPPLINT.cfg")
    arg_1 = arg_4
    if not os.path.isfile(arg_6):
      continue

    try:
      with open(arg_6) as file_handle:
        for arg_7 in file_handle:
          arg_7, arg_8, arg_8 = arg_7.partition('#')  # Remove comments.
          if not arg_7.strip():
            continue

          arg_9, arg_8, arg_10 = arg_7.partition('=')
          arg_9 = arg_9.strip()
          arg_10 = arg_10.strip()
          if arg_9 == 'set noparent':
            arg_3 = False
          elif arg_9 == 'filter':
            arg_2.append(arg_10)
          elif arg_9 == 'exclude_files':
            # When matching exclude_files pattern, use the base_name of
            # the current file name or the directory name we are processing.
            # For example, if we are checking for lint errors in /foo/bar/baz.cc
            # and we found the .cfg file at /foo/CPPLINT.cfg, then the config
            # file's "exclude_files" filter is meant to be checked against "bar"
            # and not "baz" nor "bar/baz.cc".
            if arg_5:
              arg_11 = re.compile(arg_10)
              if arg_11.match(arg_5):
                _cpplint_state.PrintInfo('Ignoring "%s": file excluded by '
                    '"%s". File path component "%s" matches pattern "%s"\n' %
                    (arg_0, arg_6, arg_5, arg_10))
                return False
          elif arg_9 == 'linelength':
            global arg_12
            try:
                arg_12 = int(arg_10)
            except ValueError:
                _cpplint_state.PrintError('Line length must be numeric.')
          elif arg_9 == 'extensions':
              global arg_14
              try:
                  arg_13 = [ext.strip() for ext in arg_10.split(',')]
                  arg_14 = set(arg_13)
              except ValueError:
                  sys.stderr.write('Extensions should be a comma-separated list of values;'
                                   'for example: extensions=hpp,cpp\n'
                                   'This could not be parsed: "%s"' % (arg_10,))
          elif arg_9 == 'headers':
              global arg_15
              try:
                  arg_13 = [ext.strip() for ext in arg_10.split(',')]
                  arg_15 = set(arg_13)
              except ValueError:
                  sys.stderr.write('Extensions should be a comma-separated list of values;'
                                   'for example: extensions=hpp,cpp\n'
                                   'This could not be parsed: "%s"' % (arg_10,))
          elif arg_9 == 'root':
            global arg_16
            arg_16 = arg_10
          else:
            _cpplint_state.PrintError(
                'Invalid configuration option (%s) in file %s\n' %
                (arg_9, arg_6))

    except IOError:
      _cpplint_state.PrintError(
          "Skipping config file '%s': Can't open for reading\n" % arg_6)
      arg_3 = False

  # Apply all the accumulated filters in reverse order (top-level directory
  # config options having the least priority).
  for arg_17 in reversed(arg_2):
     _AddFilters(arg_17)

  return True


def Func(arg_0):
  """Parses the command line arguments.

  This may set the output format and verbosity level as side-effects.

  Args:
    args: The command line arguments:

  Returns:
    The list of filenames to lint.
  """
  try:
    (arg_1, arg_2) = getopt.getopt(arg_0, '', ['help', 'output=', 'verbose=',
                                                 'counting=',
                                                 'filter=',
                                                 'root=',
                                                 'repository=',
                                                 'linelength=',
                                                 'extensions=',
                                                 'exclude=',
                                                 'headers=',
                                                 'quiet',
                                                 'recursive'])
  except getopt.GetoptError:
    PrintUsage('Invalid arguments.')

  arg_3 = _VerboseLevel()
  arg_4 = _OutputFormat()
  arg_5 = ''
  arg_6 = ''
  arg_7 = False

  for (arg_8, arg_9) in arg_1:
    if arg_8 == '--help':
      PrintUsage(None)
    elif arg_8 == '--output':
      if arg_9 not in ('emacs', 'vs7', 'eclipse', 'junit'):
        PrintUsage('The only allowed output formats are emacs, vs7, eclipse '
                   'and junit.')
      arg_4 = arg_9
    elif arg_8 == '--verbose':
      arg_3 = int(arg_9)
    elif arg_8 == '--filter':
      arg_5 = arg_9
      if not arg_5:
        PrintCategories()
    elif arg_8 == '--counting':
      if arg_9 not in ('total', 'toplevel', 'detailed'):
        PrintUsage('Valid counting options are total, toplevel, and detailed')
      arg_6 = arg_9
    elif arg_8 == '--root':
      global arg_10
      arg_10 = arg_9
    elif arg_8 == '--repository':
      global arg_11
      arg_11 = arg_9
    elif arg_8 == '--linelength':
      global arg_12
      try:
        arg_12 = int(arg_9)
      except ValueError:
        PrintUsage('Line length must be digits.')
    elif arg_8 == '--exclude':
      global arg_13
      if not arg_13:
        arg_13 = set()
      arg_13.update(glob.glob(arg_9))
    elif arg_8 == '--extensions':
      global arg_14
      try:
        arg_14 = set(arg_9.split(','))
      except ValueError:
          PrintUsage('Extensions must be comma seperated list.')
    elif arg_8 == '--headers':
      global arg_15
      try:
          arg_15 = set(arg_9.split(','))
      except ValueError:
        PrintUsage('Extensions must be comma seperated list.')
    elif arg_8 == '--recursive':
      arg_7 = True
    elif arg_8 == '--quiet':
      global arg_16
      arg_16 = True

  if not arg_2:
    PrintUsage('No files were specified.')

  if arg_7:
    arg_2 = _ExpandDirectories(arg_2)

  if arg_13:
    arg_2 = _FilterExcludedFiles(arg_2)

  _SetOutputFormat(arg_4)
  _SetVerboseLevel(arg_3)
  _SetFilters(arg_5)
  _SetCountingStyle(arg_6)

  return arg_2


def Func(arg_0):
  """Searches a list of filenames and replaces directories in the list with
  all files descending from those directories. Files with extensions not in
  the valid extensions list are excluded.

  Args:
    filenames: A list of files or directories

  Returns:
    A list of all files that are members of filenames or descended from a
    directory in filenames
  """
  arg_1 = set()
  for arg_2 in arg_0:
      if not os.path.isdir(arg_2):
        arg_1.add(arg_2)
        continue

      for arg_3, arg_4, arg_5 in os.walk(arg_2):
        for arg_6 in arg_5:
          arg_7 = os.path.join(arg_3, arg_6)
          if arg_7.startswith('.' + os.path.sep):
            arg_7 = arg_7[len('.' + os.path.sep):]
          arg_1.add(arg_7)

  arg_8 = []
  for arg_2 in arg_1:
      if os.path.splitext(arg_2)[1][1:] in GetAllExtensions():
          arg_8.append(arg_2)

  return arg_8


def Func(arg_0, arg_1):
    """Check if a header has already been included.

    Args:
      header: header to check.
    Returns:
      Line number of previous occurrence, or -1 if the header has not
      been seen before.
    """
    for arg_2 in arg_0.include_list:
      for arg_3 in arg_2:
        if arg_3[0] == arg_1:
          return arg_3[1]
    return -1


def Func(arg_0, arg_1):
    """Returns a non-empty error message if the next header is out of order.

    This function also updates the internal state to be ready to check
    the next include.

    Args:
      header_type: One of the _XXX_HEADER constants defined above.

    Returns:
      The empty string if the header is in the right order, or an
      error message describing what's wrong.

    """
    arg_2 = ('Found %s after %s' %
                     (arg_0._TYPE_NAMES[arg_1],
                      arg_0._SECTION_NAMES[arg_0._section]))

    arg_3 = arg_0._section

    if arg_1 == _C_SYS_HEADER:
      if arg_0._section <= arg_0._C_SECTION:
        arg_0._section = arg_0._C_SECTION
      else:
        arg_0._last_header = ''
        return arg_2
    elif arg_1 == _CPP_SYS_HEADER:
      if arg_0._section <= arg_0._CPP_SECTION:
        arg_0._section = arg_0._CPP_SECTION
      else:
        arg_0._last_header = ''
        return arg_2
    elif arg_1 == _LIKELY_MY_HEADER:
      if arg_0._section <= arg_0._MY_H_SECTION:
        arg_0._section = arg_0._MY_H_SECTION
      else:
        arg_0._section = arg_0._OTHER_H_SECTION
    elif arg_1 == _POSSIBLE_MY_HEADER:
      if arg_0._section <= arg_0._MY_H_SECTION:
        arg_0._section = arg_0._MY_H_SECTION
      else:
        # This will always be the fallback because we're not sure
        # enough that the header is associated with this file.
        arg_0._section = arg_0._OTHER_H_SECTION
    else:
      assert arg_1 == _OTHER_HEADER
      arg_0._section = arg_0._OTHER_H_SECTION

    if arg_3 != arg_0._section:
      arg_0._last_header = ''

    return ''


def Func(arg_0, arg_1):
    """Bumps the module's error statistic."""
    arg_0.error_count += 1
    if arg_0.counting in ('toplevel', 'detailed'):
      if arg_0.counting != 'detailed':
        arg_1 = arg_1.split('/')[0]
      if arg_1 not in arg_0.errors_by_category:
        arg_0.errors_by_category[arg_1] = 0
      arg_0.errors_by_category[arg_1] += 1


def Func(arg_0):
    """Print a summary of errors by category, and the total."""
    for arg_1, arg_2 in sorted(iteritems(arg_0.errors_by_category)):
      arg_0.PrintInfo('Category \'%s\' errors found: %d\n' %
                       (arg_1, arg_2))
    if arg_0.error_count > 0:
      arg_0.PrintInfo('Total errors found: %d\n' % arg_0.error_count)


def Func(arg_0):
    """Collapses strings and chars on a line to simple "" or '' blocks.

    We nix strings first so we're not fooled by text like '"http://"'

    Args:
      elided: The line being processed.

    Returns:
      The line with collapsed strings.
    """
    if _RE_PATTERN_INCLUDE.match(arg_0):
      return arg_0

    # Remove escaped characters first to make quote/single quote collapsing
    # basic.  Things that look like escaped characters shouldn't occur
    # outside of strings and chars.
    arg_0 = _RE_PATTERN_CLEANSE_LINE_ESCAPES.sub('', arg_0)

    # Replace quoted strings and digit separators.  Both single quotes
    # and double quotes are processed in the same loop, otherwise
    # nested quotes wouldn't work.
    arg_1 = ''
    while True:
      # Find the first quote character
      arg_2 = Match(r'^([^\'"]*)([\'"])(.*)$', arg_0)
      if not arg_2:
        arg_1 += arg_0
        break
      arg_3, arg_4, arg_5 = arg_2.groups()

      if arg_4 == '"':
        # Collapse double quoted strings
        arg_6 = arg_5.find('"')
        if arg_6 >= 0:
          arg_1 += arg_3 + '""'
          arg_0 = arg_5[arg_6 + 1:]
        else:
          # Unmatched double quote, don't bother processing the rest
          # of the line since this is probably a multiline string.
          arg_1 += arg_0
          break
      else:
        # Found single quote, check nearby text to eliminate digit separators.
        #
        # There is no special handling for floating point here, because
        # the integer/fractional/exponent parts would all be parsed
        # correctly as long as there are digits on both sides of the
        # separator.  So we are fine as long as we don't see something
        # like "0.'3" (gcc 4.9.0 will not allow this literal).
        if Search(r'\b(?:0[bBxX]?|[1-9])[0-9a-fA-F]*$', arg_3):
          arg_7 = Match(r'^((?:\'?[0-9a-zA-Z_])*)(.*)$', "'" + arg_5)
          arg_1 += arg_3 + arg_7.group(1).replace("'", '')
          arg_0 = arg_7.group(2)
        else:
          arg_6 = arg_5.find('\'')
          if arg_6 >= 0:
            arg_1 += arg_3 + "''"
            arg_0 = arg_5[arg_6 + 1:]
          else:
            # Unmatched single quote
            arg_1 += arg_0
            break

    return arg_1


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    """Check end of namespace comments."""
    arg_5 = arg_2.raw_lines[arg_3]

    # Check how many lines is enclosed in this namespace.  Don't issue
    # warning for missing namespace comments if there aren't enough
    # lines.  However, do apply checks if there is already an end of
    # namespace comment and it's incorrect.
    #
    # TODO(unknown): We always want to check end of namespace comments
    # if a namespace is large, but sometimes we also want to apply the
    # check if a short namespace contained nontrivial things (something
    # other than forward declarations).  There is currently no logic on
    # deciding what these nontrivial things are, so this check is
    # triggered by namespace size only, which works most of the time.
    if (arg_3 - arg_0.starting_linenum < 10
        and not Match(r'^\s*};*\s*(//|/\*).*\bnamespace\b', arg_5)):
      return

    # Look for matching comment at end of namespace.
    #
    # Note that we accept C style "/* */" comments for terminating
    # namespaces, so that code that terminate namespaces inside
    # preprocessor macros can be cpplint clean.
    #
    # We also accept stuff like "// end of namespace <name>." with the
    # period at the end.
    #
    # Besides these, we don't accept anything else, otherwise we might
    # get false negatives when existing comment is a substring of the
    # expected namespace.
    if arg_0.name:
      # Named namespace
      if not Match((r'^\s*};*\s*(//|/\*).*\bnamespace\s+' +
                    re.escape(arg_0.name) + r'[\*/\.\\\s]*$'),
                   arg_5):
        arg_4(arg_1, arg_3, 'readability/namespace', 5,
              'Namespace should be terminated with "// namespace %s"' %
              arg_0.name)
    else:
      # Anonymous namespace
      if not Match(r'^\s*};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]*$', arg_5):
        # If "// namespace anonymous" or "// anonymous namespace (more text)",
        # mention "// anonymous namespace" as an acceptable form
        if Match(r'^\s*}.*\b(namespace anonymous|anonymous namespace)\b', arg_5):
          arg_4(arg_1, arg_3, 'readability/namespace', 5,
                'Anonymous namespace should be terminated with "// namespace"'
                ' or "// anonymous namespace"')
        else:
          arg_4(arg_1, arg_3, 'readability/namespace', 5,
                'Anonymous namespace should be terminated with "// namespace"')


def Func(arg_0, arg_1):
    """Update preprocessor stack.

    We need to handle preprocessors due to classes like this:
      #ifdef SWIG
      struct ResultDetailsPageElementExtensionPoint {
      #else
      struct ResultDetailsPageElementExtensionPoint : public Extension {
      #endif

    We make the following assumptions (good enough for most files):
    - Preprocessor condition evaluates to true from #if up to first
      #else/#elif/#endif.

    - Preprocessor condition evaluates to false from #else/#elif up
      to #endif.  We still perform lint checks on these lines, but
      these do not affect nesting stack.

    Args:
      line: current line to check.
    """
    if Match(r'^\s*#\s*(if|ifdef|ifndef)\b', arg_1):
      # Beginning of #if block, save the nesting stack here.  The saved
      # stack will allow us to restore the parsing state in the #else case.
      arg_0.pp_stack.append(_PreprocessorInfo(copy.deepcopy(arg_0.stack)))
    elif Match(r'^\s*#\s*(else|elif)\b', arg_1):
      # Beginning of #else block
      if arg_0.pp_stack:
        if not arg_0.pp_stack[-1].seen_else:
          # This is the first #else or #elif block.  Remember the
          # whole nesting stack up to this point.  This is what we
          # keep after the #endif.
          arg_0.pp_stack[-1].seen_else = True
          arg_0.pp_stack[-1].stack_before_else = copy.deepcopy(arg_0.stack)

        # Restore the stack to how it was before the #if
        arg_0.stack = copy.deepcopy(arg_0.pp_stack[-1].stack_before_if)
      else:
        # TODO(unknown): unexpected #else, issue warning?
        pass
    elif Match(r'^\s*#\s*endif\b', arg_1):
      # End of #if or #else blocks.
      if arg_0.pp_stack:
        # If we saw an #else, we will need to restore the nesting
        # stack to its former state before the #else, otherwise we
        # will just continue from where we left off.
        if arg_0.pp_stack[-1].seen_else:
          # Here we can just use a shallow copy since we are the last
          # reference to it.
          arg_0.stack = arg_0.pp_stack[-1].stack_before_else
        # Drop the corresponding #if
        arg_0.pp_stack.pop()
      else:
        # TODO(unknown): unexpected #endif, issue warning?
        pass


def Func(arg_0):
    """Get class info on the top of the stack.

    Returns:
      A _ClassInfo object if we are inside a class, or None otherwise.
    """
    for arg_1 in range(len(arg_0.stack), 0, -1):
      arg_2 = arg_0.stack[arg_1 - 1]
      if isinstance(arg_2, _ClassInfo):
        return arg_2
    return None


def Func(arg_0, arg_1, arg_2):
    """Checks that all classes and namespaces have been completely parsed.

    Call this when all lines in a file have been processed.
    Args:
      filename: The name of the current file.
      error: The function to call with any errors found.
    """
    # Note: This test can result in false positives if #ifdef constructs
    # get in the way of brace matching. See the testBuildClass test in
    # cpplint_unittest.py for an example of this.
    for arg_3 in arg_0.stack:
      if isinstance(arg_3, _ClassInfo):
        arg_2(arg_1, arg_3.starting_linenum, 'build/class', 5,
              'Failed to find complete declaration of class %s' %
              arg_3.name)
      elif isinstance(arg_3, _NamespaceInfo):
        arg_2(arg_1, arg_3.starting_linenum, 'build/namespaces', 5,
              'Failed to find complete declaration of namespace %s' %
              arg_3.name)


def Func(arg_0, arg_1):
    """Return a new Streamlet by applying map_function to each element of this Streamlet
       and flattening the result
    """
    from heronpy.streamlet.impl.flatmapbolt import FlatMapStreamlet
    arg_2 = FlatMapStreamlet(arg_1, arg_0)
    arg_0._add_child(arg_2)
    return arg_2


def Func(arg_0, arg_1):
    """Return a new Streamlet containing only the elements that satisfy Func_function
    """
    from heronpy.streamlet.impl.Funcbolt import FilterStreamlet
    arg_2 = FilterStreamlet(arg_1, arg_0)
    arg_0._add_child(arg_2)
    return arg_2


def Func(arg_0, arg_1):
    """Return num_Funcs number of streamlets each containing all elements
    of the current streamlet
    """
    arg_2 = []
    for arg_3 in range(arg_1):
      arg_2.append(arg_0.repartition(arg_0.get_num_partitions()))
    return arg_2


def Func(arg_0, arg_1, arg_2):
    """Return a new Streamlet in which each element of this Streamlet are collected
      over a window defined by window_config and then reduced using the reduce_function
      reduce_function takes two element at one time and reduces them to one element that
      is used in the subsequent operations.
    """
    from heronpy.streamlet.impl.reducebywindowbolt import ReduceByWindowStreamlet
    arg_3 = ReduceByWindowStreamlet(arg_1, arg_2, arg_0)
    arg_0._add_child(arg_3)
    return arg_3


def Func(arg_0, arg_1):
    """Returns a new Streamlet that consists of elements of both this and other_streamlet
    """
    from heronpy.streamlet.impl.Funcbolt import UnionStreamlet
    arg_2 = UnionStreamlet(arg_0, arg_1)
    arg_0._add_child(arg_2)
    arg_1._add_child(arg_2)
    return arg_2


def Func(arg_0, arg_1, arg_2, arg_3):
    """Return a new Streamlet by Funcing Func_streamlet with this streamlet
    """
    from heronpy.streamlet.impl.Funcbolt import JoinStreamlet, JoinBolt
    arg_4 = JoinStreamlet(JoinBolt.INNER, arg_2,
                                          arg_3, arg_0, arg_1)
    arg_0._add_child(arg_4)
    arg_1._add_child(arg_4)
    return arg_4


def Func(arg_0, arg_1, arg_2, arg_3):
    """Return a new Streamlet by left join_streamlet with this streamlet
    """
    from heronpy.streamlet.impl.joinbolt import JoinStreamlet, JoinBolt
    arg_4 = JoinStreamlet(JoinBolt.OUTER_LEFT, arg_2,
                                          arg_3, arg_0, arg_1)
    arg_0._add_child(arg_4)
    arg_1._add_child(arg_4)
    return arg_4


def Func(arg_0, arg_1, arg_2):
  """ extract common args """
  try:
    # do not pop like cli because ``topologies`` subcommand still needs it
    arg_3 = arg_2['cluster/[role]/[env]']
    arg_4 = arg_2['config_path']
  except KeyError:
    # if some of the arguments are not found, print error and exit
    arg_5 = config.get_subparser(arg_1, arg_0)
    print(arg_5.format_help())
    return dict()
  arg_6 = config.get_heron_cluster(arg_3)
  arg_4 = config.get_heron_cluster_conf_dir(arg_6, arg_4)

  arg_7 = dict()
  try:
    arg_8 = config.parse_cluster_role_env(arg_3, arg_4)
    arg_7['cluster'] = arg_8[0]
    arg_7['role'] = arg_8[1]
    arg_7['environ'] = arg_8[2]
    arg_7['config_path'] = arg_4
  except Exception as e:
    Log.error("Unable to get valid topology location: %s", str(e))
    return dict()

  arg_2.update(arg_7)
  return arg_2


def Func(arg_0, arg_1, arg_2=None, arg_3=None):
    '''Ensures argument obj is a native Python dictionary, raises an exception if not, and otherwise
    returns obj.
    '''
    if not isinstance(arg_0, dict):
        raise_with_traceback(_param_type_mismatch_exception(arg_0, dict, arg_1))

    if not (arg_2 or arg_3):
        return arg_0

    return _check_key_value_types(arg_0, arg_2, arg_3)


def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None):
    '''Ensures argument obj is either a dictionary or None; if the latter, instantiates an empty
    dictionary.
    '''
    if arg_0 is not None and not isinstance(arg_0, dict):
        raise_with_traceback(_param_type_mismatch_exception(arg_0, dict, arg_1))

    if not arg_0:
        return {}

    if arg_4:
        return _check_key_value_types(arg_0, arg_2, arg_3=arg_4, value_check=issubclass)
    return _check_key_value_types(arg_0, arg_2, arg_3)


def Func(arg_0):
    '''Record a stream of event records to json'''
    check.str_param(arg_0, 'json_path')
    return construct_single_handler_logger(
        "json-event-record-logger",
        DEBUG,
        JsonEventLoggerHandler(
            arg_0,
            lambda record: construct_event_record(
                StructuredLoggerMessage(
                    name=record.name,
                    message=record.msg,
                    level=record.levelno,
                    meta=record.dagster_meta,
                    record=record,
                )
            ),
        ),
    )


def Func(arg_0, arg_1=None):
        """Read a config file and instantiate the RCParser.

        Create new :class:`configparser.ConfigParser` for the given **path**
        and instantiate the :class:`RCParser` with the ConfigParser as
        :attr:`config` attribute.

        If the **path** doesn't exist, raise :exc:`ConfigFileError`.
        Otherwise return a new :class:`RCParser` instance.

        :param path:
            Optional path to the config file to parse.
            If not given, use ``'~/.pypirc'``.

        """
        arg_1 = arg_1 or arg_0.CONFIG_PATH
        if not os.path.exists(arg_1):
            arg_2 = 'Config file not found: {0!r}'.format(arg_1)
            raise ConfigFileError(arg_2)
        arg_3 = read_config(arg_1)
        return arg_0(arg_3)


def Func(arg_0):
    '''This recursive descent thing formats a config dict for GraphQL.'''

    def _format_config_subdict(arg_0, arg_1=0):
        check.dict_param(arg_0, 'config', key_type=str)

        arg_2 = IndentingStringIoPrinter(indent_level=2, arg_1=arg_1)
        arg_2.line('{')

        arg_3 = len(arg_0)
        for arg_4, arg_5 in enumerate(sorted(arg_0, arg_5=lambda x: x[0])):
            arg_6 = arg_0[arg_5]
            with arg_2.with_indent():
                arg_7 = (
                    _format_config_item(arg_6, arg_1=arg_2.current_indent)
                    .lstrip(' ')
                    .rstrip('\n')
                )
                arg_2.line(
                    '{key}: {formatted_value}{comma}'.format(
                        arg_5=arg_5,
                        arg_7=arg_7,
                        comma=',' if arg_4 != arg_3 - 1 else '',
                    )
                )
        arg_2.line('}')

        return arg_2.read()

    def _format_config_sublist(arg_0, arg_1=0):
        arg_2 = IndentingStringIoPrinter(indent_level=2, arg_1=arg_1)
        arg_2.line('[')

        arg_3 = len(arg_0)
        for arg_4, arg_6 in enumerate(arg_0):
            with arg_2.with_indent():
                arg_7 = (
                    _format_config_item(arg_6, arg_1=arg_2.current_indent)
                    .lstrip(' ')
                    .rstrip('\n')
                )
                arg_2.line(
                    '{formatted_value}{comma}'.format(
                        arg_7=arg_7, comma=',' if arg_4 != arg_3 - 1 else ''
                    )
                )
        arg_2.line(']')

        return arg_2.read()

    def _format_config_item(arg_0, arg_1=0):
        arg_2 = IndentingStringIoPrinter(indent_level=2, arg_1=arg_1)

        if isinstance(arg_0, dict):
            return _format_config_subdict(arg_0, arg_2.current_indent)
        elif isinstance(arg_0, list):
            return _format_config_sublist(arg_0, arg_2.current_indent)
        elif isinstance(arg_0, bool):
            return repr(arg_0).lower()
        else:
            return repr(arg_0).replace('\'', '"')

    check.dict_param(arg_0, 'config', key_type=str)
    if not isinstance(arg_0, dict):
        check.failed('Expected a dict to format as config, got: {item}'.format(item=repr(arg_0)))

    return _format_config_subdict(arg_0)


def Func(arg_0, arg_1):
        '''Get a pipeline by name. Only constructs that pipeline and caches it.

        Args:
            name (str): Name of the pipeline to retriever

        Returns:
            PipelineDefinition: Instance of PipelineDefinition with that name.
        '''
        check.str_param(arg_1, 'name')

        if arg_1 in arg_0._pipeline_cache:
            return arg_0._pipeline_cache[arg_1]

        try:
            arg_2 = arg_0.pipeline_dict[arg_1]()
        except KeyError:
            raise DagsterInvariantViolationError(
                'Could not find pipeline "{name}". Found: {pipeline_names}.'.format(
                    arg_1=arg_1,
                    pipeline_names=', '.join(
                        [
                            '"{pipeline_name}"'.format(arg_3=arg_3)
                            for arg_3 in arg_0.pipeline_dict.keys()
                        ]
                    ),
                )
            )
        check.invariant(
            arg_2.name == arg_1,
            'Name does not match. Name in dict {name}. Name in pipeline {pipeline.name}'.format(
                arg_1=arg_1, arg_2=arg_2
            ),
        )

        arg_0._pipeline_cache[arg_1] = check.inst(
            arg_2,
            PipelineDefinition,
            (
                'Function passed into pipeline_dict with key {key} must return a '
                'PipelineDefinition'
            ).format(key=arg_1),
        )

        return arg_2


def Func(arg_0):
        '''Return all pipelines as a list

        Returns:
            List[PipelineDefinition]:

        '''
        arg_1 = list(map(arg_0.get_pipeline, arg_0.pipeline_dict.keys()))
        # This does uniqueness check
        arg_0._construct_solid_defs(arg_1)
        return arg_1


def Func(arg_0, arg_1):
    '''
    This function polls the process until it returns a valid
    item or returns PROCESS_DEAD_AND_QUEUE_EMPTY if it is in
    a state where the process has terminated and the queue is empty

    Warning: if the child process is in an infinite loop. This will
    also infinitely loop.
    '''
    while True:
        try:
            return arg_1.get(block=True, timeout=TICK)
        except multiprocessing.queues.Empty:
            if not arg_0.is_alive():
                # There is a possibility that after the last queue.get the
                # process created another event and then died. In that case
                # we want to continue draining the queue.
                try:
                    return arg_1.get(block=False)
                except multiprocessing.queues.Empty:
                    # If the queue empty we know that there are no more events
                    # and that the process has died.
                    return PROCESS_DEAD_AND_QUEUE_EMPTY

    check.failed('unreachable')


def Func(arg_0):
        '''Waits until all there are no processes enqueued.'''
        while True:
            with arg_0._processes_lock:
                if not arg_0._processes and arg_0._processing_semaphore.locked():
                    return True
            gevent.sleep(0.1)


def Func(
    arg_0,
    arg_1=arg_2,
    arg_3=arg_4,
    arg_5=False,
    arg_6=None,
):
    '''
    The schema for configuration data that describes the type, optionality, defaults, and description.

    Args:
        dagster_type (DagsterType):
            A ``DagsterType`` describing the schema of this field, ie `Dict({'example': Func(String)})`
        default_value (Any):
            A default value to use that respects the schema provided via dagster_type
        is_optional (bool): Whether the presence of this field is optional
        despcription (str):
    '''
    arg_7 = resolve_to_config_type(arg_0)
    if not arg_7:
        raise DagsterInvalidDefinitionError(
            (
                'Attempted to pass {value_repr} to a Func that expects a valid '
                'dagster type usable in config (e.g. Dict, NamedDict, Int, String et al).'
            ).format(value_repr=repr(arg_0))
        )
    return FuncImpl(
        arg_7=resolve_to_config_type(arg_0),
        arg_1=arg_1,
        arg_3=arg_3,
        arg_5=arg_5,
        arg_6=arg_6,
    )


def Func(arg_0, arg_1, arg_2):
        '''Builds the execution plan.
        '''

        # Construct dependency dictionary
        arg_3 = {arg_4.key: set() for arg_4 in arg_0.steps}

        for arg_4 in arg_0.steps:
            for arg_5 in arg_4.step_inputs:
                arg_3[arg_4.key].add(arg_5.prev_output_handle.step_key)

        arg_6 = {arg_4.key: arg_4 for arg_4 in arg_0.steps}

        return ExecutionPlan(arg_1, arg_6, arg_3, arg_2)


def Func(arg_0, arg_1):
        '''Here we Func a new ExecutionPlan from a pipeline definition and the environment config.

        To do this, we iterate through the pipeline's solids in topological order, and hand off the
        execution steps for each solid to a companion _PlanBuilder object.

        Once we've processed the entire pipeline, we invoke _PlanBuilder.Func() to construct the
        ExecutionPlan object.
        '''
        check.inst_param(arg_0, 'pipeline_def', PipelineDefinition)
        check.inst_param(arg_1, 'environment_config', EnvironmentConfig)

        arg_2 = _PlanBuilder()

        for arg_3 in solids_in_topological_order(arg_0):
            ### 1. INPUTS
            # Create and add execution plan steps for solid inputs
            arg_4 = []
            for arg_5 in arg_3.definition.input_defs:
                arg_6 = get_input_source_step_handle(
                    arg_0, arg_1, arg_2, arg_3, arg_5
                )

                # We return None for the handle (see above in get_input_source_step_handle) when the
                # input def runtime type is "Nothing"
                if not arg_6:
                    continue

                arg_7 = create_subplan_for_input(
                    arg_0, arg_1, arg_3, arg_6, arg_5
                )

                arg_2.add_steps(arg_7.steps)

                arg_4.append(
                    StepInput(
                        arg_5.name, arg_5.runtime_type, arg_7.terminal_step_output_handle
                    )
                )

            ### 2. TRANSFORM FUNCTION
            # Create and add execution plan step for the solid transform function
            arg_8 = create_transform_step(
                arg_0, arg_1, arg_3, arg_4
            )
            arg_2.add_step(arg_8)

            ### 3. OUTPUTS
            # Create and add execution plan steps (and output handles) for solid outputs
            for arg_9 in arg_3.definition.output_defs:
                arg_7 = create_subplan_for_output(
                    arg_0, arg_1, arg_3, arg_8, arg_9
                )
                arg_2.add_steps(arg_7.steps)

                arg_10 = arg_3.output_handle(arg_9.name)
                arg_2.set_output_handle(arg_10, arg_7.terminal_step_output_handle)

        # Finally, we Func and return the execution plan
        return arg_2.Func(
            arg_0=arg_0,
            artifacts_persisted=arg_1.storage.construct_run_storage().is_persistent,
        )


def Func(arg_0=None, arg_1=False):
    '''Get the shell commands we'll use to actually build and publish a package to PyPI.'''
    arg_2 = (
        ['rm -rf dist']
        + (arg_0 if arg_0 else [])
        + [
            'python setup.py sdist bdist_wheel{nightly}'.format(
                arg_1=' --nightly' if arg_1 else ''
            ),
            'twine upload dist/*',
        ]
    )

    return arg_2


def Func(arg_0):
    """Tags all submodules for a new Func.

    Ensures that git tags, as well as the version.py files in each submodule, agree and that the
    new version is strictly greater than the current version. Will fail if the new version
    is not an increment (following PEP 440). Creates a new git tag and commit.
    """
    check_new_version(arg_0)
    set_new_version(arg_0)
    commit_new_version(arg_0)
    set_git_tag(arg_0)


def Func(arg_0):
        '''Create a context definition from a pre-existing context. This can be useful
        in testing contexts where you may want to create a context manually and then
        pass it into a one-off PipelineDefinition

        Args:
            context (ExecutionContext): The context that will provided to the pipeline.
        Returns:
            PipelineContextDefinition: The passthrough context definition.
        '''

        check.inst_param(arg_0, 'context', ExecutionContext)
        arg_1 = PipelineContextDefinition(context_fn=lambda *_args: arg_0)
        return {DEFAULT_CONTEXT_NAME: arg_1}


def Func(arg_0):
    '''
    A decorator for a annotating a function that can take the selected properties
    of a ``config_value`` and an instance of a custom type and materialize it.

    Args:
        config_cls (Selector):
    '''
    arg_1 = resolve_config_cls_arg(arg_0)
    check.param_invariant(arg_1.is_selector, 'config_cls')

    def _wrap(arg_2):
        def _selector(arg_3, arg_4, arg_5):
            arg_6, arg_7 = single_item(arg_4)
            return arg_2(arg_3, arg_6, arg_7, arg_5)

        return _create_output_schema(arg_1, _selector)

    return _wrap


def Func(arg_0, arg_1, arg_2=''):
        '''Automagically wrap a Func of text.'''
        arg_3 = TextWrapper(
            width=arg_0.line_length - len(arg_0.current_indent_str),
            initial_indent=arg_2,
            subsequent_indent=arg_2,
            break_long_words=False,
            break_on_hyphens=False,
        )
        for arg_4 in arg_3.wrap(arg_1):
            arg_0.line(arg_4)