github.com/cheshirekow/buildtools@v0.0.0-20200224190056-5d637702fe81/build/testdata/058.in (about)

     1  def f():
     2    if foo:
     3       return bar
     4  
     5   # these comments
     6  # belong to the next statement
     7  def f():
     8    if foo:
     9       return bar
    10  
    11   # these comments
    12  # belong to the top level
    13  
    14  def f():
    15    if foo:
    16       return bar
    17   # these comments
    18  # belong to the top level
    19  
    20  def f():
    21    if foo:
    22       return bar
    23          # this comment belongs to the return statement
    24      # these comments are aligned
    25         # with the if-statement as after-comments
    26  
    27      # this should have the same indentation level as above
    28   # but this line belongs to the top level
    29  
    30   # and this belongs to the following for-loop
    31  for a in b:
    32    if foo:
    33      pass
    34  # this comment is aligned with pass
    35  
    36  # this comment is aligned with pass
    37  
    38  # this comment is aligned with pass
    39      pass
    40    elif bar:
    41      pass
    42  
    43       # this comment is aligned with pass
    44      # this comment is aligned with pass
    45     # this comment is aligned with elif
    46    # this comment is aligned with elif
    47   # this comment is aligned with for
    48  # this comment is aligned with for
    49  
    50  for a in b:
    51    if foo:
    52      pass
    53    elif bar:
    54      pass
    55  
    56  # all
    57   # of
    58    # these
    59     # comments
    60      # are
    61       # not
    62        # indented
    63  
    64  for a in b:
    65    if foo:
    66      pass
    67    elif bar:
    68      pass
    69    else:
    70      pass # This comment stays here
    71  
    72    # all
    73     # of
    74      # these
    75       # comments
    76  
    77        # are
    78         # aligned
    79          # with
    80           # else
    81  
    82  def foo():
    83    return # This comment stays here
    84     # this comment belongs to the return statement
    85  
    86     # this comment belongs to the function
    87   # but these belong
    88  
    89  # to the top level