# `certbot_nginx.nginxparser`

Very low-level nginx config parser based on pyparsing.

class `certbot_nginx.nginxparser.``RawNginxParser`(source)

  Bases: `object`

  A class that parses nginx configuration with pyparsing.

  `parse`()

    Returns the parsed tree.

  `as_list`()

    Returns the parsed tree as a list.

class `certbot_nginx.nginxparser.``RawNginxDumper`(blocks)

  Bases: `object`

  A class that dumps nginx configuration from the provided tree.

`certbot_nginx.nginxparser.``loads`(source)

  Parses from a string.

  Parameters: | source (str) – The string to parse
  Returns: | The parsed tree
  Return type: | list

`certbot_nginx.nginxparser.``load`(_file)

  Parses from a file.

  Parameters: | _file (file) – The file to parse
  Returns: | The parsed tree
  Return type: | list

`certbot_nginx.nginxparser.``dumps`(blocks)

  Dump to a string.

  Parameters:

  - block (UnspacedList) – The parsed tree
  - indentation (int) – The number of spaces to indent

  Return type: | str

`certbot_nginx.nginxparser.``dump`(blocks, _file)

  Dump to a file.

  Parameters:

  - block (UnspacedList) – The parsed tree
  - _file (file) – The file to dump to
  - indentation (int) – The number of spaces to indent

  Return type: | NoneType

class `certbot_nginx.nginxparser.``UnspacedList`(list_source)

  Bases: `list`

  Wrap a list [of lists], making any whitespace entries magically invisible

  `_coerce`(inbound)

    Coerce some inbound object to be appropriately usable in this object

    Parameters: | inbound – string or None or list or UnspacedList
    Returns: | (coerced UnspacedList or string or None, spaced equivalent)
    Return type: | tuple

  `is_dirty`()

    Recurse through the parse tree to figure out if any sublists are dirty

  `_spaced_position`(idx)

    Convert from indexes in the unspaced list to positions in the spaced one