Return `True` if the source contains a backslash on a line by itself. For example: a = (1 \\ ) Code like this cannot be untokenized exactly. This is because the tokenizer does not produce any tokens for the line containing the backslash and so there is no way to kno
(source)
| 1976 | |
| 1977 | |
| 1978 | def contains_ambiguous_backslash(source): |
| 1979 | """Return `True` if the source contains a backslash on a |
| 1980 | line by itself. For example: |
| 1981 | |
| 1982 | a = (1 |
| 1983 | \\ |
| 1984 | ) |
| 1985 | |
| 1986 | Code like this cannot be untokenized exactly. This is because |
| 1987 | the tokenizer does not produce any tokens for the line containing |
| 1988 | the backslash and so there is no way to know its indent. |
| 1989 | """ |
| 1990 | pattern = re.compile(br'\n\s*\\\r?\n') |
| 1991 | return pattern.search(source) is not None |
| 1992 | |
| 1993 | |
| 1994 | class TestRoundtrip(TestCase): |
no test coverage detected
searching dependent graphs…