class documentation
class IniConfigParser(ConfigFileParser): (source)
Constructor: IniConfigParser(sections, split_ml_text_to_list)
Create a INI parser bounded to the list of provided sections. Optionaly convert multiline strings to list.
Example (if split_ml_text_to_list=False):
# this is a comment
; also a comment
[my-software]
# how to specify a key-value pair
format-string: restructuredtext
# white space are ignored, so name = value same as name=value
# this is why you can quote strings
quoted-string = ' hello mom... '
# how to set an arg which has action="store_true"
warnings-as-errors = true
# how to set an arg which has action="count" or type=int
verbosity = 1
# how to specify a list arg (eg. arg which has action="append")
repeatable-option = ["https://docs.python.org/3/objects.inv",
"https://twistedmatrix.com/documents/current/api/objects.inv"]
# how to specify a multiline text:
multi-line-text =
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Vivamus tortor odio, dignissim non ornare non, laoreet quis nunc.
Maecenas quis dapibus leo, a pellentesque leo.
Example (if split_ml_text_to_list=True):
# the same rules are applicable with the following changes:
[my-software]
# how to specify a list arg (eg. arg which has action="append")
repeatable-option = # Just enter one value per line (the list literal format can also be used)
https://docs.python.org/3/objects.inv
https://twistedmatrix.com/documents/current/api/objects.inv
# how to specify a multiline text (you have to quote it):
multi-line-text = '''
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Vivamus tortor odio, dignissim non ornare non, laoreet quis nunc.
Maecenas quis dapibus leo, a pellentesque leo.
'''
| Method | __call__ |
Undocumented |
| Method | __init__ |
No summary |
| Method | get |
Returns a string describing the config file syntax. |
| Method | parse |
Parses the keys and values from an INI config file. |
| Instance Variable | sections |
Undocumented |
| Instance Variable | split |
Undocumented |
Inherited from ConfigFileParser:
| Method | serialize |
Does the inverse of config parsing by taking parsed values and converting them back to a string representing config file contents. |
| Parameters | |
| sections | The section names bounded to the new parser. |
| split | Wether to convert multiline strings to list |