MCPcopy Index your code
hub / github.com/python/cpython / _write_str_avoiding_backslashes

Method _write_str_avoiding_backslashes

Lib/_ast_unparse.py:570–574  ·  view source on GitHub ↗

Write string literal value with a best effort attempt to avoid backslashes.

(self, string, *, quote_types=_ALL_QUOTES)

Source from the content-addressed store, hash-verified

568 return escaped_string, possible_quotes
569
570 def _write_str_avoiding_backslashes(self, string, *, quote_types=_ALL_QUOTES):
571 """Write string literal value with a best effort attempt to avoid backslashes."""
572 string, quote_types = self._str_literal_helper(string, quote_types=quote_types)
573 quote_type = quote_types[0]
574 self.write(f"{quote_type}{string}{quote_type}")
575
576 def _ftstring_helper(self, parts):
577 new_parts = []

Callers 1

_write_docstringMethod · 0.95

Calls 2

_str_literal_helperMethod · 0.95
writeMethod · 0.95

Tested by

no test coverage detected