An object to read, create, and write config files.
new empty dictionary
|
__init__(self,
infile=None,
options=None,
configspec=None,
encoding=None,
interpolation=True,
raise_errors=False,
list_values=True,
create_empty=False,
file_error=False,
stringify=True,
indent_type=None,
default_encoding=None,
unrepr=False,
write_empty_values=False,
_inspec=False)
Parse a config file or create a config file object. |
source code
|
|
|
|
|
|
|
|
|
|
|
_a_to_u(self,
aString)
Decode ASCII strings to unicode if a self.encoding is specified. |
source code
|
|
|
|
|
_decode_element(self,
line)
Decode element to unicode if necessary. |
source code
|
|
|
_str(self,
value)
Used by ``stringify`` within validate, to turn non-string values into
strings. |
source code
|
|
|
_parse(self,
infile)
Actually parse the config file. |
source code
|
|
|
_match_depth(self,
sect,
depth)
Given a section and a depth level, walk back through the sections
parents to see if the depth level matches a previous section. |
source code
|
|
|
|
|
_unquote(self,
value)
Return an unquoted version of a value |
source code
|
|
|
_quote(self,
value,
multiline=True)
Return a safely quoted version of a value. |
source code
|
|
|
|
|
|
|
|
|
_multiline(self,
value,
infile,
cur_index,
maxline)
Extract the value, where we are in a multiline situation. |
source code
|
|
|
_handle_configspec(self,
configspec)
Parse the configspec. |
source code
|
|
|
|
|
_write_line(self,
indent_string,
entry,
this_entry,
comment)
Write an individual line, for the write method |
source code
|
|
|
_write_marker(self,
indent_string,
depth,
entry,
comment)
Write a section marker line |
source code
|
|
|
_handle_comment(self,
comment)
Deal with a comment. |
source code
|
|
|
write(self,
outfile=None,
section=None)
Write the current ConfigObj as a file |
source code
|
|
|
validate(self,
validator,
preserve_errors=False,
copy=False,
section=None)
Test the ConfigObj against a configspec. |
source code
|
|
|
reset(self)
Clear ConfigObj instance and restore to 'freshly created' state. |
source code
|
|
|
|
Inherited from Section :
__delitem__ ,
__getitem__ ,
__iter__ ,
__reduce__ ,
__setitem__ ,
__setstate__ ,
__str__ ,
as_bool ,
as_float ,
as_int ,
as_list ,
clear ,
dict ,
get ,
items ,
iteritems ,
iterkeys ,
itervalues ,
keys ,
merge ,
pop ,
popitem ,
rename ,
restore_default ,
restore_defaults ,
setdefault ,
update ,
values ,
walk
Inherited from dict :
__cmp__ ,
__contains__ ,
__eq__ ,
__ge__ ,
__getattribute__ ,
__gt__ ,
__le__ ,
__len__ ,
__lt__ ,
__ne__ ,
__new__ ,
__sizeof__ ,
copy ,
fromkeys ,
has_key ,
viewitems ,
viewkeys ,
viewvalues
Inherited from object :
__delattr__ ,
__format__ ,
__reduce_ex__ ,
__setattr__ ,
__subclasshook__
|
|
_keyword = re.compile(r'(?x) ^( \s* ) ( (?: ".*? ") | (?: \'.*? \') | (?: [ ^ ...
|
|
_sectionmarker = re.compile(r'(?x) ^( \s* ) ( (?: \[\s* ) + ) ( (?: "\s* \S...
|
|
_valueexp = re.compile(r'(?x) ^(?: (?: ( (?: (?: (?: ".*? ") | (?: \'.*? \...
|
|
_listvalueexp = re.compile(r'(?x) ( (?: ".*? ") | (?: \'.*? \') | (?: [ ^ \...
|
|
_nolistvalue = re.compile(r'(?x) ^( (?: ".*? ") | (?: \'.*? \') | (?: [ ^ \...
|
|
_single_line_single = re.compile(r'^\'\'\'( .*? ) \'\'\'\s* ( #.* ) ? $')
|
|
_single_line_double = re.compile(r'^"""( .*? ) """\s* ( #.* ) ? $')
|
|
_multi_line_single = re.compile(r'^( .*? ) \'\'\'\s* ( #.* ) ? $')
|
|
_multi_line_double = re.compile(r'^( .*? ) """\s* ( #.* ) ? $')
|
|
_triple_quote = { ' """ ' : ( re.compile(r'^"""( .*? ) """\s* ( #.* ) ? $')...
|
|
_bools = { ' 0 ' : False, ' 1 ' : True, ' false ' : False, ' no ' : False, ...
|
Inherited from dict :
__hash__
|