mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[mod] try to improve lisibility a bit
This commit is contained in:
parent
17ca60c3a5
commit
93cb77d0a5
1 changed files with 18 additions and 14 deletions
|
@ -717,22 +717,26 @@ def _append_to_stats(stats, monitor, statics=[]):
|
||||||
statics = [statics]
|
statics = [statics]
|
||||||
|
|
||||||
# Appending function
|
# Appending function
|
||||||
def _append(s, m, st):
|
def _append(_stats, _monitor, _statics):
|
||||||
for k, v in m.items():
|
for key, value in _monitor.items():
|
||||||
if k in st:
|
if key in _statics:
|
||||||
s[k] = v
|
_stats[key] = value
|
||||||
elif isinstance(v, dict):
|
|
||||||
if k not in s:
|
elif isinstance(value, dict):
|
||||||
s[k] = {}
|
if key not in _stats:
|
||||||
s[k] = _append(s[k], v, st)
|
_stats[key] = {}
|
||||||
|
_stats[key] = _append(_stats[key], value, _statics)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if k not in s:
|
if key not in _stats:
|
||||||
s[k] = []
|
_stats[key] = []
|
||||||
if isinstance(v, list):
|
|
||||||
s[k].extend(v)
|
if isinstance(value, list):
|
||||||
|
_stats[key].extend(value)
|
||||||
else:
|
else:
|
||||||
s[k].append(v)
|
_stats[key].append(value)
|
||||||
return s
|
|
||||||
|
return _stats
|
||||||
|
|
||||||
stats = _append(stats, monitor, statics)
|
stats = _append(stats, monitor, statics)
|
||||||
return stats
|
return stats
|
||||||
|
|
Loading…
Add table
Reference in a new issue