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

Method repr_string

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

Source from the content-addressed store, hash-verified

576 return self.escape(cram(stripid(repr(x)), self.maxother))
577
578 def repr_string(self, x, level):
579 test = cram(x, self.maxstring)
580 testrepr = repr(test)
581 if '\\' in test and '\\' not in replace(testrepr, r'\\', ''):
582 # Backslashes are only literal in the string and are never
583 # needed to make any special characters, so show a raw string.
584 return 'r' + testrepr[0] + self.escape(test) + testrepr[0]
585 return re.sub(r'((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)',
586 r'<span class="repr">\1</span>',
587 self.escape(testrepr))
588
589 repr_str = repr_string
590

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected