parameters: (line)
return_statement: return (cnt, after)
docstring: keeps track of the number of braces on a given line and returns the result.
  
    It starts at zero and subtracts for closed braces, and adds for open braces.
docstring_summary: keeps track of the number of braces on a given line and returns the result.
docstring_tokens: keeps track of the number of braces on a given line and returns the result .
function: def count_braces(line):
    """keeps track of the number of braces on a given line and returns the result.
  
    It starts at zero and subtracts for closed braces, and adds for open braces.
    """
    open_braces = ['[', '(', '{']
    close_braces = [']', ')', '}']
    closing_prefix_re = re.compile(r'(.*?[^\s\]\}\)]+.*?)([\]\}\)],?)\s*$')
    cnt = 0
    stripline = COMMENT_RE.sub(r'', line)
    stripline = QUOTE_RE.sub(r"''", stripline)
    for char in stripline:
      for brace in open_braces:
        if char == brace:
          cnt += 1
      for brace in close_braces:
        if char == brace:
          cnt -= 1
  
    after = False
    if cnt > 0:
      after = True
  
    # This catches the special case of a closing brace having something
    # other than just whitespace ahead of it -- we don't want to
    # unindent that until after this line is printed so it stays with
    # the previous indentation level.
    if cnt < 0 and closing_prefix_re.match(stripline):
      after = True
    return (cnt, after)
function_tokens: def count_braces ( line ) : open_braces = [ '[' , '(' , '{' ] close_braces = [ ']' , ')' , '}' ] closing_prefix_re = re . compile ( r'(.*?[^\s\]\}\)]+.*?)([\]\}\)],?)\s*$' ) cnt = 0 stripline = COMMENT_RE . sub ( r'' , line ) stripline = QUOTE_RE . sub ( r"''" , stripline ) for char in stripline : for brace in open_braces : if char == brace : cnt += 1 for brace in close_braces : if char == brace : cnt -= 1 after = False if cnt > 0 : after = True # This catches the special case of a closing brace having something # other than just whitespace ahead of it -- we don't want to # unindent that until after this line is printed so it stays with # the previous indentation level. if cnt < 0 and closing_prefix_re . match ( stripline ) : after = True return ( cnt , after )