if key in indict:
outdict[key] = indict[key]
for key in sorted(indict.keys()):
- if key in special_keys: continue
- if '#' in key: continue
+ if key in special_keys:
+ continue
+ if '#' in key:
+ continue
outdict[key] = indict[key]
return outdict
def _clean_elem(indict):
for name in ['public_headers', 'headers', 'src']:
- if name not in indict: continue
+ if name not in indict:
+ continue
inlist = indict[name]
protos = list(x for x in inlist if os.path.splitext(x)[1] == '.proto')
others = set(x for x in inlist if x not in protos)
"""Takes dictionary which represents yaml file and returns the cleaned-up yaml string"""
js = _rebuild_as_ordered_dict(indict, _TOP_LEVEL_KEYS)
for grp in ['filegroups', 'libs', 'targets']:
- if grp not in js: continue
+ if grp not in js:
+ continue
js[grp] = sorted([_clean_elem(x) for x in js[grp]],
key=lambda x: (x.get('language', '_'), x['name']))
output = yaml.dump(js, indent=2, width=80, default_flow_style=False)