Wrapper that shows a string with a `r` prefix
| 580 | |
| 581 | |
| 582 | class RawStringLiteral: |
| 583 | """ Wrapper that shows a string with a `r` prefix """ |
| 584 | def __init__(self, value): |
| 585 | self.value = value |
| 586 | |
| 587 | def _repr_pretty_(self, p, cycle): |
| 588 | base_repr = repr(self.value) |
| 589 | if base_repr[:1] in 'uU': |
| 590 | base_repr = base_repr[1:] |
| 591 | prefix = 'ur' |
| 592 | else: |
| 593 | prefix = 'r' |
| 594 | base_repr = prefix + base_repr.replace('\\\\', '\\') |
| 595 | p.text(base_repr) |
| 596 | |
| 597 | |
| 598 | def _default_pprint(obj, p, cycle): |
no outgoing calls
no test coverage detected
searching dependent graphs…