Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
elif '.' in key: # conf_layer_stack back to [self._dict]
conf_layer_stack = [self._dict]
comments = self._handle_group_keys(
key, conf_dict_now, conf_layer_stack, comments
)
elif level > len(conf_layer_stack) + 1:
raise ArrayFormatError(line)
elif level == len(conf_layer_stack) + 1:
# new grou for
if key[0] == '@':
key = key[1:]
conflist = ConfList()
conflist.append(ConfDict())
conf_dict_now.set_ex(key, conflist, [])
else:
conf_dict_now.set_ex(key, ConfDict(), comments)
comments = []
conf_layer_stack.append(conf_dict_now[key])
elif level == len(conf_layer_stack):
# -1 means the last item. -2 means the second from the end
conf_dict_now = conf_layer_stack[-2] # back one
while isinstance(conf_dict_now, list):
conf_dict_now = conf_dict_now[-1]
if key[0] == '@':
tmpkey = key[1:]
if tmpkey in conf_dict_now: # the same group
# pylint: disable=E1101
# conf_dict_now[tmpkey] = ConfDict()
if tmpkey != last_list_key:
conf_layer_stack[-1] = conf_dict_now[tmpkey]
conf_layer_stack[-1].append_ex(
ConfDict(), comments
else:
conf_dict_now.set_ex(key, ConfDict(), comments)
comments = []
conf_layer_stack[-1] = conf_dict_now[key]
elif level < len(conf_layer_stack):
conf_dict_now = conf_layer_stack[level - 2] # get back
while isinstance(conf_dict_now, list):
conf_dict_now = conf_dict_now[-1]
if key[0] == '@':
tmpkey = key[1:]
if tmpkey in conf_dict_now: # the same group
tmpdict = ConfDict()
conf_layer_stack[level - 1].append(tmpdict)
else: # different group
conflist = ConfList()
conflist.append(ConfDict())
conf_dict_now.set_ex(tmpkey, conflist, [])
conf_layer_stack[level - 1] = conf_dict_now[tmpkey]
else:
conf_dict_now.set_ex(key, ConfDict(), comments)
comments = []
conf_layer_stack[level - 1] = conf_dict_now[key]
conf_layer_stack = conf_layer_stack[:level]
else:
raise UnknowConfError('exception occured')
num += 1
return self._dict
if tmpkey != last_list_key:
conf_layer_stack[-1] = conf_dict_now[tmpkey]
conf_layer_stack[-1].append_ex(
ConfDict(), comments
)
comments = []
else: # different group
conflist = ConfList()
conflist.append(ConfDict())
conf_dict_now.set_ex(tmpkey, conflist, comments)
# conf_dict_now.set_ex(tmpkey, conflist, [])
comments = []
conf_layer_stack[-1] = conf_dict_now[tmpkey]
last_list_key = tmpkey
else:
conf_dict_now.set_ex(key, ConfDict(), comments)
comments = []
conf_layer_stack[-1] = conf_dict_now[key]
elif level < len(conf_layer_stack):
conf_dict_now = conf_layer_stack[level - 2] # get back
while isinstance(conf_dict_now, list):
conf_dict_now = conf_dict_now[-1]
if key[0] == '@':
tmpkey = key[1:]
if tmpkey in conf_dict_now: # the same group
tmpdict = ConfDict()
conf_layer_stack[level - 1].append(tmpdict)
else: # different group
conflist = ConfList()
conflist.append(ConfDict())
conf_dict_now.set_ex(tmpkey, conflist, [])
conf_layer_stack[level - 1] = conf_dict_now[tmpkey]
groupkey = groupkey[1:]
if groupkey in conf_dict_now:
conf_dict_now[groupkey].append_ex(
{}, comments
)
comments = []
else:
conflist = ConfList()
conf_dict_now.set_ex(
groupkey, conflist, comments
)
comments = []
conflist.append(ConfDict())
else:
conf_dict_now.set_ex(
groupkey, ConfDict(), comments
)
comments = []
conf_layer_stack.append(conf_dict_now[groupkey])
return comments
comments = []
conf_layer_stack.append(conf_dict_now[key])
elif level == len(conf_layer_stack):
# -1 means the last item. -2 means the second from the end
conf_dict_now = conf_layer_stack[-2] # back one
while isinstance(conf_dict_now, list):
conf_dict_now = conf_dict_now[-1]
if key[0] == '@':
tmpkey = key[1:]
if tmpkey in conf_dict_now: # the same group
# pylint: disable=E1101
# conf_dict_now[tmpkey] = ConfDict()
if tmpkey != last_list_key:
conf_layer_stack[-1] = conf_dict_now[tmpkey]
conf_layer_stack[-1].append_ex(
ConfDict(), comments
)
comments = []
else: # different group
conflist = ConfList()
conflist.append(ConfDict())
conf_dict_now.set_ex(tmpkey, conflist, comments)
# conf_dict_now.set_ex(tmpkey, conflist, [])
comments = []
conf_layer_stack[-1] = conf_dict_now[tmpkey]
last_list_key = tmpkey
else:
conf_dict_now.set_ex(key, ConfDict(), comments)
comments = []
conf_layer_stack[-1] = conf_dict_now[key]
elif level < len(conf_layer_stack):
conf_dict_now = conf_layer_stack[level - 2] # get back
# conf_dict_now.set_ex(tmpkey, conflist, [])
comments = []
conf_layer_stack[-1] = conf_dict_now[tmpkey]
last_list_key = tmpkey
else:
conf_dict_now.set_ex(key, ConfDict(), comments)
comments = []
conf_layer_stack[-1] = conf_dict_now[key]
elif level < len(conf_layer_stack):
conf_dict_now = conf_layer_stack[level - 2] # get back
while isinstance(conf_dict_now, list):
conf_dict_now = conf_dict_now[-1]
if key[0] == '@':
tmpkey = key[1:]
if tmpkey in conf_dict_now: # the same group
tmpdict = ConfDict()
conf_layer_stack[level - 1].append(tmpdict)
else: # different group
conflist = ConfList()
conflist.append(ConfDict())
conf_dict_now.set_ex(tmpkey, conflist, [])
conf_layer_stack[level - 1] = conf_dict_now[tmpkey]
else:
conf_dict_now.set_ex(key, ConfDict(), comments)
comments = []
conf_layer_stack[level - 1] = conf_dict_now[key]
conf_layer_stack = conf_layer_stack[:level]
else:
raise UnknowConfError('exception occured')
num += 1
return self._dict
conf_layer_stack.append(conf_dict_now)
else:
if groupkey[0] == '@':
groupkey = groupkey[1:]
if groupkey in conf_dict_now:
conf_dict_now[groupkey].append_ex(
{}, comments
)
comments = []
else:
conflist = ConfList()
conf_dict_now.set_ex(
groupkey, conflist, comments
)
comments = []
conflist.append(ConfDict())
else:
conf_dict_now.set_ex(
groupkey, ConfDict(), comments
)
comments = []
conf_layer_stack.append(conf_dict_now[groupkey])
return comments