Help system

koskari.help

Koskari help formatting and builtins

class koskari.help.HelpFormatter(title=None)

Bases: object

Mutable help document builder rendered via pydoc.TextDoc

is_empty

True when this formatter has no text or nested sections with content

item

Append an indented line in the current section

paragraph

Append a prose paragraph in the current section

raw

Append pre-formatted pydoc text without re-indenting

render

Render this formatter and nested sections to a single string

section

Open a section and return a child formatter scoped to it

koskari.help.format_accept_pattern(pattern, head)

Render one accepted-arm pattern for help text and SyntaxMatchError

koskari.help.format_layout_peer(peer)

Render one peer head symbol for help text

koskari.help.help_for_layout_handler(obj, formatter)

Fill formatter with LayoutHandler documentation

koskari.help.help_for_syntax(obj, formatter)

Fill formatter with Syntax dispatcher documentation

koskari.help.help_into(formatter, obj)

Render help for obj into formatter using registry, protocol, or default

Parameters:
  • formatter – HelpFormatter scoped to the current binding section

  • obj – value to describe

koskari.help.help_register(typeobj, handler)

Register a type-specific help renderer

Parameters:
  • typeobj – type object to match via MRO

  • handler – callable (obj, formatter) -> None

koskari.help.help_registry_clear()

Clear all help registry entries

koskari.help.help_registry_snapshot()

Return a shallow copy of the help registry dict

koskari.help.help_unregister(typeobj)

Remove a type from the help registry if present

koskari.help.kos_help(element, namespace=None)

Display help for name in namespace via the system pager

koskari.help.kos_help_text(name, namespace=None, heading=None)

Collect help text for name and related namespace keys

Parameters:
  • name – subject name (symbol or string)

  • namespace – mapping of names to bindings (required)

Returns:

combined help sections, or empty string when nothing found

Raises:

TypeError – when namespace is None