Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/smanonr..../lib/python3..../site-pac...
File: configobj.py
# configobj.py
[0] Fix | Delete
# A config file reader/writer that supports nested sections in config files.
[1] Fix | Delete
# Copyright (C) 2005-2014:
[2] Fix | Delete
# (name) : (email)
[3] Fix | Delete
# Michael Foord: fuzzyman AT voidspace DOT org DOT uk
[4] Fix | Delete
# Nicola Larosa: nico AT tekNico DOT net
[5] Fix | Delete
# Rob Dennis: rdennis AT gmail DOT com
[6] Fix | Delete
# Eli Courtwright: eli AT courtwright DOT org
[7] Fix | Delete
[8] Fix | Delete
# This software is licensed under the terms of the BSD license.
[9] Fix | Delete
# http://opensource.org/licenses/BSD-3-Clause
[10] Fix | Delete
[11] Fix | Delete
# ConfigObj 5 - main repository for documentation and issue tracking:
[12] Fix | Delete
# https://github.com/DiffSK/configobj
[13] Fix | Delete
[14] Fix | Delete
import os
[15] Fix | Delete
import re
[16] Fix | Delete
import sys
[17] Fix | Delete
[18] Fix | Delete
from codecs import BOM_UTF8, BOM_UTF16, BOM_UTF16_BE, BOM_UTF16_LE
[19] Fix | Delete
[20] Fix | Delete
import six
[21] Fix | Delete
from _version import __version__
[22] Fix | Delete
[23] Fix | Delete
# imported lazily to avoid startup performance hit if it isn't used
[24] Fix | Delete
compiler = None
[25] Fix | Delete
[26] Fix | Delete
# A dictionary mapping BOM to
[27] Fix | Delete
# the encoding to decode with, and what to set the
[28] Fix | Delete
# encoding attribute to.
[29] Fix | Delete
BOMS = {
[30] Fix | Delete
BOM_UTF8: ('utf_8', None),
[31] Fix | Delete
BOM_UTF16_BE: ('utf16_be', 'utf_16'),
[32] Fix | Delete
BOM_UTF16_LE: ('utf16_le', 'utf_16'),
[33] Fix | Delete
BOM_UTF16: ('utf_16', 'utf_16'),
[34] Fix | Delete
}
[35] Fix | Delete
# All legal variants of the BOM codecs.
[36] Fix | Delete
# TODO: the list of aliases is not meant to be exhaustive, is there a
[37] Fix | Delete
# better way ?
[38] Fix | Delete
BOM_LIST = {
[39] Fix | Delete
'utf_16': 'utf_16',
[40] Fix | Delete
'u16': 'utf_16',
[41] Fix | Delete
'utf16': 'utf_16',
[42] Fix | Delete
'utf-16': 'utf_16',
[43] Fix | Delete
'utf16_be': 'utf16_be',
[44] Fix | Delete
'utf_16_be': 'utf16_be',
[45] Fix | Delete
'utf-16be': 'utf16_be',
[46] Fix | Delete
'utf16_le': 'utf16_le',
[47] Fix | Delete
'utf_16_le': 'utf16_le',
[48] Fix | Delete
'utf-16le': 'utf16_le',
[49] Fix | Delete
'utf_8': 'utf_8',
[50] Fix | Delete
'u8': 'utf_8',
[51] Fix | Delete
'utf': 'utf_8',
[52] Fix | Delete
'utf8': 'utf_8',
[53] Fix | Delete
'utf-8': 'utf_8',
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
# Map of encodings to the BOM to write.
[57] Fix | Delete
BOM_SET = {
[58] Fix | Delete
'utf_8': BOM_UTF8,
[59] Fix | Delete
'utf_16': BOM_UTF16,
[60] Fix | Delete
'utf16_be': BOM_UTF16_BE,
[61] Fix | Delete
'utf16_le': BOM_UTF16_LE,
[62] Fix | Delete
None: BOM_UTF8
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
[66] Fix | Delete
def match_utf8(encoding):
[67] Fix | Delete
return BOM_LIST.get(encoding.lower()) == 'utf_8'
[68] Fix | Delete
[69] Fix | Delete
[70] Fix | Delete
# Quote strings used for writing values
[71] Fix | Delete
squot = "'%s'"
[72] Fix | Delete
dquot = '"%s"'
[73] Fix | Delete
noquot = "%s"
[74] Fix | Delete
wspace_plus = ' \r\n\v\t\'"'
[75] Fix | Delete
tsquot = '"""%s"""'
[76] Fix | Delete
tdquot = "'''%s'''"
[77] Fix | Delete
[78] Fix | Delete
# Sentinel for use in getattr calls to replace hasattr
[79] Fix | Delete
MISSING = object()
[80] Fix | Delete
[81] Fix | Delete
__all__ = (
[82] Fix | Delete
'DEFAULT_INDENT_TYPE',
[83] Fix | Delete
'DEFAULT_INTERPOLATION',
[84] Fix | Delete
'ConfigObjError',
[85] Fix | Delete
'NestingError',
[86] Fix | Delete
'ParseError',
[87] Fix | Delete
'DuplicateError',
[88] Fix | Delete
'ConfigspecError',
[89] Fix | Delete
'ConfigObj',
[90] Fix | Delete
'SimpleVal',
[91] Fix | Delete
'InterpolationError',
[92] Fix | Delete
'InterpolationLoopError',
[93] Fix | Delete
'MissingInterpolationOption',
[94] Fix | Delete
'RepeatSectionError',
[95] Fix | Delete
'ReloadError',
[96] Fix | Delete
'UnreprError',
[97] Fix | Delete
'UnknownType',
[98] Fix | Delete
'flatten_errors',
[99] Fix | Delete
'get_extra_values'
[100] Fix | Delete
)
[101] Fix | Delete
[102] Fix | Delete
DEFAULT_INTERPOLATION = 'configparser'
[103] Fix | Delete
DEFAULT_INDENT_TYPE = ' '
[104] Fix | Delete
MAX_INTERPOL_DEPTH = 10
[105] Fix | Delete
[106] Fix | Delete
OPTION_DEFAULTS = {
[107] Fix | Delete
'interpolation': True,
[108] Fix | Delete
'raise_errors': False,
[109] Fix | Delete
'list_values': True,
[110] Fix | Delete
'create_empty': False,
[111] Fix | Delete
'file_error': False,
[112] Fix | Delete
'configspec': None,
[113] Fix | Delete
'stringify': True,
[114] Fix | Delete
# option may be set to one of ('', ' ', '\t')
[115] Fix | Delete
'indent_type': None,
[116] Fix | Delete
'encoding': None,
[117] Fix | Delete
'default_encoding': None,
[118] Fix | Delete
'unrepr': False,
[119] Fix | Delete
'write_empty_values': False,
[120] Fix | Delete
}
[121] Fix | Delete
[122] Fix | Delete
# this could be replaced if six is used for compatibility, or there are no
[123] Fix | Delete
# more assertions about items being a string
[124] Fix | Delete
[125] Fix | Delete
[126] Fix | Delete
def getObj(s):
[127] Fix | Delete
global compiler
[128] Fix | Delete
if compiler is None:
[129] Fix | Delete
import compiler
[130] Fix | Delete
s = "a=" + s
[131] Fix | Delete
p = compiler.parse(s)
[132] Fix | Delete
return p.getChildren()[1].getChildren()[0].getChildren()[1]
[133] Fix | Delete
[134] Fix | Delete
[135] Fix | Delete
class UnknownType(Exception):
[136] Fix | Delete
pass
[137] Fix | Delete
[138] Fix | Delete
[139] Fix | Delete
class Builder(object):
[140] Fix | Delete
[141] Fix | Delete
def build(self, o):
[142] Fix | Delete
if m is None:
[143] Fix | Delete
raise UnknownType(o.__class__.__name__)
[144] Fix | Delete
return m(o)
[145] Fix | Delete
[146] Fix | Delete
def build_List(self, o):
[147] Fix | Delete
return list(map(self.build, o.getChildren()))
[148] Fix | Delete
[149] Fix | Delete
def build_Const(self, o):
[150] Fix | Delete
return o.value
[151] Fix | Delete
[152] Fix | Delete
def build_Dict(self, o):
[153] Fix | Delete
d = {}
[154] Fix | Delete
i = iter(map(self.build, o.getChildren()))
[155] Fix | Delete
for el in i:
[156] Fix | Delete
d[el] = next(i)
[157] Fix | Delete
return d
[158] Fix | Delete
[159] Fix | Delete
def build_Tuple(self, o):
[160] Fix | Delete
return tuple(self.build_List(o))
[161] Fix | Delete
[162] Fix | Delete
def build_Name(self, o):
[163] Fix | Delete
if o.name == 'None':
[164] Fix | Delete
return None
[165] Fix | Delete
if o.name == 'True':
[166] Fix | Delete
return True
[167] Fix | Delete
if o.name == 'False':
[168] Fix | Delete
return False
[169] Fix | Delete
[170] Fix | Delete
# An undefined Name
[171] Fix | Delete
raise UnknownType('Undefined Name')
[172] Fix | Delete
[173] Fix | Delete
def build_Add(self, o):
[174] Fix | Delete
real, imag = list(map(self.build_Const, o.getChildren()))
[175] Fix | Delete
try:
[176] Fix | Delete
real = float(real)
[177] Fix | Delete
except TypeError:
[178] Fix | Delete
raise UnknownType('Add')
[179] Fix | Delete
if not isinstance(imag, complex) or imag.real != 0.0:
[180] Fix | Delete
raise UnknownType('Add')
[181] Fix | Delete
return real+imag
[182] Fix | Delete
[183] Fix | Delete
def build_Getattr(self, o):
[184] Fix | Delete
parent = self.build(o.expr)
[185] Fix | Delete
return getattr(parent, o.attrname)
[186] Fix | Delete
[187] Fix | Delete
def build_UnarySub(self, o):
[188] Fix | Delete
return -self.build_Const(o.getChildren()[0])
[189] Fix | Delete
[190] Fix | Delete
def build_UnaryAdd(self, o):
[191] Fix | Delete
return self.build_Const(o.getChildren()[0])
[192] Fix | Delete
[193] Fix | Delete
[194] Fix | Delete
_builder = Builder()
[195] Fix | Delete
[196] Fix | Delete
[197] Fix | Delete
def unrepr(s):
[198] Fix | Delete
if not s:
[199] Fix | Delete
return s
[200] Fix | Delete
[201] Fix | Delete
# this is supposed to be safe
[202] Fix | Delete
import ast
[203] Fix | Delete
return ast.literal_eval(s)
[204] Fix | Delete
[205] Fix | Delete
[206] Fix | Delete
class ConfigObjError(SyntaxError):
[207] Fix | Delete
"""
[208] Fix | Delete
This is the base class for all errors that ConfigObj raises.
[209] Fix | Delete
It is a subclass of SyntaxError.
[210] Fix | Delete
"""
[211] Fix | Delete
def __init__(self, message='', line_number=None, line=''):
[212] Fix | Delete
self.line = line
[213] Fix | Delete
self.line_number = line_number
[214] Fix | Delete
SyntaxError.__init__(self, message)
[215] Fix | Delete
[216] Fix | Delete
[217] Fix | Delete
class NestingError(ConfigObjError):
[218] Fix | Delete
"""
[219] Fix | Delete
This error indicates a level of nesting that doesn't match.
[220] Fix | Delete
"""
[221] Fix | Delete
[222] Fix | Delete
[223] Fix | Delete
class ParseError(ConfigObjError):
[224] Fix | Delete
"""
[225] Fix | Delete
This error indicates that a line is badly written.
[226] Fix | Delete
It is neither a valid ``key = value`` line,
[227] Fix | Delete
nor a valid section marker line.
[228] Fix | Delete
"""
[229] Fix | Delete
[230] Fix | Delete
[231] Fix | Delete
class ReloadError(IOError):
[232] Fix | Delete
"""
[233] Fix | Delete
A 'reload' operation failed.
[234] Fix | Delete
This exception is a subclass of ``IOError``.
[235] Fix | Delete
"""
[236] Fix | Delete
def __init__(self):
[237] Fix | Delete
IOError.__init__(self, 'reload failed, filename is not set.')
[238] Fix | Delete
[239] Fix | Delete
[240] Fix | Delete
class DuplicateError(ConfigObjError):
[241] Fix | Delete
"""
[242] Fix | Delete
The keyword or section specified already exists.
[243] Fix | Delete
"""
[244] Fix | Delete
[245] Fix | Delete
[246] Fix | Delete
class ConfigspecError(ConfigObjError):
[247] Fix | Delete
"""
[248] Fix | Delete
An error occured whilst parsing a configspec.
[249] Fix | Delete
"""
[250] Fix | Delete
[251] Fix | Delete
[252] Fix | Delete
class InterpolationError(ConfigObjError):
[253] Fix | Delete
"""Base class for the two interpolation errors."""
[254] Fix | Delete
[255] Fix | Delete
[256] Fix | Delete
class InterpolationLoopError(InterpolationError):
[257] Fix | Delete
"""Maximum interpolation depth exceeded in string interpolation."""
[258] Fix | Delete
[259] Fix | Delete
def __init__(self, option):
[260] Fix | Delete
InterpolationError.__init__(
[261] Fix | Delete
self,
[262] Fix | Delete
'interpolation loop detected in value "%s".' % option)
[263] Fix | Delete
[264] Fix | Delete
[265] Fix | Delete
class RepeatSectionError(ConfigObjError):
[266] Fix | Delete
"""
[267] Fix | Delete
This error indicates additional sections in a section with a
[268] Fix | Delete
``__many__`` (repeated) section.
[269] Fix | Delete
"""
[270] Fix | Delete
[271] Fix | Delete
[272] Fix | Delete
class MissingInterpolationOption(InterpolationError):
[273] Fix | Delete
"""A value specified for interpolation was missing."""
[274] Fix | Delete
def __init__(self, option):
[275] Fix | Delete
msg = 'missing option "%s" in interpolation.' % option
[276] Fix | Delete
InterpolationError.__init__(self, msg)
[277] Fix | Delete
[278] Fix | Delete
[279] Fix | Delete
class UnreprError(ConfigObjError):
[280] Fix | Delete
"""An error parsing in unrepr mode."""
[281] Fix | Delete
[282] Fix | Delete
[283] Fix | Delete
[284] Fix | Delete
class InterpolationEngine(object):
[285] Fix | Delete
"""
[286] Fix | Delete
A helper class to help perform string interpolation.
[287] Fix | Delete
[288] Fix | Delete
This class is an abstract base class; its descendants perform
[289] Fix | Delete
the actual work.
[290] Fix | Delete
"""
[291] Fix | Delete
[292] Fix | Delete
# compiled regexp to use in self.interpolate()
[293] Fix | Delete
_KEYCRE = re.compile(r"%\(([^)]*)\)s")
[294] Fix | Delete
_cookie = '%'
[295] Fix | Delete
[296] Fix | Delete
def __init__(self, section):
[297] Fix | Delete
# the Section instance that "owns" this engine
[298] Fix | Delete
self.section = section
[299] Fix | Delete
[300] Fix | Delete
[301] Fix | Delete
def interpolate(self, key, value):
[302] Fix | Delete
# short-cut
[303] Fix | Delete
if not self._cookie in value:
[304] Fix | Delete
return value
[305] Fix | Delete
[306] Fix | Delete
def recursive_interpolate(key, value, section, backtrail):
[307] Fix | Delete
"""The function that does the actual work.
[308] Fix | Delete
[309] Fix | Delete
``value``: the string we're trying to interpolate.
[310] Fix | Delete
``section``: the section in which that string was found
[311] Fix | Delete
``backtrail``: a dict to keep track of where we've been,
[312] Fix | Delete
to detect and prevent infinite recursion loops
[313] Fix | Delete
[314] Fix | Delete
This is similar to a depth-first-search algorithm.
[315] Fix | Delete
"""
[316] Fix | Delete
# Have we been here already?
[317] Fix | Delete
if (key, section.name) in backtrail:
[318] Fix | Delete
# Yes - infinite loop detected
[319] Fix | Delete
raise InterpolationLoopError(key)
[320] Fix | Delete
# Place a marker on our backtrail so we won't come back here again
[321] Fix | Delete
backtrail[(key, section.name)] = 1
[322] Fix | Delete
[323] Fix | Delete
# Now start the actual work
[324] Fix | Delete
match = self._KEYCRE.search(value)
[325] Fix | Delete
while match:
[326] Fix | Delete
# The actual parsing of the match is implementation-dependent,
[327] Fix | Delete
# so delegate to our helper function
[328] Fix | Delete
k, v, s = self._parse_match(match)
[329] Fix | Delete
if k is None:
[330] Fix | Delete
# That's the signal that no further interpolation is needed
[331] Fix | Delete
replacement = v
[332] Fix | Delete
else:
[333] Fix | Delete
# Further interpolation may be needed to obtain final value
[334] Fix | Delete
replacement = recursive_interpolate(k, v, s, backtrail)
[335] Fix | Delete
# Replace the matched string with its final value
[336] Fix | Delete
start, end = match.span()
[337] Fix | Delete
value = ''.join((value[:start], replacement, value[end:]))
[338] Fix | Delete
new_search_start = start + len(replacement)
[339] Fix | Delete
# Pick up the next interpolation key, if any, for next time
[340] Fix | Delete
# through the while loop
[341] Fix | Delete
match = self._KEYCRE.search(value, new_search_start)
[342] Fix | Delete
[343] Fix | Delete
# Now safe to come back here again; remove marker from backtrail
[344] Fix | Delete
del backtrail[(key, section.name)]
[345] Fix | Delete
[346] Fix | Delete
return value
[347] Fix | Delete
[348] Fix | Delete
# Back in interpolate(), all we have to do is kick off the recursive
[349] Fix | Delete
# function with appropriate starting values
[350] Fix | Delete
value = recursive_interpolate(key, value, self.section, {})
[351] Fix | Delete
return value
[352] Fix | Delete
[353] Fix | Delete
[354] Fix | Delete
def _fetch(self, key):
[355] Fix | Delete
"""Helper function to fetch values from owning section.
[356] Fix | Delete
[357] Fix | Delete
Returns a 2-tuple: the value, and the section where it was found.
[358] Fix | Delete
"""
[359] Fix | Delete
# switch off interpolation before we try and fetch anything !
[360] Fix | Delete
save_interp = self.section.main.interpolation
[361] Fix | Delete
self.section.main.interpolation = False
[362] Fix | Delete
[363] Fix | Delete
# Start at section that "owns" this InterpolationEngine
[364] Fix | Delete
current_section = self.section
[365] Fix | Delete
while True:
[366] Fix | Delete
# try the current section first
[367] Fix | Delete
val = current_section.get(key)
[368] Fix | Delete
if val is not None and not isinstance(val, Section):
[369] Fix | Delete
break
[370] Fix | Delete
# try "DEFAULT" next
[371] Fix | Delete
val = current_section.get('DEFAULT', {}).get(key)
[372] Fix | Delete
if val is not None and not isinstance(val, Section):
[373] Fix | Delete
break
[374] Fix | Delete
# move up to parent and try again
[375] Fix | Delete
# top-level's parent is itself
[376] Fix | Delete
if current_section.parent is current_section:
[377] Fix | Delete
# reached top level, time to give up
[378] Fix | Delete
break
[379] Fix | Delete
current_section = current_section.parent
[380] Fix | Delete
[381] Fix | Delete
# restore interpolation to previous value before returning
[382] Fix | Delete
self.section.main.interpolation = save_interp
[383] Fix | Delete
if val is None:
[384] Fix | Delete
raise MissingInterpolationOption(key)
[385] Fix | Delete
return val, current_section
[386] Fix | Delete
[387] Fix | Delete
[388] Fix | Delete
def _parse_match(self, match):
[389] Fix | Delete
"""Implementation-dependent helper function.
[390] Fix | Delete
[391] Fix | Delete
Will be passed a match object corresponding to the interpolation
[392] Fix | Delete
key we just found (e.g., "%(foo)s" or "$foo"). Should look up that
[393] Fix | Delete
key in the appropriate config file section (using the ``_fetch()``
[394] Fix | Delete
helper function) and return a 3-tuple: (key, value, section)
[395] Fix | Delete
[396] Fix | Delete
``key`` is the name of the key we're looking for
[397] Fix | Delete
``value`` is the value found for that key
[398] Fix | Delete
``section`` is a reference to the section where it was found
[399] Fix | Delete
[400] Fix | Delete
``key`` and ``section`` should be None if no further
[401] Fix | Delete
interpolation should be performed on the resulting value
[402] Fix | Delete
(e.g., if we interpolated "$$" and returned "$").
[403] Fix | Delete
"""
[404] Fix | Delete
raise NotImplementedError()
[405] Fix | Delete
[406] Fix | Delete
[407] Fix | Delete
[408] Fix | Delete
class ConfigParserInterpolation(InterpolationEngine):
[409] Fix | Delete
"""Behaves like ConfigParser."""
[410] Fix | Delete
_cookie = '%'
[411] Fix | Delete
_KEYCRE = re.compile(r"%\(([^)]*)\)s")
[412] Fix | Delete
[413] Fix | Delete
def _parse_match(self, match):
[414] Fix | Delete
key = match.group(1)
[415] Fix | Delete
value, section = self._fetch(key)
[416] Fix | Delete
return key, value, section
[417] Fix | Delete
[418] Fix | Delete
[419] Fix | Delete
[420] Fix | Delete
class TemplateInterpolation(InterpolationEngine):
[421] Fix | Delete
"""Behaves like string.Template."""
[422] Fix | Delete
_cookie = '$'
[423] Fix | Delete
_delimiter = '$'
[424] Fix | Delete
_KEYCRE = re.compile(r"""
[425] Fix | Delete
\$(?:
[426] Fix | Delete
(?P<escaped>\$) | # Two $ signs
[427] Fix | Delete
(?P<named>[_a-z][_a-z0-9]*) | # $name format
[428] Fix | Delete
{(?P<braced>[^}]*)} # ${name} format
[429] Fix | Delete
)
[430] Fix | Delete
""", re.IGNORECASE | re.VERBOSE)
[431] Fix | Delete
[432] Fix | Delete
def _parse_match(self, match):
[433] Fix | Delete
# Valid name (in or out of braces): fetch value from section
[434] Fix | Delete
key = match.group('named') or match.group('braced')
[435] Fix | Delete
if key is not None:
[436] Fix | Delete
value, section = self._fetch(key)
[437] Fix | Delete
return key, value, section
[438] Fix | Delete
# Escaped delimiter (e.g., $$): return single delimiter
[439] Fix | Delete
if match.group('escaped') is not None:
[440] Fix | Delete
# Return None for key and section to indicate it's time to stop
[441] Fix | Delete
return None, self._delimiter, None
[442] Fix | Delete
# Anything else: ignore completely, just return it unchanged
[443] Fix | Delete
return None, match.group(), None
[444] Fix | Delete
[445] Fix | Delete
[446] Fix | Delete
interpolation_engines = {
[447] Fix | Delete
'configparser': ConfigParserInterpolation,
[448] Fix | Delete
'template': TemplateInterpolation,
[449] Fix | Delete
}
[450] Fix | Delete
[451] Fix | Delete
[452] Fix | Delete
def __newobj__(cls, *args):
[453] Fix | Delete
# Hack for pickle
[454] Fix | Delete
return cls.__new__(cls, *args)
[455] Fix | Delete
[456] Fix | Delete
class Section(dict):
[457] Fix | Delete
"""
[458] Fix | Delete
A dictionary-like object that represents a section in a config file.
[459] Fix | Delete
[460] Fix | Delete
It does string interpolation if the 'interpolation' attribute
[461] Fix | Delete
of the 'main' object is set to True.
[462] Fix | Delete
[463] Fix | Delete
Interpolation is tried first from this object, then from the 'DEFAULT'
[464] Fix | Delete
section of this object, next from the parent and its 'DEFAULT' section,
[465] Fix | Delete
and so on until the main object is reached.
[466] Fix | Delete
[467] Fix | Delete
A Section will behave like an ordered dictionary - following the
[468] Fix | Delete
order of the ``scalars`` and ``sections`` attributes.
[469] Fix | Delete
You can use this to change the order of members.
[470] Fix | Delete
[471] Fix | Delete
Iteration follows the order: scalars, then sections.
[472] Fix | Delete
"""
[473] Fix | Delete
[474] Fix | Delete
[475] Fix | Delete
def __setstate__(self, state):
[476] Fix | Delete
dict.update(self, state[0])
[477] Fix | Delete
self.__dict__.update(state[1])
[478] Fix | Delete
[479] Fix | Delete
def __reduce__(self):
[480] Fix | Delete
state = (dict(self), self.__dict__)
[481] Fix | Delete
return (__newobj__, (self.__class__,), state)
[482] Fix | Delete
[483] Fix | Delete
[484] Fix | Delete
def __init__(self, parent, depth, main, indict=None, name=None):
[485] Fix | Delete
"""
[486] Fix | Delete
* parent is the section above
[487] Fix | Delete
* depth is the depth level of this section
[488] Fix | Delete
* main is the main ConfigObj
[489] Fix | Delete
* indict is a dictionary to initialise the section with
[490] Fix | Delete
"""
[491] Fix | Delete
if indict is None:
[492] Fix | Delete
indict = {}
[493] Fix | Delete
dict.__init__(self)
[494] Fix | Delete
# used for nesting level *and* interpolation
[495] Fix | Delete
self.parent = parent
[496] Fix | Delete
# used for the interpolation attribute
[497] Fix | Delete
self.main = main
[498] Fix | Delete
# level of nesting depth of this Section
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function