forked from wemake-services/wemake-python-styleguide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noqa.py
189 lines (128 loc) · 3.49 KB
/
noqa.py
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
"""
This file contains all possible violations.
It is used for e2e tests.
"""
from __future__ import print_function # noqa: Z422
from .version import get_version # noqa: Z300
import os.path # noqa: Z301
import sys as sys # noqa: Z113
from some import _protected # noqa: Z440
full_name = u'Nikita Sobolev' # noqa: Z302
phone_number = 555_123_999 # noqa: Z303
partial_number = .05 # noqa: Z304
formatted_string = f'Hi, {full_name}' # noqa: Z305
def some(): # noqa: Z110
from my_module import some_function # noqa: Z435
class Nested(object): ... # noqa: Z220, Z431
def nested(): ... # noqa: Z430
raise NotImplemented # noqa: Z423
del {'a': 1}['a'] # noqa: Z420
hasattr(object, 'some') # noqa: Z421
value = 1 # noqa: Z110
x = 2 # noqa: Z111
__private = 3 # noqa: Z112
star_wars_episode_7 = 'the worst episode ever' # noqa: Z114
consecutive__underscores = 4 # noqa: Z116
cls = 5 # noqa: Z117
__author__ = 'Nikita Sobolev' # noqa: Z410
extremely_long_name_that_needs_to_be_shortened_to_work_fine = 2 # noqa: Z118
some._execute() # noqa: Z441
def many_locals(): # noqa: Z210
arg1, arg2, arg3, arg4, arg5, arg6 = range(6)
def many_arguments(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6): # noqa: Z211
...
def many_returns(xy): # noqa: Z212
if xy > 1:
return 1
if xy > 2:
return 2
if xy > 3:
return 3
if xy > 4:
return 4
if xy > 5:
return 5
return 6
def many_expressions(xy): # noqa: Z213
print(xy)
print(xy)
print(xy)
print(xy)
print(xy)
print(xy)
print(xy)
print(xy)
print(xy)
print(xy)
class ManyParents(dict, list, tuple, Exception): # noqa: Z215
...
line = some.call(7 * 2, 3 / 4) / some.run(5 / some, 8 - 2 + 1) # noqa: Z221
if line and line > 2 and line > 3 and line > 4 and line > 5: # noqa: Z221,Z222
...
if line: # noqa: Z223
...
elif line > 1:
...
elif line > 2:
...
elif line > 3:
...
elif line > 4:
...
numbers = [
target # noqa: Z224
for assignment in range(hex_number)
for target in range(assignment)
for _ in range(10)
if isinstance(target, int)
]
class BadClass: # noqa: Z306
UPPER_CASE_ATTRIBUTE = 12 # noqa: Z115
@staticmethod # noqa: Z433
def some_static():
...
@staticmethod # noqa: Z433
async def some_async_static():
...
def __del__(self, *_args, **_kwargs): # noqa: Z434
...
class Nested: # noqa: Z306,Z431
...
magic_numbers = 13.2 + 50 # noqa: Z432
nodes = [node for node in 'abc' if node != 'a' if node != 'b'] # noqa: Z307
assert 1 > 1 > hex_number # noqa: Z308
assert 2 > octal_number # noqa: Z309
hex_number = 0XFF # noqa: Z310
octal_number = 0O11 # noqa: Z310
binary_number = 0B1001 # noqa: Z310
number_with_scientific_notation = 1.5E+10 # noqa: Z310
if '6' in nodes in '6': # noqa: Z311
...
assert hex_number == hex_number # noqa: Z312
def test_function():
return(123, 33) # noqa: Z313
if True: # noqa: Z314
...
class SomeClass(FirstParent, SecondParent, object): # noqa: Z315
...
try:
...
except BaseException: # noqa: Z424
...
for symbol in 'abc': # noqa: Z436
...
else:
...
try: # noqa: Z437
...
finally:
...
nodes = nodes # noqa: Z438
class Example(object):
def __init__(self): # noqa: Z439
yield 10
for index in range(6): # noqa: Z442
print(lambda: index)
def function_with_unreachable():
raise ValueError()
print(1) # noqa: Z443