build_valid_guard(fpath))
return fcontents
- print('{}: Wrong preprocessor guards (RE {}):'
- '\n\tFound {}, expected {}').format(fpath, regexp.pattern,
- match_txt, correct)
+ print(
+ '{}: Wrong preprocessor guards (RE {}):'
+ '\n\tFound {}, expected {}').format(fpath, regexp.pattern,
+ match_txt, correct)
if fix:
print 'Fixing {}...\n'.format(fpath)
fixed_fcontents = re.sub(match_txt, correct, fcontents)
# No endif. Check if we have the last line as just '#endif' and if so
# replace it with a properly commented one.
if flines[-1] == '#endif':
- flines[-1] = (
- '#endif' +
- (' // {}\n'.format(valid_guard)
- if cpp_header else ' /* {} */\n'.format(valid_guard)))
+ flines[-1] = ('#endif' +
+ (' // {}\n'.format(valid_guard) if cpp_header
+ else ' /* {} */\n'.format(valid_guard)))
if fix:
fcontents = '\n'.join(flines)
save(fpath, fcontents)
ok = True
filename_list = []
try:
- filename_list = subprocess.check_output(
- FILE_LIST_COMMAND, shell=True).splitlines()
+ filename_list = subprocess.check_output(FILE_LIST_COMMAND,
+ shell=True).splitlines()
# Filter out non-existent files (ie, file removed or renamed)
filename_list = (f for f in filename_list if os.path.isfile(f))
except subprocess.CalledProcessError: