mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
Highlight expressions that are invalid by grammar or unacceptable in runtime Highlight expressions in pythons < 3.8 GitOrigin-RevId: 89acec9db5b3a931da31c33778185e147240ec01
13 lines
720 B
Python
13 lines
720 B
Python
# Handle a matched regex
|
|
if (<error descr="Python version 3.7 does not support assignment expressions">match := pattern.search(data)</error>) is not None:
|
|
pass
|
|
|
|
# A loop that can't be trivially rewritten using 2-arg iter()
|
|
while <error descr="Python version 3.7 does not support assignment expressions">chunk := file.read(8192)</error>:
|
|
pass
|
|
|
|
# Reuse a value that's expensive to compute
|
|
[<error descr="Python version 3.7 does not support assignment expressions">y := f(x)</error>, y**2, y**3]
|
|
|
|
# Share a subexpression between a comprehension filter clause and its output
|
|
filtered_data = [y for x in data if (<error descr="Python version 3.7 does not support assignment expressions">y := f(x)</error>) is not None] |