-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathtest.py
More file actions
305 lines (232 loc) · 4.39 KB
/
test.py
File metadata and controls
305 lines (232 loc) · 4.39 KB
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Above the run-comment and file encoding comment.
# Comments.
# TODO FIXME XXX
# Keywords.
with break continue del return pass raise global assert lambda yield
for while if elif else import as try except finally
self cls mcs
from test import var as name
raise Exception from ex
yield from
def functionname
functionname()
functionname ()
functionname ()
test.functionname()
test.functionname ()
class Classname
class classname
class classname_cls
def функция
функция()
class Класс
class класс
# Keywords: Python 2
exec
print
# Keywords: Python 3
await
async def Test
async with
async for
# Builtin objects.
True False Ellipsis None NotImplemented
__debug__ __doc__ __file__ __name__ __package__ __loader__ __spec__ __path__ __cached__
# Bultin types
bool bytearray dict float frozenset int list object set str tuple
# Builtin functions
__import__()
abs()
all()
any()
bin()
bool()
breakpoint()
bytearray()
callable()
chr()
classmethod()
compile()
complex()
delattr()
dict()
dir()
divmod()
enumerate()
eval()
filter()
float()
format()
frozenset()
getattr()
globals()
hasattr()
hash()
help()
hex()
id()
input()
int()
isinstance()
issubclass()
iter()
len()
list()
locals()
map()
max()
memoryview()
min()
next()
object()
oct()
open()
ord()
pow()
property()
range()
repr()
reversed()
round()
set()
setattr()
slice()
sorted()
staticmethod()
str()
sum()
super()
tuple()
type()
vars()
zip()
# Builtin functions: Python 2
apply()
basestring()
buffer()
cmp()
coerce()
execfile()
file()
intern()
long()
raw_input()
reduce()
reload()
unichr()
unicode()
xrange()
print()
# Builtin functions: Python 3
ascii()
bytes()
exec()
print()
# Builtin exceptions and warnings.
BaseException Exception StandardError ArithmeticError LookupError
EnvironmentError
AssertionError AttributeError EOFError FloatingPointError GeneratorExit IOError
ImportError IndexError KeyError KeyboardInterrupt MemoryError NameError
NotImplementedError OSError OverflowError ReferenceError RuntimeError
StopIteration SyntaxError IndentationError TabError SystemError SystemExit
TypeError UnboundLocalError UnicodeError UnicodeEncodeError UnicodeDecodeError
UnicodeTranslateError ValueError WindowsError ZeroDivisionError
Warning UserWarning DeprecationWarning PendingDeprecationWarning SyntaxWarning
RuntimeWarning FutureWarning ImportWarning UnicodeWarning
# Decorators.
@ decoratorname
@ object.__init__(arg1, arg2)
@ декоратор
@ декоратор.décorateur
# Operators
and or in is not
- + * ** **- **+ **~ @ / // %
& | ^ ~ << >>
< <= == != >= >
= =- =+ =~
-= += *= **= @= /= //= %= :=
&= |= ^= ~= <<= >>=
->
# Erroneous operators
$ ?
===
-- ++ *** @@ /// %%
&& || ^^ ~~ <<< >>>
<== !== !!= >==
%- +- -+
# Numbers
0 1 2 9 10 0x1f 1. .3 12.34 0j 124j 34.2E-3 0b10 0o77 1023434 0x0
1_1 1_1.2_2 1_2j 0x_1f 0x1_f 34_56e-3 34_56e+3_1 0o7_7
# Erroneous numbers
077 100L 0xfffffffL 0L 08 0xk 0x 0b102 0o78 0o123LaB
0_ 0_1 0_x1f 0x1f_ 0_b77 0b77_ .2_ 1_j
# Strings
" test " ' test '
"test\
test"
'test\
test'
"""
test
\""""
'''
test
\''''
" \a\b\c\"\'\n\r \x34\077 \08 \xag"
r" \" \' "
"testтест"
b"test"
b"test\r\n\xffff"
b"тестtest"
br"test"
br"\a\b\n\r"
# Formattings
" %f "
b" %f "
"{0.name!r:b} {0[n]} {name!s: } {{test}} {{}} {} {.__len__:s}"
b"{0.name!r:b} {0[n]} {name!s: } {{test}} {{}} {} {.__len__:s}"
"${test} ${test ${test}aname $$$ $test+nope"
b"${test} ${test ${test}aname $$$ $test+nope"
f"{var}...{arr[123]} normal {var['{'] // 0xff} \"xzcb\" 'xzcb' {var['}'] + 1} text"
f"{expr1 if True or False else expr2} {None} wow {','.join(c.lower() for c in 'asdf')}"
f"hello {expr:.2f} yes {(lambda: 0b1)():#03x} lol {var!r}"
f'brackets: {{{ 1 + 2 }}} and {{{{ 3 + 4 }}}}'
fr'this {that}'
f"{f'{1+1}'}"
'{{ }}'
f"{"{test}"}" # FIXME: syntax error that should not be highlighted
f'{self.__name__}'
# F-String Spelling Issue #43
f'this is a test' f"this is a test" f"""this is a test""" f'''this is a test'''
f'this' f"this" f"""this"""
r'this' r"this" r"""this"""
rf'this [^fe] is a raw f string'
fr'this is a raw f string'
fr"this is a raw f string"
bf'this is' fs'this is' # Invalid, Invalid
# Doctests.
"""
Test:
>>> a = 5
>>> a
5
Test
"""
'''
Test:
>>> a = 5
>>> a
5
Test
'''
# Erroneous variable names
6xav
# Indentation errors.
break
# Trailing space errors.
break
"""
test
"""