File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 129
129
COMPARE_NEGATIVE_REGEX = re .compile (r'\b(?<!is\s)(not)\s+[^][)(}{ ]+\s+'
130
130
r'(in|is)\s' )
131
131
COMPARE_TYPE_REGEX = re .compile (
132
- r'(?: [=!]=|is(?: \s+not)?)\s+ type(?:\s*\(\s*([^)]*[^ )])\s*\))' +
133
- r'|\btype(?:\s*\(\s*([^)]*[^ )])\s*\))\s+(?: [=!]=|is(?:\s+not)?) '
132
+ r'[=!]=\s+type(?:\s*\(\s*([^)]*[^ )])\s*\))'
133
+ r'|\btype(?:\s*\(\s*([^)]*[^ )])\s*\))\s+[=!]='
134
134
)
135
135
KEYWORD_REGEX = re .compile (r'(\s*)\b(?:%s)\b(\s*)' % r'|' .join (KEYWORDS ))
136
136
OPERATOR_REGEX = re .compile (r'(?:[^,\s])(\s*)(?:[-+*/|!<=>%&^]+|:=)(\s*)' )
@@ -1459,7 +1459,7 @@ def comparison_type(logical_line, noqa):
1459
1459
Do not compare types directly.
1460
1460
1461
1461
Okay: if isinstance(obj, int):
1462
- E721: if type(obj) is type(1):
1462
+ E721: if type(obj) == type(1):
1463
1463
"""
1464
1464
match = COMPARE_TYPE_REGEX .search (logical_line )
1465
1465
if match and not noqa :
Original file line number Diff line number Diff line change 9
9
10
10
if res == types .IntType :
11
11
pass
12
- #: E721
12
+ #: Okay
13
13
import types
14
14
15
15
if type (res ) is not types .ListType :
26
26
assert type (res ) == type ((0 ))
27
27
#: E721
28
28
assert type (res ) != type ((1 , ))
29
- #: E721
29
+ #: Okay
30
30
assert type (res ) is type ((1 , ))
31
- #: E721
31
+ #: Okay
32
32
assert type (res ) is not type ((1 , ))
33
33
#: E211 E721
34
34
assert type (res ) == type ([2 , ])
You can’t perform that action at this time.
0 commit comments