MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / repr_string

Method repr_string

tools/python-3.11.9-amd64/Lib/pydoc.py:559–568  ·  view source on GitHub ↗
(self, x, level)

Source from the content-addressed store, hash-verified

557 return self.escape(cram(stripid(repr(x)), self.maxother))
558
559 def repr_string(self, x, level):
560 test = cram(x, self.maxstring)
561 testrepr = repr(test)
562 if '\\' in test and '\\' not in replace(testrepr, r'\\', ''):
563 # Backslashes are only literal in the string and are never
564 # needed to make any special characters, so show a raw string.
565 return 'r' + testrepr[0] + self.escape(test) + testrepr[0]
566 return re.sub(r'((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)',
567 r'<span class="repr">\1</span>',
568 self.escape(testrepr))
569
570 repr_str = repr_string
571

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