MCPcopy Index your code
hub / github.com/RustPython/RustPython / repr_string

Method repr_string

Lib/pydoc.py:623–632  ·  view source on GitHub ↗
(self, x, level)

Source from the content-addressed store, hash-verified

621 return self.escape(cram(stripid(repr(x)), self.maxother))
622
623 def repr_string(self, x, level):
624 test = cram(x, self.maxstring)
625 testrepr = repr(test)
626 if '\\' in test and '\\' not in replace(testrepr, r'\\', ''):
627 # Backslashes are only literal in the string and are never
628 # needed to make any special characters, so show a raw string.
629 return 'r' + testrepr[0] + self.escape(test) + testrepr[0]
630 return re.sub(r'((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)',
631 r'<span class="repr">\1</span>',
632 self.escape(testrepr))
633
634 repr_str = repr_string
635

Callers

nothing calls this directly

Calls 5

escapeMethod · 0.95
cramFunction · 0.85
reprFunction · 0.85
replaceFunction · 0.70
subMethod · 0.45

Tested by

no test coverage detected