dhcpkit.ipv6.server.generate_config_docs module

A script to generate .rst documentation based on the config schema

dhcpkit.ipv6.server.generate_config_docs.create_file(name, args)[source]

Create a file, or a file-like dummy if dry-run is enabled

Parameters:
  • name – The relative file/path name
  • args – The command like arguments
Returns:

A file-like object

dhcpkit.ipv6.server.generate_config_docs.handle_args(args: Iterable)[source]

Handle the command line arguments.

Parameters:args – Command line arguments
Returns:The arguments object
dhcpkit.ipv6.server.generate_config_docs.heading(text: str, underline: str) → str[source]

Create a heading using the specified underline character.

Parameters:
  • text – The text to use as the heading
  • underline – The character to underline with
Returns:

The heading in rst format

dhcpkit.ipv6.server.generate_config_docs.key_doc(info: Union) → List[source]

Generate documentation for a key.

Parameters:info – The information object for this key
Returns:The documentation for that key

Create an rst link.

Parameters:name – The destination to link to
Returns:The reStructuredText link

Make the text a reference link.

Parameters:
  • text – The text to link
  • link – The link destination, if different from the text
Returns:

The texts as a reference link

dhcpkit.ipv6.server.generate_config_docs.main(args: Iterable) → int[source]

Generate .rst documentation based on the config schema

Parameters:args – Command line arguments
Returns:Program exit code
dhcpkit.ipv6.server.generate_config_docs.nicer_type_name(name: str) → str[source]

Make a nicer name for a type.

Parameters:name – The ugly name
Returns:The nicer name

Convert i.e. “filter_factory” to “filters”

Parameters:link – The original link name
Returns:The normalised link name
dhcpkit.ipv6.server.generate_config_docs.reindent(text: str, new_indent: str = '') → str[source]

Fix the indentation.

Parameters:
  • text – The original text with unknown indentation
  • new_indent – The string to indent with
Returns:

The text with fixed indentation

dhcpkit.ipv6.server.generate_config_docs.run() → int[source]

Run the main program and handle exceptions

Returns:The program exit code
dhcpkit.ipv6.server.generate_config_docs.sectiontype_doc(section: ZConfig.info.SectionType) → List[source]

Extract the documentation for the given section.

Parameters:section – The section to extract documentation from
Returns:A list of strings with documentation
dhcpkit.ipv6.server.generate_config_docs.write_lines(file, lines: Iterable)[source]

Write a set of lines to the file

Parameters:
  • file – The file, or None
  • lines – The lines to write