INNER CODE UNIT · Python
complete
bsilverthorn/maccarone · src/maccarone/preprocessor.py:45
def complete(self, replacement: Optional[str]) -> str:
(indent, guidance) = (self.indent, self.guidance)
if "\n" in guidance:
guidance_lines = "\n"
guidance_lines += "\n".join(f"{indent}#{line}" for line in guidance.splitlines())
guidance_lines += f"\n{indent}#"
else:
guidance_lines = guidance
source = f"{indent}#<<{guidance_lines}>>\n"
if replacement is not None:
source += indent + indent.join(replacement.splitlines(True))
source += f"{indent}#<</>>\n"
elif self.inlined is not None:
source += self.inlined
source += f"{indent}#<</>>\n"