MCPcopy
hub / github.com/psycopg/psycopg / Unparser

Class Unparser

tools/async_to_sync.py:577–590  ·  view source on GitHub ↗

Try to emit long strings as multiline. The normal class only tries to emit docstrings as multiline, but the resulting source doesn't pass flake8.

Source from the content-addressed store, hash-verified

575
576
577class Unparser(ast._Unparser): # type: ignore
578 """
579 Try to emit long strings as multiline.
580
581 The normal class only tries to emit docstrings as multiline,
582 but the resulting source doesn't pass flake8.
583 """
584
585 # Beware: private method. Tested with in Python 3.10, 3.11.
586 def _write_constant(self, value: Any) -> None:
587 if isinstance(value, str) and len(value) > 50:
588 self._write_str_avoiding_backslashes(value)
589 else:
590 super()._write_constant(value)
591
592
593def parse_cmdline() -> Namespace:

Callers 1

unparseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected