class_docstr: Holds leaves and comments. Can be printed with `str(line)`.
class_docstr_tok: ["Holds","leaves","and","comments",".","Can","be","printed","with","`","str","(","line",")","`","."]
docstr: Add an inline or standalone comment to the line.
code: def append_comment(self, comment: Leaf) -> bool:
      """Add an inline or standalone comment to the line."""
      if (
          comment.type == STANDALONE_COMMENT
          and self.bracket_tracker.any_open_brackets()
      ):
          comment.prefix = ""
          return False
  
      if comment.type != token.COMMENT:
          return False
  
      if not self.leaves:
          comment.type = STANDALONE_COMMENT
          comment.prefix = ""
          return False
  
      last_leaf = self.leaves[-1]
      if (
          last_leaf.type == token.RPAR
          and not last_leaf.value
          and last_leaf.parent
          and len(list(last_leaf.parent.leaves())) <= 3
          and not is_type_comment(comment)
      ):
          # Comments on an optional parens wrapping a single leaf should belong to
          # the wrapped node except if it's a type comment. Pinning the comment like
          # this avoids unstable formatting caused by comment migration.
          if len(self.leaves) < 2:
              comment.type = STANDALONE_COMMENT
              comment.prefix = ""
              return False
  
          last_leaf = self.leaves[-2]
      self.comments.setdefault(id(last_leaf), []).append(comment)
      return True
  
imports: import itertools
  import math
  from dataclasses import dataclass, field
  from typing import Callable, Dict, Iterator, List, Optional, Sequence, Tuple, TypeVar, Union, cast
  from black.brackets import COMMA_PRIORITY, DOT_PRIORITY, BracketTracker
  from black.mode import Mode, Preview
  from black.nodes import BRACKETS, CLOSING_BRACKETS, OPENING_BRACKETS, STANDALONE_COMMENT, TEST_DESCENDANTS, child_towards, is_docstring, is_import, is_multiline_string, is_one_sequence_between, is_type_comment, is_type_ignore_comment, is_with_or_async_with_stmt, make_simple_prefix, replace_child, syms, whitespace
  from black.strings import str_width
  from blib2to3.pgen2 import token
  from blib2to3.pytree import Leaf, Node
label_desc: Use image node_id 23 for calling the Line obj's underlying member method code with example usage: obj.append_comment(comment) and returns: True, False, False, False, False