reconfigure.parsers¶
-
class
reconfigure.parsers.
BaseParser
[source]¶ A base parser class
-
parse
(content)[source]¶ Parameters: content – string config content Returns: a reconfigure.nodes.Node
tree
-
stringify
(tree)[source]¶ Parameters: tree – a reconfigure.nodes.Node
treeReturns: string config content
-
-
class
reconfigure.parsers.
BIND9Parser
[source]¶ A parser for named.conf
-
token_section_end
= '};'¶
-
tokens
= [('(acl|key|masters|server|trusted-keys|managed-keys|controls|logging|lwres|options|view|zone|channel|category|listen-on|search|avoid-v4-udp-ports|avoid-v6-udp-ports|blackhole|listen-on|listen-on-v6|allow-recursion|allow-recursion-on|sortlist|topology|rrset-order|dual-stack-servers|disable-algorithms|dns64|forwarders|rrset-order|update-policy|also-notify|allow-notify|rate-limit)\\s+?([^\\s{}]*\\s*)*{', <function <lambda> at 0xf66f4454>), ('\\#.*?\\n', <function <lambda> at 0xf66f4684>), ('//.*?\\n', <function <lambda> at 0xf66f46bc>), ('/\\*.*?\\*/', <function <lambda> at 0xf66f46f4>), ('((([^\\s{};#]+)|({\\s*([^\\s{};#]+;\\s*)*}))\\s*?)+;', <function <lambda> at 0xf66f472c>), ('\\s', <function <lambda> at 0xf66f4764>), ('$^', <function <lambda> at 0xf66f479c>), ('\\};', <function <lambda> at 0xf66f47d4>)]¶
-
-
class
reconfigure.parsers.
CrontabParser
(remove_comments=False)[source]¶ -
parse
(content)¶
-
stringify
(tree)¶
-
stringify_env_setting
(node)¶
-
stringify_normal_task
(node)¶
-
stringify_special_task
(node)¶
-
-
class
reconfigure.parsers.
IniFileParser
(sectionless=False, nullsection='__default__')[source]¶ A parser for standard
.ini
config files.Parameters: sectionless – if True
, allows a section-less attributes appear in the beginning of file
-
class
reconfigure.parsers.
IPTablesParser
[source]¶ A parser for
iptables
configuration as produced byiptables-save
-
class
reconfigure.parsers.
NginxParser
[source]¶ A parser for nginx configs
-
token_comment
= '#'¶
-
token_section_end
= '}'¶
-
tokens
= [('[\\w_]+\\s*?.*?{', <function <lambda> at 0xf66f448c>), ('[\\w_]+?.+?;', <function <lambda> at 0xf66f44c4>), ('\\s', <function <lambda> at 0xf66f44fc>), ('$^', <function <lambda> at 0xf66f4534>), ('\\#.*?\\n', <function <lambda> at 0xf66f456c>), ('\\}', <function <lambda> at 0xf66f45a4>)]¶
-
-
class
reconfigure.parsers.
ShellParser
(*args, **kwargs)[source]¶ A parser for shell scripts with variables
-
class
reconfigure.parsers.
SSVParser
(separator=None, maxsplit=-1, comment='#', continuation=None, *args, **kwargs)[source]¶ A parser for files containing space-separated value (notably,
/etc/fstab
and friends)Parameters: - separator – separator character, defaults to whitespace
- maxsplit – max number of tokens per line, defaults to infinity
- comment – character denoting comments
- continuation – line continuation character, None to disable