INNER CODE UNIT · Python
f
mongodb/mongo-cxx-driver · etc/format.py:179
def f(mat: re.Match[str]) -> str:
# See groups in INCLUDE_RE
target = mat['path']
abs_target = parent_dir / target
if abs_target.is_file():
# This should be a relative include:
newl = f'{mat["directive"]}"./{target}"{mat["tail"]}'
else:
newl = f'{mat["directive"]}<{target}>{mat["tail"]}'
print(f' - {fpath}: update #include directive: {mat[0]!r} → {newl!r}', file=sys.stderr)
return newl
return f
def _fixup_includes(fpath: Path, *, mode: RunMode) -> bool:
"""
Apply #include-fixup to the content of the given source file.