INNER CODE UNIT · Python

_without_yaml_comments

christopherkarani/Wax · Resources/hermes/wax-memory-plugin/cli.py:26

def _without_yaml_comments(text: str) -> str:
    lines = []
    for line in text.splitlines():
        quote = ""
        escaped = False
        kept = []
        for character in line:
            if escaped:
                kept.append(character)
                escaped = False
                continue
            if character == "\\" and quote == '"':
                kept.append(character)
                escaped = True
                continue
            if character in {"'", '"'}:
                if not quote:
                    quote = character

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…