certbot_nginx.nginxparser
¶
Very low-level nginx config parser based on pyparsing.
-
class
certbot_nginx.nginxparser.
RawNginxParser
(source)[source]¶ Bases:
object
A class that parses nginx configuration with pyparsing.
-
class
certbot_nginx.nginxparser.
RawNginxDumper
(blocks)[source]¶ Bases:
object
A class that dumps nginx configuration from the provided tree.
-
certbot_nginx.nginxparser.
loads
(source)[source]¶ Parses from a string.
Parameters: source (str) – The string to parse Returns: The parsed tree Return type: list
-
certbot_nginx.nginxparser.
load
(_file)[source]¶ Parses from a file.
Parameters: _file (file) – The file to parse Returns: The parsed tree Return type: list
-
certbot_nginx.nginxparser.
dumps
(blocks)[source]¶ 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)[source]¶ 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)[source]¶ Bases:
list
Wrap a list [of lists], making any whitespace entries magically invisible
-
_coerce
(inbound)[source]¶ 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
-
pop
(_i=None)[source]¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
sort
(_cmp=None, _key=None, _Rev=None)[source]¶ Sort the list in ascending order and return None.
The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).
If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values.
The reverse flag can be set to sort in descending order.
-