aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/parso/py3/tests/normalizer_issue_files/allowed_syntax.py
blob: 9cccf619cb6ed351efee1c7cc662d6dc115872d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
"""
Some syntax errors are a bit complicated and need exact checking. Here we
gather some of the potentially dangerous ones.
"""

from __future__ import division

# With a dot it's not a future import anymore.
from .__future__ import absolute_import

'' ''
''r''u''
b'' BR''


for x in [1]:
    break
    continue

try:
    pass
except ZeroDivisionError:
    pass
    #: E722:0
except:
    pass

try:
    pass
    #: E722:0 E901:0
except:
    pass
except ZeroDivisionError:
    pass


r'\n'
r'\x'
b'\n'


a = 3


def x(b=a):
    global a


def x(*args, c=2, d):
    pass


def x(*, c=2, d):
    pass


def x(a, b=1, *args, c=2, d):
    pass


def x(a, b=1, *, c=2, d):
    pass


lambda *args, c=2, d: (c, d)
lambda *, c=2, d: (c, d)
lambda a, b=1, *args, c=2, d: (c, d)
lambda a, b=1, *, c=2, d: (c, d)


*foo, a = (1,)
*foo[0], a = (1,)
*[], a = (1,)


async def foo():
    await bar()
    #: E901
    yield from []
    return
    #: E901
    return ''


# With decorator it's a different statement.
@bla
async def foo():
    await bar()
    #: E901
    yield from []
    return
    #: E901
    return ''


foo: int = 4
(foo): int = 3
((foo)): int = 3
foo.bar: int
foo[3]: int


def glob():
    global x
    y: foo = x


def c():
    a = 3

    def d():
        class X():
            nonlocal a


def x():
    a = 3

    def y():
        nonlocal a


def x():
    def y():
        nonlocal a

    a = 3


def x():
    a = 3

    def y():
        class z():
            nonlocal a


def x(a):
    def y():
        nonlocal a


def x(a, b):
    def y():
        nonlocal b
        nonlocal a


def x(a):
    def y():
        def z():
            nonlocal a


def x():
    def y(a):
        def z():
            nonlocal a


a = *args, *args
error[(*args, *args)] = 3
*args, *args