Skip to content

Commit 10a87d8

Browse files
committed
[airos] switched to friendlier names in dictionary iteration
1 parent aee3953 commit 10a87d8

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

netjsonconfig/backends/airos/airos.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,9 @@ def intermediate_to_list(configuration):
131131
(index, config) = element
132132
# update the keys to prefix the index
133133
temp = {}
134-
for k, v in config.items():
134+
for key, value in config.items():
135135
# write the new key
136-
temp['{i}.{key}'.format(i=index + 1, key=k)] = v
137-
136+
temp['{i}.{key}'.format(i=index + 1, key=key)] = value
138137
config = temp
139138
# now the keys are updated with the index
140139
# reduce to atoms the new config
@@ -144,18 +143,17 @@ def intermediate_to_list(configuration):
144143

145144
elif isinstance(element, dict):
146145
temp = {}
147-
for k, v in element.items():
148-
if isinstance(v, string_types) or isinstance(v, int):
146+
for key, value in element.items():
147+
if isinstance(value, string_types) or isinstance(value, int):
149148
pass
150149
else:
151150
# reduce to atom list
152-
# as v could be dict or list
151+
# as value could be dict or list
153152
# enclose it in a flattened list
154-
for son in intermediate_to_list(flatten([v])):
155-
156-
for sk, sv in son.items():
157-
nested_key = '{key}.{subkey}'.format(key=k, subkey=sk)
158-
temp[nested_key] = sv
153+
for child in intermediate_to_list(flatten([value])):
154+
for child_key, child_value in child.items():
155+
nested_key = '{key}.{subkey}'.format(key=child_key, subkey=child_value)
156+
temp[nested_key] = child_value
159157

160158
# now it is atomic, append it to
161159
result.append(temp)

0 commit comments

Comments
 (0)