class_docstr: Directive for a list that gets compacted horizontally.
class_docstr_tok: ["Directive","for","a","list","that","gets","compacted","horizontally","."]
code: def run(self) -> list[Node]:
      ncolumns = self.options.get("columns", 2)
      node = nodes.paragraph()
      node.document = self.state.document
      self.state.nested_parse(self.content, self.content_offset, node)
      if len(node.children) != 1 or not isinstance(
          node.children[0], nodes.bullet_list
      ):
          logger.warning(
              __(".. hlist content is not a list"),
              location=(self.env.docname, self.lineno),
          )
          return []
      fulllist = node.children[0]
      # create a hlist node where the items are distributed
      npercol, nmore = divmod(len(fulllist), ncolumns)
      index = 0
      newnode = addnodes.hlist()
      newnode["ncolumns"] = str(ncolumns)
      for column in range(ncolumns):
          endindex = index + (
              (npercol + 1) if column < nmore else npercol
          )
          bullet_list = nodes.bullet_list()
          bullet_list += fulllist.children[index:endindex]
          newnode += addnodes.hlistcol("", bullet_list)
          index = endindex
      return [newnode]
  
imports: from __future__ import annotations
  import re
  from os.path import abspath, relpath
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, cast
  from docutils import nodes
  from docutils.parsers.rst import directives
  from docutils.parsers.rst.directives.admonitions import BaseAdmonition
  from docutils.parsers.rst.directives.misc import Class
  from docutils.parsers.rst.directives.misc import Include
  from docutils.statemachine import StateMachine
  from sphinx import addnodes
  from sphinx.domains.changeset import VersionChange
  from sphinx.domains.std import StandardDomain
  from sphinx.locale import _, __
  from sphinx.util import docname_join, logging, url_re
  from sphinx.util.docutils import SphinxDirective
  from sphinx.util.matching import Matcher, patfilter
  from sphinx.util.nodes import explicit_title_re
label_desc: Use image node_id 1 for calling the HList obj's underlying member method code with example usage: obj.run() and returns: list, list