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

Function contains_ambiguous_backslash

Lib/test/test_tokenize.py:1980–1993  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

check_roundtripMethod · 0.85

Calls 2

compileMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected